Skip to content

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

Closed

Description

Environment data

Version: 1.49.3
Commit: 2af051012b66169dde0c4dfae3f5ef48f787ff69
Date: 2020-10-02T17:56:11.027Z
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Linux x64 5.4.0-48-generic snap

Steps to reproduce:

python3 -m venv myenv
cd myenv
. bin/activate
code .

Then in vscode I get asked if I would like to install pylint. I click on "yes".

The the error happens (this code was created/executed by vscode):

guettli@yoga15:~/projects/myenv$ source /home/guettli/projects/myenv/bin/activate
(myenv) guettli@yoga15:~/projects/myenv$ /home/guettli/projects/myenv/bin/python /home/guettli/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py pip install -U pylint --user
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

Expected behaviour

Since the interpreter is in a virtualenv, it would make sense to avoid --user.

Activity

  1. added
    triage-needed
    bug
    on Oct 8, 2020
  2. added
    important
    on Oct 12, 2020
  3. ghost removed
    triage-needed
    on Oct 12, 2020
  4. added
    area-environments
    on Oct 12, 2020
  5. karthiknadig commented on Oct 13, 2020

    @karthiknadig
    Member

    I can repro this.

  6. added
    important
    and removed
    important
    on Oct 21, 2020
  7. removed
    important
    on Oct 28, 2020
  8. 8 remaining items

  9. m666m commented on Jul 25, 2021

    @m666m

    same problem in my vscode 1.47.3,pylance。
    use “ pip install xxx ” successed。

    In virtualenv, don't use "pip install xxx --user"

  10. bitsnaps commented on Aug 8, 2021

    @bitsnaps

    #14327
    I was trying to upgrade 'pip' in my virtual environment. I got the same error.

    One quick fix is :

    1. Go to the pyvenv.cfg file in the Virtual environment folder
    2. Set the include-system-site-packages to true and save the change
    3. Reactivate the virtual environment.
      This should work!

    It didn't work for me!
    I was trying to git commit -m "..." using python v3.8.11 and cloud vscode.

  11. PrayogaBoedihartoyo commented on Oct 31, 2021

    @PrayogaBoedihartoyo

    #14327 I was trying to upgrade 'pip' in my virtual environment. I got the same error.

    One quick fix is :

    1. Go to the `pyvenv.cfg` file in the Virtual environment folder
    
    2. Set the `include-system-site-packages` to `true` and save the change
    
    3. Reactivate the virtual environment.
       This should work!
    

    this work for me. .
    thanks

  12. rashidmahmoodsyed commented on Jan 2, 2022

    @rashidmahmoodsyed

    For me, it was the python version issue. I was using using a version not supported by Pycaret yet. I created a clean new virtual env using supported Pycaret and it worked right away

  13. besmaguesmi commented on Jan 31, 2022

    @besmaguesmi

    Just run cmd as administrator

  14. ferneyvanegas commented on Mar 1, 2022

    @ferneyvanegas

    #14327 I was trying to upgrade 'pip' in my virtual environment. I got the same error.

    One quick fix is :

    1. Go to the pyvenv.cfg file in the Virtual environment folder
    2. Set the include-system-site-packages to true and save the change
    3. Reactivate the virtual environment.
      This should work!

    It works perfect for me! Thanks!!

  15. dishang-trilogy commented on Mar 1, 2022

    @dishang-trilogy

    #14327 I was trying to upgrade 'pip' in my virtual environment. I got the same error.

    One quick fix is :

    1. Go to the pyvenv.cfg file in the Virtual environment folder
    2. Set the include-system-site-packages to true and save the change
    3. Reactivate the virtual environment.
      This should work!

    How do you freeze it after the install?

    pip install -r requirements.txt
    pip freeze
    

    The freeze is not picking up the packages from requirements.txt

  16. TahirMurtaza commented on Jun 30, 2022

    @TahirMurtaza

    Thomas Güttler (@guettli) Using sudo before command fixes the issue:
    sudo pip install package-name

  17. guettli commented on Jun 30, 2022

    @guettli
    Author

    Thomas Güttler (@guettli) Using sudo before command fixes the issue: sudo pip install package-name

    thank you for trying to help. In this case I have a conrete goal.

    At the top of this issue:

    python3 -m venv myenv
    cd myenv
    . bin/activate
    code .
    

    I want packages to get installed in my virtualenv, not at root-level via sudo.

  18. locked as resolved and limited conversation to collaborators on Jul 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-environmentsbugverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions