Skip to content
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

pip error in virtualenv with python 3.9 and base python 3.10 #2560

Closed
szleb opened this issue Apr 27, 2023 · 4 comments
Closed

pip error in virtualenv with python 3.9 and base python 3.10 #2560

szleb opened this issue Apr 27, 2023 · 4 comments
Labels

Comments

@szleb
Copy link
Contributor

szleb commented Apr 27, 2023

Issue

When creating a virtualenv with version 20.21.1 or higher with python 3.9, calling pip in the virtualenv raises the following error:

ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

The error does not appear when using python 3.10 in the virtualenv, i.e. when removing the -p py39 in the example below.

Example

>python -m virtualenv -p py39 test
created virtual environment CPython3.9.13.final.0-64 in 2877ms
  creator Venv(dest=C:\DEV\test, clear=False, no_vcs_ignore=False, global=False, describe=CPython3Windows)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\BEL14466\AppData\Local\pypa\virtualenv)
    added seed packages: pip==23.1, setuptools==67.6.1, wheel==0.40.0
  activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

>test\Scripts\activate

(test)>pip install numpy
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

[notice] A new release of pip is available: 23.1 -> 23.1.2
[notice] To update, run: python.exe -m pip install --upgrade pip

Environment

  • OS: Windows 10
  • base python 3.10.6
  • venv python 3.9.13
  • virtuelnv >= 20.21.1

system environment

>>> pip list
Package      Version
------------ -------
build        0.9.0
click        8.1.3
colorama     0.4.6
distlib      0.3.6
filelock     3.12.0
packaging    23.1
pep517       0.13.0
pip          23.1.2
pip-tools    6.13.0
platformdirs 3.4.0
setuptools   67.7.2
tomli        2.0.1
virtualenv   20.22.0
wheel        0.40.0 
 
@szleb szleb added the bug label Apr 27, 2023
@pfmoore
Copy link
Member

pfmoore commented Apr 27, 2023

This was an issue with pip 23.1. If you upgrade to pip 23.1.2 as the message suggests, the error will be fixed. (You may need to recreate the environment as the bug means that upgrading probably won't work 🙁)

@szleb
Copy link
Contributor Author

szleb commented Apr 27, 2023

Thanks for the answer @pfmoore

Indeed, if I create the environment with the following command it works.

>python -m virtualenv -p py39 --pip 23.1.2 test 

However, in real life, I actually use tox, and I do not know how I can force tox to create virtualenvs with the --pip flag.
At the moment I just set the requirement in the tox.ini to virtualenv<=20.21.0 which uses pip 23.0.1.

So at the end it is probably just a matter of time, until a new version of virtualenv uses pip 23.1.2 or higher by default.

@jugmac00
Copy link
Contributor

@szleb you should be able to set the required packages and versions via https://tox.wiki/en/latest/config.html#requires

@szleb
Copy link
Contributor Author

szleb commented Apr 27, 2023

@jugmac00 that does not change the version wihin the testenvironments only in environment creating the virtualenvs, and changing the deps of the testinvornments requires a working pip version....

szleb added a commit to szleb/virtualenv that referenced this issue Apr 27, 2023
@szleb szleb closed this as completed Apr 27, 2023
szleb added a commit to szleb/virtualenv that referenced this issue Apr 27, 2023
gaborbernat pushed a commit to gaborbernat/virtualenv that referenced this issue Apr 27, 2023
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
gaborbernat added a commit that referenced this issue Apr 27, 2023
Co-authored-by: Belz Sandro <Sandro.Belz@msg-life.com>
tarpas pushed a commit to tarpas/virtualenv that referenced this issue Jun 8, 2023
Co-authored-by: Belz Sandro <Sandro.Belz@msg-life.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants