pyenv-virtualenv icon indicating copy to clipboard operation
pyenv-virtualenv copied to clipboard

pyenv-virtualenv not installing packages into venvs

Open jottr opened this issue 6 years ago • 7 comments

Completely nuked ~/.pyenv and then reinstalled pyenv and pyenv-virtualenv via pyenv-installer.

$ echo $PYENV_ROOT $PYENV_SHELL $PYENV_VIRTUALENV_INIT
/Users/jottr/.pyenv zsh 1

# Creating a new venv
$ pyenv virtualenv 2.7.14 neovim2
New python executable in /Users/jottr/.pyenv/versions/2.7.14/envs/neovim2/bin/python2.7
Also creating executable in /Users/jottr/.pyenv/versions/2.7.14/envs/neovim2/bin/python
Installing setuptools, pip, wheel...done.
Requirement already satisfied: setuptools in /Users/jottr/.pyenv/versions/2.7.14/envs/neovim2/lib/python2.7/site-packages
Requirement already satisfied: pip in /Users/jottr/.pyenv/versions/2.7.14/envs/neovim2/lib/python2.7/site-packages

# activate the venv
$ pyenv activate neovim2

$ python --version 
Python 2.7.14

# Try to install `neovim` into venv. Note the strange `python3.6`-path:

$ pip install neovim
Collecting neovim
Requirement already satisfied: greenlet in /usr/local/lib/python3.6/site-packages (from neovim)
Requirement already satisfied: msgpack>=0.5.0 in /usr/local/lib/python3.6/site-packages (from neovim)
Installing collected packages: neovim
Successfully installed neovim-0.2.4

$ pyenv whence neovim
...nothing...

$ ls ~/.pyenv/versions/neovim2/lib/python2.7/site-packages/neovim
ls: cannot access 'neovim': No such file or directory

pip claims it installed neovim, but obviously not where it belongs. It seems that it tries to install to python3.6 environment, although I specified 2.7.14 upon venv creation (see above).

Could my $PATH be the culprit?

$ echo $PATH

/Users/jottr/.nvm/versions/node/v9.9.0/bin:/Users/jottr/.local/bin:/Users/jottr/.bin:/opt/perl5/bin:/opt/perl5/perls/perl-5.23.7/bin:/Users/jottr/.zplug/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Users/jottr/.rbenv/shims:/Users/jottr/.pyenv/plugins/pyenv-virtualenv/shims:/Users/jottr/.pyenv/shims:/Users/jottr/.pyenv/bin:/usr/local/sbin:/Users/jottr/.go/bin:/usr/local/opt/fzf/bin

This is what I have in my ~/.zshenv:

# pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

jottr avatar Apr 10 '18 21:04 jottr

@yyuu would you able to help?

jottr avatar Apr 23 '18 18:04 jottr

I think I'm encountering something similar to this, but by trying to pip install from a requirements.txt. The install seemingly goes fine, but the packages are nowhere to be found.

thecristen avatar May 25 '18 19:05 thecristen

+1

a-sneha-a avatar Jun 21 '18 22:06 a-sneha-a

Same here...

Platform: Darwin xxx 17.7.0 Darwin Kernel Version 17.7.0: Fri Jul 6 19:54:51 PDT 2018; root:xnu-4570.71.3~2/RELEASE_X86_64 x86_64

Partyschaum avatar Sep 27 '18 13:09 Partyschaum

I ran into this issue as well. Before I started using pyenv I had installed pip like so:

sudo easy_install3 pip

which resulted in a copy of pip at: /usr/local/lib/python3.5/dist-packages/pip which was linked to /usr/local/bin/pip, which had priority in my PATH variable. I removed that version of pip:

sudo rm -rf /usr/local/lib/python3.5/dist-packages/pip*
sudo rm /usr/local/bin/pip

and it seems to be working properly now.

frnsys avatar Oct 01 '18 03:10 frnsys

I'm having the same problem, even though

(django3.6) [jakub@incanus-notebook datastore-kredit]$ which pip
/home/jakub/.pyenv/shims/pip
(django3.6) [jakub@incanus-notebook datastore-kredit]$ pyenv which pip
/home/jakub/.pyenv/versions/django3.6/bin/pip
(django3.6) [jakub@incanus-notebook datastore-kredit]$ pip -V
pip 18.1 from /home/jakub/.pyenv/versions/3.6.9/envs/django3.6/lib/python3.6/site-packages/pip (python 3.6)

when I do a pip install, the packages always end up in ~/.local/lib/python3.6/site-packages/.

Incanus3 avatar Sep 25 '19 08:09 Incanus3

Removing alias pip=/usr/bin/pip3 from the .zshrc file in my mac solved the issue for me

valeria-io avatar Jun 17 '20 15:06 valeria-io