Install fails with requirements.txt but works with pip install

1.7k Views Asked by At

I'm seeing some weird behavior when using requirements.txt vs. when installing directly with pip. Hoping you can shed some light on this.

This may be the same as this unanswered question: pip install -r requirements.txt fails on scipy, but works when run manually line-by-line

Python 2.7.6

Django 1.6.11

When I install mailchimp3 using requirements.txt like this:

sudo /usr/local/python/django/bin/pip install -r config/myvr/requirements.txt

The install fails and I see:

Collecting mailchimp3==2.0.3 (from -r config/myvr/requirements.txt (line 73)) 2016-12-21 11:23:22,286 [salt.loaded.int.module.cmdmod][ERROR ][1759] stderr: /usr/local/python/django/local/lib/python2.7/site-packages/pip/req/req_f ile.py:129: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options. cmdoptions.check_install_build_global(options, opts) /usr/local/python/django/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLCon text object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more informati on, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Could not find a version that satisfies the requirement mailchimp3==2.0.3 (from -r config/myvr/requirements.txt (line 73)) (from versions: ) No matching distribution found for mailchimp3==2.0.3 (from -r config/myvr/requirements.txt (line 73)) 2016-12-21 11:23:22,286 [salt.loaded.int.module.cmdmod][ERROR ][1759] retcode: 1

However, when I install directly like this: sudo /usr/local/python/django/bin/pip install mailchimp3==2.0.3

The install succeeds:

(django)ubuntu@dev:~/myvr$ sudo /usr/local/python/django/bin/pip install mailchimp3==2.0.3 The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting mailchimp3==2.0.3 /usr/local/python/django/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning. SNIMissingWarning /usr/local/python/django/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Downloading mailchimp3-2.0.3-py2.py3-none-any.whl (83kB) 100% |████████████████████████████████| 92kB 413kB/s Requirement already satisfied: requests in /usr/local/python/django/lib/python2.7/site-packages (from mailchimp3==2.0.3) Installing collected packages: mailchimp3 Successfully installed mailchimp3-2.0.3 (django)ubuntu@dev:~/myvr$

This must be installed using the requirements file and not installed directly for our production environment. Any chance you have an idea of what's up here?

Do you need any other information?

2

There are 2 best solutions below

0
On BEST ANSWER

The issue was that in the requirements.txt file there is a dependency on lxml and that dependency is setup to be installed without-threading so it looked like this

lxml==3.5.0 --install-option='--without-threading'

Any time --install-option (or --build-options or --global-options) are passed, that disables all use of wheels.

In the case of mailchimp3 it requires wheels to install correctly.

Our solution was to move the installation of lxml into a separate build step.

0
On

Can not go through your error message, but you can check if your requirements.txt contain packages that have dependencies on packages enlisted in same file. Suppose req file contain pack1 and pack2 if pack1 import pack2 and pack2 is called later then installation will fail. there is been problem with me and here is a similar problem on github