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

Duplicated virtualenvs #120

Closed
DanyC97 opened this Issue Nov 22, 2015 · 12 comments

Comments

Projects
None yet
4 participants
@DanyC97

DanyC97 commented Nov 22, 2015

@yyuu what does this show? Is it duplicated virtualenvs ?

[dani@localhost in ~]# pyenv virtualenvs
  heat_test (created from /usr/local/opt/pyenv/versions/2.7.9)
  test_blessing_module (created from /usr/local/opt/pyenv/versions/3.4.2)
[dani@localhost in ~]# pyenv virtualenv 2.7.9 awstools
New python executable in /usr/local/opt/pyenv/versions/2.7.9/envs/awstools/bin/python2.7
Also creating executable in /usr/local/opt/pyenv/versions/2.7.9/envs/awstools/bin/python
Installing setuptools, pip...done.
Ignoring indexes: https://pypi.python.org/simple/
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/var/lib/pyenv/versions/2.7.9/envs/awstools/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): pip in /usr/local/var/lib/pyenv/versions/2.7.9/envs/awstools/lib/python2.7/site-packages
Cleaning up...
[dani@localhost in ~]# pyenv virtualenvs
  2.7.9/envs/awstools (created from /usr/local/opt/pyenv/versions/2.7.9)
  awstools (created from /usr/local/opt/pyenv/versions/2.7.9)
  heat_test (created from /usr/local/opt/pyenv/versions/2.7.9)
  test_blessing_module (created from /usr/local/opt/pyenv/versions/3.4.2)
[dani@localhost in ~]#

My expectation was to now show 2.7.9/envs/awstools , what am i missing?

@DanyC97

This comment has been minimized.

Show comment
Hide comment
@DanyC97

DanyC97 Nov 22, 2015

What is interesting is that for heat_test env (which was created with an old version of pyenv-virtualenv) i don't have a sym link

[dani@localhost in /usr/local/opt/pyenv/versions:master]# ll
drwxr-xr-x  7 dcomnea  admin   238B 25 May 09:33 heat_test/
drwxr-xr-x  6 dcomnea  admin   204B 20 Nov 15:33 test_blessing_module/
drwxr-xr-x  7 dcomnea  admin   238B 22 Nov 16:56 2.7.9/
lrwxr-xr-x  1 dcomnea  admin    49B 22 Nov 16:59 awstools -> /usr/local/opt/pyenv/versions/2.7.9/envs/awstools
[dani@localhost in /usr/local/opt/pyenv/versions:master]# pyenv uninstall awstools
pyenv-virtualenv: remove /usr/local/opt/pyenv/versions/2.7.9/envs/awstools? y
[dani@localhost in /usr/local/opt/pyenv/versions:master]# pyenv virtualenvs
  heat_test (created from /usr/local/opt/pyenv/versions/2.7.9)
  interm_python_class (created from /usr/local/opt/pyenv/versions/2.7.9)
  python-tutorial-jfine (created from /usr/local/opt/pyenv/versions/3.4.2)
  test_blessing_module (created from /usr/local/opt/pyenv/versions/3.4.2)
[dani@localhost in /usr/local/opt/pyenv/versions/2.7.9:master]#

very confused

DanyC97 commented Nov 22, 2015

What is interesting is that for heat_test env (which was created with an old version of pyenv-virtualenv) i don't have a sym link

[dani@localhost in /usr/local/opt/pyenv/versions:master]# ll
drwxr-xr-x  7 dcomnea  admin   238B 25 May 09:33 heat_test/
drwxr-xr-x  6 dcomnea  admin   204B 20 Nov 15:33 test_blessing_module/
drwxr-xr-x  7 dcomnea  admin   238B 22 Nov 16:56 2.7.9/
lrwxr-xr-x  1 dcomnea  admin    49B 22 Nov 16:59 awstools -> /usr/local/opt/pyenv/versions/2.7.9/envs/awstools
[dani@localhost in /usr/local/opt/pyenv/versions:master]# pyenv uninstall awstools
pyenv-virtualenv: remove /usr/local/opt/pyenv/versions/2.7.9/envs/awstools? y
[dani@localhost in /usr/local/opt/pyenv/versions:master]# pyenv virtualenvs
  heat_test (created from /usr/local/opt/pyenv/versions/2.7.9)
  interm_python_class (created from /usr/local/opt/pyenv/versions/2.7.9)
  python-tutorial-jfine (created from /usr/local/opt/pyenv/versions/3.4.2)
  test_blessing_module (created from /usr/local/opt/pyenv/versions/3.4.2)
[dani@localhost in /usr/local/opt/pyenv/versions/2.7.9:master]#

very confused

@yyuu yyuu closed this in f92a3a2 Nov 23, 2015

@DanyC97

This comment has been minimized.

Show comment
Hide comment
@DanyC97

DanyC97 Nov 23, 2015

@yyuu thanks for the change.

I run a quick test and i think we need to trim the first part in line 122

+ [pyenv-virtualenvs:113] '[' -L /usr/local/var/lib/pyenv/versions/2.7.9 ']'
++ [pyenv-virtualenvs:117] pyenv-virtualenv-prefix 2.7.9
++ [pyenv-virtualenvs:117] true
+ [pyenv-virtualenvs:117] virtualenv_prefix=
+ [pyenv-virtualenvs:118] '[' -d '' ']'
+ [pyenv-virtualenvs:121] for venv_path in '"${path}/envs/"*'
+ [pyenv-virtualenvs:122] venv=2.7.9/envs/aws-tools
++ [pyenv-virtualenvs:123] pyenv-virtualenv-prefix 2.7.9/envs/aws-tools
+ [pyenv-virtualenvs:123] virtualenv_prefix=/usr/local/opt/pyenv/versions/2.7.9
+ [pyenv-virtualenvs:124] '[' -d /usr/local/opt/pyenv/versions/2.7.9 ']'
+ [pyenv-virtualenvs:125] print_version 2.7.9/envs/aws-tools ' (created from /usr/local/opt/pyenv/versions/2.7.9)'

My first reaction will be to use basename venv

DanyC97 commented Nov 23, 2015

@yyuu thanks for the change.

I run a quick test and i think we need to trim the first part in line 122

+ [pyenv-virtualenvs:113] '[' -L /usr/local/var/lib/pyenv/versions/2.7.9 ']'
++ [pyenv-virtualenvs:117] pyenv-virtualenv-prefix 2.7.9
++ [pyenv-virtualenvs:117] true
+ [pyenv-virtualenvs:117] virtualenv_prefix=
+ [pyenv-virtualenvs:118] '[' -d '' ']'
+ [pyenv-virtualenvs:121] for venv_path in '"${path}/envs/"*'
+ [pyenv-virtualenvs:122] venv=2.7.9/envs/aws-tools
++ [pyenv-virtualenvs:123] pyenv-virtualenv-prefix 2.7.9/envs/aws-tools
+ [pyenv-virtualenvs:123] virtualenv_prefix=/usr/local/opt/pyenv/versions/2.7.9
+ [pyenv-virtualenvs:124] '[' -d /usr/local/opt/pyenv/versions/2.7.9 ']'
+ [pyenv-virtualenvs:125] print_version 2.7.9/envs/aws-tools ' (created from /usr/local/opt/pyenv/versions/2.7.9)'

My first reaction will be to use basename venv

@DanyC97

This comment has been minimized.

Show comment
Hide comment
@DanyC97

DanyC97 Nov 23, 2015

Or even better do

venv="${venv_path##*/}"

at

f92a3a2#diff-c40aa46245e0e45e0612e6630fb56045R122

which will work - i've tested it (but not sure if it breaks anything else)

DanyC97 commented Nov 23, 2015

Or even better do

venv="${venv_path##*/}"

at

f92a3a2#diff-c40aa46245e0e45e0612e6630fb56045R122

which will work - i've tested it (but not sure if it breaks anything else)

@yyuu

This comment has been minimized.

Show comment
Hide comment
@yyuu

yyuu Nov 23, 2015

Collaborator

What is the benefit to show every virtualenv in its short name? I think it'd be better to display with long name if it is actually created at the path.

Collaborator

yyuu commented Nov 23, 2015

What is the benefit to show every virtualenv in its short name? I think it'd be better to display with long name if it is actually created at the path.

@DanyC97

This comment has been minimized.

Show comment
Hide comment
@DanyC97

DanyC97 Nov 24, 2015

well in previous releases the virtualenv was always created with short names. In current version it seems the implicit/ the only way is to have long names.

although i don't know the reason of moving to long names, i prefer the short ones (i already have the path showing me based on which python version was created, don't need the whole virtualenv path - no benefit)

I only need a short name which is nicely shown in my prompt once is activated

DanyC97 commented Nov 24, 2015

well in previous releases the virtualenv was always created with short names. In current version it seems the implicit/ the only way is to have long names.

