-
-
Notifications
You must be signed in to change notification settings - Fork 614
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
virtualenv issue #285
Comments
I filed a related issue, #288, where it is installing into the global packages directory instead of my virtualenv. My issue only exists with 1.4.1 or newer. If you revert to 1.4.0 or earlier does it resolve your problem? |
Can you double-check if this is not the same issue as this? It seems you're using a global |
Still an issue
|
What's in our
|
(venv)➜ pip which pip
/Users/zackhsi/Desktop/pip/venv/bin/pip
(venv)➜ pip pip --version
pip 7.1.2 from /Users/zackhsi/Desktop/pip/venv/lib/python2.7/site-packages (python 2.7)
(venv)➜ pip pip list
pip (7.1.2)
setuptools (18.2)
wheel (0.24.0)
(venv)➜ pip cat requirements.in
requests
(venv)➜ pip cat requirements.txt
#
# This file is autogenerated by pip-compile
# Make changes in requirements.in, then run this to update:
#
# pip-compile requirements.in
#
requests==2.9.1 |
What's your version of pip-sync?
And, what does this show you?
|
(venv)➜ pip sh -c "$(dirname $(which pip-sync))/pip list | grep pip-tools"
pip-tools (1.4.2)
(venv)➜ pip pip-sync --dry-run
Would uninstall:
configobj
gnureadline
ipython-genutils
boto3
python-dateutil
gevent
prompt-toolkit
jmespath
botocore
speedtest-cli
virtualenv
lxml
pexpect
pep8
tinydb
ptyprocess
path.py
docutils
traitlets
isort
venmo
flake8
appnope
rsa
aws-shell
colorama
httplib2
ipython
pickleshare
decorator
oauth2
pyflakes
simplegeneric
futures
wcwidth
mccabe
pygments
greenlet
pyasn1
awscli |
Do you have any idea what virtualenv those packages are coming from? From your earlier output
It's apparently not that one. |
At least we can conclude that appnope is not a special package, or is causing any issues. It's just that pip-sync ends up with the wrong virtualenv. |
They're globally installed packages |
Is that the same list as
would produce? I.e. that particular env? |
Yes, same (venv)➜ pip sh -c "$(dirname $(which pip-sync))/pip list"
appnope (0.1.0)
aws-shell (0.1.0)
awscli (1.9.15)
boto3 (1.2.3)
botocore (1.3.15)
click (6.2)
colorama (0.3.3)
configobj (5.0.6)
decorator (4.0.6)
docutils (0.12)
first (2.0.1)
flake8 (2.5.1)
futures (3.0.3)
gevent (1.1b5)
gnureadline (6.3.3)
greenlet (0.4.9)
httplib2 (0.9.2)
ipython (4.0.1)
ipython-genutils (0.1.0)
isort (4.2.2)
jmespath (0.9.0)
lxml (3.5.0)
mccabe (0.3.1)
oauth2 (1.9.0.post1)
path.py (8.1.2)
pep8 (1.5.7)
pexpect (4.0.1)
pickleshare (0.5)
pip (7.1.2)
pip-tools (1.4.2)
prompt-toolkit (0.52)
ptyprocess (0.5)
pyasn1 (0.1.9)
pyflakes (1.0.0)
Pygments (2.0.2)
python-dateutil (2.4.2)
requests (2.9.1)
rsa (3.2.3)
setuptools (18.0.1)
simplegeneric (0.8.1)
six (1.10.0)
speedtest-cli (0.3.4)
tinydb (3.1.0)
traitlets (4.0.0)
venmo (0.2.2, /Users/zackhsi/homespace/venmo)
virtualenv (13.1.2)
wcwidth (0.1.5) (venv)➜ pip which pip-sync
/usr/local/bin/pip-sync
(venv)➜ pip which pip-sync
(venv)➜ pip which pip
/Users/zackhsi/Desktop/pip/venv/bin/pip
(venv)➜ pip deactivate
➜ pip which pip
/usr/local/bin/pip |
Could, by any change, your $PATH variable contain a |
What does |
The problem seems to be that Here's what happens:
So either, the PATH is different, or If a Otherwise, you can also try something else: to (also) install |
There are periods, but not sole period... /Users/zackhsi/Desktop/pip/venv/bin:/Users/zackhsi/workspace/devbox/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/vmware/appcatalyst/bin:/Users/zackhsi/workspace/devbox/.bin:/usr/local/sbin:/Users/zackhsi/bin:/Users/zackhsi/.fzf/bin:/Users/zackhsi/bin |
What's
say? |
(venv)➜ pip which -a pip
/Users/zackhsi/Desktop/pip/venv/bin/pip
/usr/local/bin/pip
(venv)➜ pip which -a pip-sync
/usr/local/bin/pip-sync |
What happens when you |
(venv)➜ pip pip list
pip (7.1.2)
setuptools (18.2)
wheel (0.24.0)
(venv)➜ pip which pip-sync
/usr/local/bin/pip-sync
(venv)➜ pip pip install pip-tools
Collecting pip-tools
Using cached pip_tools-1.4.3-py2.py3-none-any.whl
Collecting six (from pip-tools)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting click>=6 (from pip-tools)
Using cached click-6.2-py2.py3-none-any.whl
Collecting first (from pip-tools)
Using cached first-2.0.1-py2.py3-none-any.whl
Installing collected packages: six, click, first, pip-tools
Successfully installed click-6.2 first-2.0.1 pip-tools-1.4.3 six-1.10.0
(venv)➜ pip pip list
click (6.2)
first (2.0.1)
pip (7.1.2)
pip-tools (1.4.3)
setuptools (18.2)
six (1.10.0)
wheel (0.24.0)
(venv)➜ pip which pip-sync
/usr/local/bin/pip-sync
(venv)➜ pip pip-sync
Cannot uninstall requirement appnope, not installed
Traceback (most recent call last):
File "/usr/local/bin/pip-sync", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/piptools/scripts/sync.py", line 68, in cli
pip_flags=pip_flags))
File "/usr/local/lib/python2.7/site-packages/piptools/sync.py", line 137, in sync
check_call(['pip', 'uninstall', '-y'] + pip_flags + sorted(to_uninstall))
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['pip', 'uninstall', '-y', 'appnope', 'aws-shell', 'awscli', 'boto3', 'botocore', 'colorama', 'configobj', 'decorator', 'docutils', 'flake8', 'futures', 'gevent', 'gnureadline', 'greenlet', 'httplib2', 'ipython', 'ipython-genutils', 'isort', 'jmespath', 'lxml', 'mccabe', 'oauth2', 'path.py', 'pep8', 'pexpect', 'pickleshare', 'prompt-toolkit', 'ptyprocess', 'pyasn1', 'pyflakes', 'pygments', 'python-dateutil', 'rsa', 'simplegeneric', 'speedtest-cli', 'tinydb', 'traitlets', 'venmo', 'virtualenv', 'wcwidth']' returned non-zero exit status 1 |
So, this looks like a problem: (venv)➜ pip which -a pip-sync
/Users/zackhsi/Desktop/pip/venv/bin/pip-sync
/usr/local/bin/pip-sync
(venv)➜ pip which pip-sync
/usr/local/bin/pip-sync
(venv)➜ pip echo $PATH
/Users/zackhsi/Desktop/pip/venv/bin:/Users/zackhsi/workspace/devbox/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/vmware/appcatalyst/bin:/Users/zackhsi/workspace/devbox/.bin:/usr/local/sbin:/Users/zackhsi/bin:/Users/zackhsi/.fzf/bin:/Users/zackhsi/bin Why does it not use the local venv? |
Oh wow, I have no idea about this. But this last example pinpoints the problem exactly. Does this only apply to the pip-tools binaries? Or is the behaviour the same for all the other binaries in that venv (if any exist)? Purely looking at the difference between these two |
I'm so confused. It should pick the first occurrence in $PATH, not the last... It works correctly for pip: (venv)➜ pip which pip
/Users/zackhsi/Desktop/pip/venv/bin/pip
(venv)➜ pip which -a pip
/Users/zackhsi/Desktop/pip/venv/bin/pip
/usr/local/bin/pip |
Yes, exactly. I cannot explain this, what shell are you using? |
zsh (sorry for delay) |
@zackhsi: what's the result of On a related note, alex@spicylegato:~$ pip-compile requirements.in
#
# This file is autogenerated by pip-compile
# Make changes in requirements.in, then run this to update:
#
# pip-compile requirements.in
#
requests==2.9.1
alex@spicylegato:~$ mkvirtualenv test
New python executable in /home/alex/.virtualenvs/test/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/alex/.virtualenvs/test/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/alex/.virtualenvs/test/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/alex/.virtualenvs/test/bin/preactivate
virtualenvwrapper.user_scripts creating /home/alex/.virtualenvs/test/bin/postactivate
virtualenvwrapper.user_scripts creating /home/alex/.virtualenvs/test/bin/get_env_details
(test) alex@spicylegato:~$ pip list
pip (8.0.2)
setuptools (20.0)
wheel (0.29.0)
(test) alex@spicylegato:~$ pip-sync -n requirements.txt
Would uninstall:
cryptography
httpie
virtualenvwrapper
pygments
ipython
virtualenv
argparse
pbr
virtualenv-clone
wsgiref
stevedore
pyasn1 Of course, I'm invoking the global (test) alex@spicylegato:~$ pip install pip-tools
Collecting pip-tools
Using cached pip_tools-1.6-py2.py3-none-any.whl
Collecting six (from pip-tools)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting click>=6 (from pip-tools)
Using cached click-6.2-py2.py3-none-any.whl
Collecting first (from pip-tools)
Using cached first-2.0.1-py2.py3-none-any.whl
Installing collected packages: six, click, first, pip-tools
Successfully installed click-6.2 first-2.0.1 pip-tools-1.6 six-1.10.0
(test) alex@spicylegato:~$ type -a pip-sync
pip-sync is /home/alex/.virtualenvs/test/bin/pip-sync
pip-sync is /usr/local/bin/pip-sync
(test) alex@spicylegato:~$ pip-sync -n requirements.txt
Would uninstall:
cryptography
httpie
virtualenvwrapper
pygments
ipython
virtualenv
argparse
pbr
virtualenv-clone
wsgiref
stevedore
pyasn1
(test) alex@spicylegato:~$ hash -r
(test) alex@spicylegato:~$ pip-sync -n requirements.txt
Would install:
requests==2.9.1 As you can see, I had to reload my shell's |
(venv) ➜ Desktop type -a pip
pip is /Users/zackhsi/Desktop/venv/bin/pip
pip is /usr/local/bin/pip
|
And what's the output of |
Yup
|
Weird. In your earlier comment,
Did the virtualenv change? |
Since 1.6.1, you can invoke the pip tools in two ways:
Have you tried doing the above on the latest version (1.6.1)? |
Ah, that makes sense. It took me awhile to realize that a global I was thinking some combination of the following would save other users the confusion:
If you're interested, I was able to get number 3 working. |
It seems the first way of invoking pip-sync described by @nvie does exactly what you describe in your point no 3. |
It would seem so, but I'm not getting that behavior on Ubuntu: alex@spicylegato:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.10
Release: 15.10
Codename: wily
alex@spicylegato:~$ pip-sync --version
pip-sync, version 1.6
alex@spicylegato:~$ pip-compile requirements.in
#
# This file is autogenerated by pip-compile
# Make changes in requirements.in, then run this to update:
#
# pip-compile requirements.in
#
requests==2.9.1
alex@spicylegato:~$ mkvirtualenv test
New python executable in /home/alex/.virtualenvs/test/bin/python
Installing setuptools, pip, wheel...done.
(test) alex@spicylegato:~$ pip list
pip (8.0.2)
setuptools (20.1.1)
wheel (0.29.0)
(test) alex@spicylegato:~$ hash -r
(test) alex@spicylegato:~$ type -a pip-sync
pip-sync is /usr/local/bin/pip-sync
(test) alex@spicylegato:~$ pip-sync -n requirements.txt
Would uninstall:
cryptography
pymysql
virtualenvwrapper
pygments
httpie
virtualenv
argparse
pbr
virtualenv-clone
wsgiref
stevedore
pyasn1 I believe it's because the shebang in the entry point script ( #!/usr/bin/python As opposed to: #!/usr/bin/env python I found a way around this, though. I can make a new issue if this is getting too far off. |
Thanks! Yes, @alexwforsythe please do make a new issue to cleanup the thread a little and have a focused discussion. |
I'm not exactly sure what's going on, but with a barebones requirements.txt file within a virtualenv,
pip-sync
is failing.In my current directory and virtual environment,
pip-sync
is trying to uninstall globally installed packages.Possibly related to #277.
The text was updated successfully, but these errors were encountered: