-
-
Notifications
You must be signed in to change notification settings - Fork 619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip-sync using global pip inside virtualenvs on Ubuntu #328
Comments
I'm seeing the same behaviour on Fedora 23: $ python --version
Python 2.7.11
$ pip --version
pip 8.1.1 from /home/foo/.virtualenvs/bar/lib/python2.7/site-packages (python 2.7)
$ pip-sync --version
pip-sync, version 1.6.4
$ which pip-sync
~/.virtualenvs/bar/bin/pip-sync
$ pip-sync -n requirements/*.txt
Would uninstall:
<list of everything in my global site>
Would install:
<list of entries in 'requirements/*.txt'> That's in a new virtualenv created using |
I can confirm this issue, too. |
Just for information: the issue persists on Mac OS X in 1.7.0. |
fwiw this is true for every python binary. e.g. having fabric installed globally means you may run fabfile.py files against the global environment instead of whatever virtualenv you're in. It might still make sense to detect a virtualenv and do something smarter! I'm just not aware of any that do so. |
I am also experiencing this issue on Windows 10 with Python 3.6 in a (python -m venv) virtualenv. pip-compile seems to work fine, but pip-sync wants to uninstall all my global site-packages. |
Im having the same problem on ubuntu 16.04 ...
|
(Catching up on stuff) If so, that's a recipe for disaster. There's a PR coming in to update the doc and state that (better late than never...), but you should install and run I hope that clarifies and helps! |
pip-sync
seems to use the user-installedpip
to detect installed distributions when invoked inside a virtualenv on Ubuntu (sorry in advance for the wall of text):This might not be the case for other environments, but the first line of my
pip-sync
entry point script (/usr/local/bin/pip-sync
) is:#!/usr/bin/python
This forces
sync.py
to import the user-installed pip, causing it to only recognize user-installed distributions.I see 2 solutions here:
Use
env
in the shebang of the entry point script, forcing it to locate the currently activepython
executable:#!/usr/bin/env python
This seems like the cleanest solution to me. I have no idea how to do this, though, since the script is auto-generated.
If we can determine that a virtualenv is active, update the system path to include local site packages before importing
pip
insync.py
. I wrote some code that does this for me, but I'm not sure if it would work for everyone.The text was updated successfully, but these errors were encountered: