Search code examples
bashpipvirtualenvubuntu-16.04pyenv

PIP is linked only to system environment


I'm using pyenv-virtualenv on Ubuntu 16.04 LTS.

While I was installing imblearn package for my virtualenv using Python 3.5, I realized it was being installed on system environment which uses Python 2.7. I checked with pyenv version but it clearly returned that I was on my virtualenv.

I opened a Python shell and tried to import imblearn and got ImportError: No module named 'imblearn'.

When I checked with pip list, it clearly stated that imblearn was installed. But every other packages that have been installed were missing, hence telling that the list was of system environment.

I've tried making a new environment and checked but the list is still of system and installation goes to system as well.

My pip is stuck with system.

I have never experienced this before and have no idea how to fix this.

Below is my .bashrc setting:

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

Just the way it tells me to set.

I've been using it fine until yesterday which I found out this was happening.

I suspect it has something to do with pyenv global command which I used while I was telling my partner how to use pyenv-virtualenv yesterday.

Still, I have never had a problem with that command before.

Please help.


Update

For some reason, source ~/.bashrc put everything back to normal. (I don't know why I typed this command. I just did it.)
But I'd still like to know how this happened and why it is fixed when I changed nothing in my .bashrc file and when even re-opening terminal or rebooting didn't fix things.


Solution

  • I still don't know how this was solved, and assume that this won't happen in later version pyenv-virtualenv.

    It's a year old post, but I guess I could post what helped me back then so that others won't try to solve my long ago problem for me.

    Thanks for letting me know.

    source ~/.bashrc