pip does not answer when used within pyenv

Viewed 1624

I have installed pyenv and pyenv-virtualenv using Homebrew (I am working on macOS Catalina 10.15.6).

I am running a pyenv environment with python version 3.7.8.
If I activate my pyenv-virtualenv, and then try to run some pip commands, the commands do not return anything. I just see the blinking cursor on the next line. For example:

$ pip install -r requirements

or

$ pip list

Though, when calling just pip, I have the help menu.

The configuration seems ok:

$ which pip

returns

Users/marie/.pyenv/shims/pip

Outside the pyenv, pip works normally.

The problem seems to come from specific versions of Python and pip. Indeed, moving to an older version of Python (Python 3.7.1) and pip (10.0.1) makes pip work fine.
But: Python 3.7.8 + pip 20 does not.

Any idea why this happens?

2 Answers

Try installing pip from scratch (from https://github.com/pypa/pip/issues/7620#issuecomment-576653578).

curl -fL https://bootstrap.pypa.io/get-pip.py | /Users/marie/.pyenv/shims/python -

If curl is not found, you can try with wget:

wget -O- https://bootstrap.pypa.io/get-pip.py | /Users/marie/.pyenv/shims/python -

I don't know why this would be happening with virtualenv. I guess there could be some problem with the package on homebrew. You can pip install virtualenv.

Related