although i don't know the reason of moving to long names, i prefer the short ones (i already have the path showing me based on which python version was created, don't need the whole virtualenv path - no benefit)

I only need a short name which is nicely shown in my prompt once is activated

@blueyed

This comment has been minimized.

Show comment
Hide comment
@blueyed

blueyed Nov 24, 2015

Collaborator

I only need a short name which is nicely shown in my prompt once is activated

What about ${VIRTUAL_ENV##*/}?

Collaborator

blueyed commented Nov 24, 2015

I only need a short name which is nicely shown in my prompt once is activated

What about ${VIRTUAL_ENV##*/}?

@yyuu

This comment has been minimized.

Show comment
Hide comment
@yyuu

yyuu Nov 25, 2015

Collaborator

The long name is to improve the support for Anaconda/Miniconda. Though there is a symlink of short name. I believe it would be sufficient to use virtualenv as same as before.

I don't think just showing short name because it can be conflicted. Wouldn't be sufficient just ignoring long name from pyenv virtualenvs in this case?

Collaborator

yyuu commented Nov 25, 2015

The long name is to improve the support for Anaconda/Miniconda. Though there is a symlink of short name. I believe it would be sufficient to use virtualenv as same as before.

I don't think just showing short name because it can be conflicted. Wouldn't be sufficient just ignoring long name from pyenv virtualenvs in this case?

@DanyC97

This comment has been minimized.

Show comment
Hide comment
@DanyC97

DanyC97 Nov 25, 2015

@yyuu and how you want to ignore it? by providing a way to filter? if not then i could argue on why i should give up the way things worked in the past in favor of Anaconda?

DanyC97 commented Nov 25, 2015

@yyuu and how you want to ignore it? by providing a way to filter? if not then i could argue on why i should give up the way things worked in the past in favor of Anaconda?

@jimmywan

This comment has been minimized.

Show comment
Hide comment
@jimmywan

jimmywan Nov 25, 2015

@DanyC97 , would it be preferable to do one of the following:
show short names if there are no conflicts?
only show long names if there is a conflict?

FWIW, some of us do make use of miniconda/anaconda, and the previous state of things was basically unusable.

jimmywan commented Nov 25, 2015

@DanyC97 , would it be preferable to do one of the following:
show short names if there are no conflicts?
only show long names if there is a conflict?

FWIW, some of us do make use of miniconda/anaconda, and the previous state of things was basically unusable.

@DanyC97

This comment has been minimized.

Show comment
Hide comment
@DanyC97

DanyC97 Nov 27, 2015

@jimmywan it could work.

I get what you saying but then i'll flip the coin and ask: how does virtualenv deal with this use case?

DanyC97 commented Nov 27, 2015

@jimmywan it could work.

I get what you saying but then i'll flip the coin and ask: how does virtualenv deal with this use case?

@blueyed

This comment has been minimized.

Show comment
Hide comment
@blueyed

blueyed Nov 28, 2015

Collaborator

What is the benefit to show every virtualenv in its short name? I think it'd be better to display with long name if it is actually created at the path.

I agree. And I would think that --skip-aliases should be the default with pyenv virtualenvs even.

@DanyC97
I have never used this command (pyenv virtualenvs) before, but just pyenv versions, which is also significantly faster: 10.20s user 3.26s system 64% cpu 20.744 total vs 0.25s user 0.12s system 42% cpu 0.878 total (for 20 runs)!

And then when you use it sometimes, it's useful to see them more explicitly (long name).

Collaborator

blueyed commented Nov 28, 2015

What is the benefit to show every virtualenv in its short name? I think it'd be better to display with long name if it is actually created at the path.

I agree. And I would think that --skip-aliases should be the default with pyenv virtualenvs even.

@DanyC97
I have never used this command (pyenv virtualenvs) before, but just pyenv versions, which is also significantly faster: 10.20s user 3.26s system 64% cpu 20.744 total vs 0.25s user 0.12s system 42% cpu 0.878 total (for 20 runs)!

And then when you use it sometimes, it's useful to see them more explicitly (long name).

@DanyC97

This comment has been minimized.

Show comment
Hide comment
@DanyC97

DanyC97 Nov 28, 2015

@blueyed i agree on having --skip-aliases default
I will also try to use pyenv versions, i got used with the other one due to manually activate/ deactivate

DanyC97 commented Nov 28, 2015

@blueyed i agree on having --skip-aliases default
I will also try to use pyenv versions, i got used with the other one due to manually activate/ deactivate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment