'pipenv install <package>' fails on fresh python3.10 installation

Viewed 2000

Just installed a fresh copy of Python3.10 via Pop OS, followed by pip and the python Pipenv package. Installing pip packages works fine globally, but if I try to use pip inside a virtual environment on its own (for any package, Numpy to name one) I get:

From running pipenv install <package> from outside my venv in the project folder,

Installing numpy...
Error:  An error occurred while installing numpy!
Error text: 
/home/xxxxx/.local/share/virtualenvs/xx-xxxxx-Kg4m1CDN/bin/python: No module named pip

✘ Installation Failed

and from pip install <package> from inside the venv,

Traceback (most recent call last):
  File "/home/xxxxx/.local/share/virtualenvs/xx-xxxxx-Kg4m1CDN/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'

version details:

python3.10 --version: Python 3.10.0b1

python3.10 -m pip -V: pip 21.3.1 from /home/xxxxx/.local/lib/python3.10/site-packages/pip (python 3.10)

(specific names x-ed out for privacy)

I've already googled around and checked the Pipenv GitHub so I'm stumped. Hopefully this is something simple that I've so far managed to avoid but I have no idea where to go from here - any help would be appreciated!

If there are any other logs or any info needed just let me know.

3 Answers

I've come up with the same issue also. And the only solution for me is to install Python 3.9 in addition.

You can download from here: https://www.python.org/downloads/release/python-3912/

After installing the Python 3.9.12 (don't forget to tick the "Add Python to PATH" checkbox), the problem will be resolved.

If you are able to get your python3.10, pip3 with python version 3.10 and virtualenv installed, And you try to create the environment, but you get issues with pip packages, I found that after updating the python and pip, I still had old pip installations, so I updated all the existing older version pip packages using,

pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U

And thus I was able to create a virtual environment.

You need to install pip again in the env. Refer to the links below:-

[a link] <https://www.geeksforgeeks.org/how-to-install-pip-on-windows/>
[a link] <https://www.geeksforgeeks.org/how-to-install-pip-in-linux/>
[a link] <https://www.geeksforgeeks.org/how-to-install-pip-in-macos/>
Related