-
-
Notifications
You must be signed in to change notification settings - Fork 422
Major problems with current version of pyenv-virtualenv #26
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
Comments
From v20140614, the auto-activation feature (#24) has been added in pyenv-virtualenv. If the Unfortunately, this feature requires to not set pyenv's shell version during
I am sorry for this incompatible change, but I believe that the auto-activation feature is valuable despite the incompatibility. |
Hey there Yuu, thanks for your quick reply. I now understand the auto-activation feature and it is indeed great. I suggest you disable the This explains and resolves my second issue, but any ideas about the first one? Every virtualenv I create uses the system Python: e.g. fots@fotsies-ubprecise-02:~$ pyenv versions
* system (set by /home/fots/.pyenv/version)
2.7.7
fots@fotsies-ubprecise-02:~$ pyenv global 2.7.7
fots@fotsies-ubprecise-02:~$ mkdir myproject
fots@fotsies-ubprecise-02:~$ cd myproject/
fots@fotsies-ubprecise-02:~/myproject$ python -V
Python 2.7.7
fots@fotsies-ubprecise-02:~/myproject$ pyenv virtualenv myproject
New python executable in /home/fots/.pyenv/versions/myproject/bin/python
Installing setuptools, pip...done.
fots@fotsies-ubprecise-02:~/myproject$ pyenv local myproject
(myproject)fots@fotsies-ubprecise-02:~/myproject$ python -V
Python 2.7.3
(myproject)fots@fotsies-ubprecise-02:~/myproject$ cd ..
fots@fotsies-ubprecise-02:~$ python -V
Python 2.7.7 I would really appreciate your help with this as I really rely on and love pyenv 😄 Cheers |
I tried same but could not reproduce on my Ubuntu 12.04 :(
|
Actually, And, I have already setup the notice for setup instruction around |
I think I have found the trigger for the problem with Python version when using pyenv-virtualenv. If a virtualenv binary is available in the path before you install pyenv, pyenv seems to use that binary all the time. Here's an exact step by step which I followed to reproduce the problem on a completely fresh install of Ubuntu 12.04: sudo apt-get update
# Install build requirements
sudo apt-get install curl git-core gcc make zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libssl-dev
# Install virtualenv on the system Python
sudo apt-get install python-virtualenv
# Install and activate pyenv
curl -L https://raw.github.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> .profile
echo 'eval "$(pyenv init -)"' >> .profile
echo 'eval "$(pyenv virtualenv-init -)"' >> .profile
source .profile
# Install Python 2.7.7 and create a new virtualenv using it as the Python version
pyenv install 2.7.7
pyenv virtualenv 2.7.7 myvenv
mkdir project
cd project
pyenv local myvenv
# Print the Python version (I see 2.7.3)
python -V From this point, we can clearly see what's going on here now, pyenv seems to be using the system virtualenv binary: fots@fotsies-ubprecise-template:~$ pyenv global 2.7.7
fots@fotsies-ubprecise-template:~$ pyenv version
2.7.7 (set by /home/fots/.pyenv/version)
fots@fotsies-ubprecise-template:~$ pyenv which python
/home/fots/.pyenv/versions/2.7.7/bin/python
fots@fotsies-ubprecise-template:~$ pyenv which virtualenv
/usr/bin/virtualenv
fots@fotsies-ubprecise-template:~$ pyenv which pip
/home/fots/.pyenv/versions/2.7.7/bin/pip
fots@fotsies-ubprecise-template:~$ pyenv which easy_install
/home/fots/.pyenv/versions/2.7.7/bin/easy_install Cheers |
Thanks for the detailed procedure!! The python-virtualenv package might causes a problem if you have installed I'll try to reproduce and fix this. Thanks again. |
Awesome, thank you so much! Can you also re-consider this commit too please 8a83775 This is where the problem with virtualenv deactivation was introduced. It would be ideal if the old behaviour of pyenv-virtualenv could be maintained for those who do not wish to add Thanks again for all your help and keep up the great work!! 😄 Cheers |
Thank you so much. I've just tested out the newest version but it still seems to leave PYENV_VERSION set after deactivating a virtualenv. Any ideas? To clarify, I've only added the following to my .profile: export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)" The prompt does change when I de-activate the virtualenv but the environment variable stays set. This causes a number of issues later on and I'm forced to unset it manually. The line which was needed to have this work was removed in the commit I linked above. The line I'm referring to is: echo "pyenv shell --unset" From the bin/pyenv-sh-deactivate file. Sorry for all the trouble 😄 |
It sounds strange... In d9e3adc, |
Thanks again for your help, this is rather strange as I don't have PYENV_VIRTUALENV_INIT set. Please see the output below: fots@fotsies-ubprecise-01:~$ env | egrep PYENV
PYENV_SHELL=bash
fots@fotsies-ubprecise-01:~$ tail -5 ~/.profile
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
# eval "$(pyenv virtualenv-init -)"
fots@fotsies-ubprecise-01:~$ pyenv virtualenv test
New python executable in /home/fots/.pyenv/versions/test/bin/python
Installing setuptools, pip...done.
fots@fotsies-ubprecise-01:~$ pyenv activate test
(test)fots@fotsies-ubprecise-01:~$ env | egrep PYENV
PYENV_VERSION=test
PYENV_SHELL=bash
(test)fots@fotsies-ubprecise-01:~$ pyenv deactivate
fots@fotsies-ubprecise-01:~$ env | egrep PYENV
PYENV_VERSION=test
PYENV_SHELL=bash Notice that PYENV_VERSION is not unset when I deactivate the virtualenv? Cheers |
Thanks for your help too. Please let me know the output from 'env |
My pleasure, here's the gist for you https://gist.github.com/fgimian/d121383b038d74c97859 Hope this helps and so sorry for the trouble |
Thanks! I looked the gist, and I found a line https://gist.github.com/fgimian/d121383b038d74c97859#file-gistfile1-txt-L1164 In d9e3adc, the line should be I think you are working with wrong revision. Please try again with updating pyenv-virtualenv at d9e3adc.
|
Aah that works perfectly. My apologies, I thought the fix was in master 😄 Thanks so much! Would you consider merging this fix on the next release? Cheers |
Yep, I'll merge and release it soon. |
Awesome, thanks for everything and keep up the great work!! 😄 |
Hey there Yuu, hope you're well 😄
Since some of the latest commits, I've been having quite a few major problems with this extension I'm afraid.
My test system is a fresh install of Ubuntu Server 12.04 with the regular bash shell.
This output should explain the problems 😄
So in summary:
Your help would be greatly appreciated
Fotis
The text was updated successfully, but these errors were encountered: