Skip to content

--system-site-packages fails if PIP_REQUIRE_VIRTUALENV=true #557

Closed
@carolyn-idi

Description

@carolyn-idi

Based on some online docs I set up pip so it only runs for an activated virtual environment by setting PIP_REQUIRE_VIRTUALENV to true.

I have some packages installed on the system level that I'd like to install by default for some of my projects. My understanding is that I need to use the --system-site-packages flag to get this to happen.

If PIP_REQUIRE_VIRUTALENV is set to false - everything works ok.
If it's set to true it fails with the following errors:

Running virtualenv with interpreter /usr/local/bin/python2.7
New python executable in .venv/bin/python
Installing setuptools, pip...
  Complete output from command /Users/insomniac/Repo/site/.venv/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip:
  Could not find an activated virtualenv (required).
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py", line 2338, in <module>
    main()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py", line 824, in main
    symlink=options.symlink)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py", line 992, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py", line 960, in install_wheel
    'PIP_NO_INDEX': '1'
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py", line 902, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/insomniac/Repo/site/.venv/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip failed with error code 3
Activating virtualenv "site"...
-bash: .venv/bin/activate: No such file or directory

I'm not sure if this is a bug or if there is another way that this should be done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions