I'm having difficulties with the --global-option and --install-option settings for a requirements.txt file. Specifying the options for one library is causing other libraries installs to fail.
I'm trying to install Python libraries "grab" and "pycurl". I need to specify that pycurl be installed with option: "--with-nss". I can replicate the error on a completely clean virtual enviroment.
On a new virtual environment With requirements.txt containing:
grab==0.6.25
pycurl==7.43.0 --install-option='--with-nss'
Then installing with:
pip install -r requirements.txt
The following errors will occur.
Installing collected packages: lxml, pycurl, pytils, six, user-agent, weblib, selection, grab
Running setup.py install for lxml ... done
Running setup.py install for pycurl ... done
Running setup.py install for pytils ... error
Complete output from command /home/ec2-user/test/env/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-8GvFzA/pytils/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('
', '
'), __file__, 'exec'))" install --record /tmp/pip-BCG3Wl-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ec2-user/test/env/include/site/python2.7/pytils --with-nss:
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: option --with-nss not recognized
----------------------------------------
Command "/home/ec2-user/test/env/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-8GvFzA/pytils/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('
', '
'), __file__, 'exec'))"
install --record /tmp/pip-BCG3Wl-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ec2-user/test/env/include/site/python2.7/pytils --with-nss" failed with error code 1 in /tmp/pip-build-8GvF
zA/pytils/
My best guess at the root cause is that the option "--with-nss" is being passed to all libraries that require pycurl, and preventing install. The pytils installation fails even though the pycurl install works fine.
Is there anyway to only pass the install options to the one library?
I'm setting this up on an Amazon Elastic Beanstalk instance, so there is no option to manually run each line of the requirements.txt file - the whole install gets run at start up of the application.
Sources for --global-option and --install-option (which I think shouldn't do this):
How to maintain pip install options in requirements file made by pip freeze?
https://github.com/pypa/pip/blob/develop/docs/reference/pip_install.rst#id28
See Question&Answers more detail:
os