Virtualenv versus setup.py install --user

I am using setuptools and I am running virtualenv. When I try to install --user I have problems:

  • complaint that .pth files are not supported
  • it seems to install outside of virtualenv

Should I just clean up using -user since I'm in virtual space?

exec ../virtualenv/target/vroot/bin/python setup.py install --user
running install
Checking .pth file support in /Users/benson/.local/lib/python2.7/site-packages/
/Users/benson/x/ws-client-bindings/python/setup/../virtualenv/target/vroot/bin/python -E -c pass
TEST FAILED: /Users/benson/.local/lib/python2.7/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH

      

+3


source to share


2 answers


the user directory is part of Python, not virtualenv. The packages installed to the user will look like system packages (they will be available outside of virtualenv). Thus, it is not a solution to isolate package and version requirements for a particular application.



The standard procedure is to activate virtualenv and use the installation without the --user option.

+4


source


Yes, I would recommend dropping this usage pattern and installing everything using pip, called directly from bin

your virtual user directory . I find absolute paths when installing / running from a virtualenv is better, as in this case it never comes up with the question of which one it uses.



You can then track (say in source management) the requirements files for each of your virtual users (through pip freeze > requirements

) so that they can be quickly created elsewhere.

+2


source







All Articles