Skip to content

venv does not activate on my manjaro system for zsh #22899

Closed as not planned
Closed as not planned

Description

@karrtikr
          I just tested it again on my manjaro system and can confirm that the venv is not activated in zsh:
Systeminfo
Version: 1.86.1
Commit: 31c37ee8f63491495ac49e43b8544550fbae4533
Date: 2024-02-07T09:07:19.849Z
Electron: 27.2.3
ElectronBuildId: 26495564
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Linux x64 6.6.10-1-MANJARO

In my last #22881 (comment), I've tested it successfully on windows+wsl with zsh.

Her are the logs of my manjaro system with the last fix from #22881 (comment):
Python.log

Originally posted by Matthias Mairleitner (@matt-hires) in #22881 (comment)

Activity

  1. karrtikr commented on Feb 12, 2024

    @karrtikr
    Author

    Matthias Mairleitner (@matt-hires) Based on your last comment #22881 (comment), do you mean to say that venv activation works for WSL + windows but not for your current system? If so, can you please provide screenshots on how you're determining whether the environment has activated?

  2. matt-hires commented on Feb 12, 2024

    @matt-hires

    That's correct. It's working on my Windows machine with wsl, but not on my manjaro linux system.

    I checked if the venv was sourced with:

    which pip

    Which should show me the path to the pip in the venv directory, right?

  3. karrtikr commented on Feb 12, 2024

    @karrtikr
    Author

    Actually that's not always true. Try using which python.

  4. matt-hires commented on Feb 12, 2024

    @matt-hires

    here is a gif how i checked it:

    vscode

  5. karrtikr commented on Feb 13, 2024

    @karrtikr
    Author

    Thanks, can you also provide the following #22900 (comment)? And lastly, the debug logs again please, make sure to use latest pre-release, thank you.

  6. matt-hires commented on Feb 13, 2024

    @matt-hires

    ✅ Run 'Python: Clear cache and reload window' command

    A screenshot when you hover over zsh:
    image

    Whether shell integration is actually working:
    image

    And lastly, the debug logs again please:
    Python.log

  7. karrtikr commented on Feb 13, 2024

    @karrtikr
    Author

    Thanks a lot for this, at this point we need some help from VS Code to reliably predict whether shell integration is working or not: microsoft/vscode#205058. It seems that even though the environment is set for your case:

    2024-02-13 06:09:04.848 [debug] Prepending environment variable PATH in collection with /home/matthias/.vscode/extensions/ms-python.python-2024.1.10431006/pythonFiles/deactivate/zsh:/home/matthias/Development/src/cliargsparser/venv/bin:
    2024-02-13 06:09:04.848 [debug] Setting environment variable VIRTUAL_ENV in collection to /home/matthias/Development/src/cliargsparser/venv
    2024-02-13 06:09:04.849 [debug] Prepending environment variable PS1 in collection with (venv) 
    2024-02-13 06:09:04.849 [debug] Setting environment variable VIRTUAL_ENV_PROMPT in collection to (venv) 
    

    It's not reflected in the terminal. If you click "Show environment contributions" in the previous screenshot, it seems like the PATH variable there isn't being set correctly.

  8. karrtikr commented on Feb 13, 2024

    @karrtikr
    Author

    I'm working on a temporary fix to remedy this: #22905, but it seems a long term solution has to come from VS Code at this point .

  9. matt-hires commented on Feb 13, 2024

    @matt-hires

    I guessed it might be something like this, due to the fact that the shell prompt correctly shows the venv python version.

    And also thank you for your investigation into this.

  10. karrtikr commented on Feb 13, 2024

    @karrtikr
    Author

    Of course. If you don't mind could you test out https://github.com/microsoft/vscode-python/actions/runs/7882029722/artifacts/1240529254 and see if it helps? You can use Extension: Install from VSIX to install the extension.

  11. karrtikr commented on Feb 13, 2024

    @karrtikr
    Author

    Actually, that wouldn't help in your case. Never mind.

  12. karrtikr commented on Feb 13, 2024

    @karrtikr
    Author

    Can you provide a screenshot of all variables that're supposed to be set in "Show environment contributions", and then check which those are set in terminal? For eg. You can run "echo $PATH" to see whether it's set.

  13. 10 remaining items

  14. changed the title [-]venv does not activate on my manjaro system[/-] [+]venv does not activate on my manjaro system for zsh[/+] on Feb 13, 2024
  15. matt-hires commented on Feb 13, 2024

    @matt-hires
    My contributed environment
    # Terminal Environment Changes
    
    ## Extension: vscode.git
    
    Enables the following features: git auth provider
    
    - `GIT_ASKPASS=/opt/visual-studio-code/resources/app/extensions/git/dist/askpass.sh`
    - `VSCODE_GIT_ASKPASS_NODE=/opt/visual-studio-code/code`
    - `VSCODE_GIT_ASKPASS_EXTRA_ARGS=`
    - `VSCODE_GIT_ASKPASS_MAIN=/opt/visual-studio-code/resources/app/extensions/git/dist/askpass-main.js`
    - `VSCODE_GIT_IPC_HANDLE=/run/user/1000/vscode-git-6e4ffbbc13.sock`
    
    ## Extension: ms-python.python
    
    Activated environment for `./venv/bin/python`
    
    - `PATH=/home/matthias/.vscode/extensions/ms-python.python-2024.1.10441459/pythonFiles/deactivate/zsh:/home/matthias/Development/src/cliargsparser/venv/bin:${env:PATH}`
    - `VIRTUAL_ENV=/home/matthias/Development/src/cliargsparser/venv`
    - `PS1=(venv) ${env:PS1}`
    - `VIRTUAL_ENV_PROMPT=(venv) `
    
    My $PATH env variable
    echo $PATH
    /home/matthias/.pyenv/shims:/home/matthias/.vscode/extensions/ms-python.python-2024.1.10441459/pythonFiles/deactivate/zsh:/home/matthias/Development/src/cliargsparser/venv/bin:/home/matthias/.local/share/gem/ruby/3.0.0/bin:/home/matthias/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/matthias/Development/android/sdk/tools:/home/matthias/Development/android/sdk/tools/bin:/home/matthias/Development/android/sdk/platform-tools:/home/matthias/Development/scripts/bin
    
    And my $PATH variable after I sources venv manually by: source venv/bin/activate
    echo $PATH
    /home/matthias/Development/src/cliargsparser/venv/bin:/home/matthias/.pyenv/shims:/home/matthias/.vscode/extensions/ms-python.python-2024.1.10441459/pythonFiles/deactivate/zsh:/home/matthias/Development/src/cliargsparser/venv/bin:/home/matthias/.local/share/gem/ruby/3.0.0/bin:/home/matthias/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/matthias/Development/android/sdk/tools:/home/matthias/Development/android/sdk/tools/bin:/home/matthias/Development/android/sdk/platform-tools:/home/matthias/Development/scripts/bin
    
  16. karrtikr commented on Feb 13, 2024

    @karrtikr
    Author

    Can you also report the same when trying out the latest release version of the extension?

    image

    Appreciate all the help! Matthias Mairleitner (@matt-hires)

  17. karrtikr commented on Feb 13, 2024

    @karrtikr
    Author

    Btw, can you share your .zshrc if possible?

  18. norambna commented on Feb 13, 2024

    @norambna

    Luis Norambuena (@norambna) Can you run "echo $PATH" in your .zshrc shell and report the value you see there?

    I'm using the Python extension v2024.1.10441814 (pre-release) now and echo $PATH in my zsh terminal inside VSCode, where my venv is not being activated:

    /home/luis/.pyenv/plugins/pyenv-virtualenv/shims:/home/luis/.pyenv/shims:/home/luis/.pyenv/bin:/home/luis/.vscode/extensions/ms-python.python-2024.1.10441814/pythonFiles/deactivate/zsh:/home/luis/Documents/genp/dj-genp/.venv/bin:/home/luis/.pyenv/bin:/home/luis/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

    And the PATH I'm getting in a bash terminal, where my venv is being activated automatically is:

    /home/luis/.vscode/extensions/ms-python.python-2024.1.10441814/pythonFiles/deactivate/zsh:/home/luis/Documents/genp/dj-genp/.venv/bin:/home/luis/.pyenv/plugins/pyenv-virtualenv/shims:/home/luis/.pyenv/shims:/home/luis/.vscode/extensions/ms-python.python-2024.1.10441814/pythonFiles/deactivate/zsh:/home/luis/Documents/genp/dj-genp/.venv/bin:/home/luis/.pyenv/bin:/home/luis/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

  19. matt-hires commented on Feb 13, 2024

    @matt-hires

    here you go:
    zshrc.zip

    this includes .zshrc as well as an encapsulated .oh-my.zshrc which is sourced in the former one.

  20. karrtikr commented on Feb 14, 2024

    @karrtikr
    Author

    Thanks. Can any of you provide the value of PATH asked here #22899 (comment) for the release version of the extension?

    Btw, both your issues seem to be microsoft/vscode#205133. The above information would help confirm it.

  21. matt-hires commented on Feb 14, 2024

    @matt-hires

    When using Release Version v2024.0.1 of the extension:

    Contributed Env:

    # Terminal Environment Changes
    
    ## Extension: vscode.git
    
    Enables the following features: git auth provider
    
    - `GIT_ASKPASS=/opt/visual-studio-code/resources/app/extensions/git/dist/askpass.sh`
    - `VSCODE_GIT_ASKPASS_NODE=/opt/visual-studio-code/code`
    - `VSCODE_GIT_ASKPASS_EXTRA_ARGS=`
    - `VSCODE_GIT_ASKPASS_MAIN=/opt/visual-studio-code/resources/app/extensions/git/dist/askpass-main.js`
    - `VSCODE_GIT_IPC_HANDLE=/run/user/1000/vscode-git-6e4ffbbc13.sock`
    
    ## Extension: ms-python.python
    
    Activated environment for `./venv/bin/python`
    
    - `PATH=/home/matthias/.vscode/extensions/ms-python.python-2024.0.1/pythonFiles/deactivate/zsh:/home/matthias/Development/src/cliargsparser/venv/bin:${env:PATH}`
    - `VIRTUAL_ENV=/home/matthias/Development/src/cliargsparser/venv`
    - `PS1=(venv) ${env:PS1}`
    - `VIRTUAL_ENV_PROMPT=(venv) `
    

    Path Variable:

    echo $PATH
    /home/matthias/.pyenv/shims:/home/matthias/.local/share/gem/ruby/3.0.0/bin:/home/matthias/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/matthias/Development/android/sdk/tools:/home/matthias/Development/android/sdk/tools/bin:/home/matthias/Development/android/sdk/platform-tools:/home/matthias/Development/scripts/bin
    

    And the Path after sourcing venv manually source venv/bin/activate:

    echo $PATH
    /home/matthias/Development/src/cliargsparser/venv/bin:/home/matthias/.pyenv/shims:/home/matthias/.local/share/gem/ruby/3.0.0/bin:/home/matthias/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/matthias/Development/android/sdk/tools:/home/matthias/Development/android/sdk/tools/bin:/home/matthias/Development/android/sdk/platform-tools:/home/matthias/Development/scripts/bin
    
  22. norambna commented on Feb 14, 2024

    @norambna

    PATH in a zsh terminal when using Python Extension v2024.1.10451007 (pre-release):
    /home/luis/.pyenv/plugins/pyenv-virtualenv/shims:/home/luis/.pyenv/shims:/home/luis/.pyenv/bin:/home/luis/.vscode/extensions/ms-python.python-2024.1.10451007/pythonFiles/deactivate/zsh:/home/luis/Documents/genp/dj-genp/.venv/bin:/home/luis/.pyenv/bin:/home/luis/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

    And PATH when using Python extension v2024.0.1:
    /home/luis/.pyenv/plugins/pyenv-virtualenv/shims:/home/luis/.pyenv/shims:/home/luis/.pyenv/bin:/home/luis/.pyenv/bin:/home/luis/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

  23. karrtikr commented on Feb 14, 2024

    @karrtikr
    Author

    Ok great, thanks for confirming. It seems automatic shell integration for zsh shell isn't working for you, same as microsoft/vscode#205133. I encourage you to upvote that to raise awareness and priority.

    As a workaround, try manual installation, which I expect should fix your issues: https://code.visualstudio.com/docs/terminal/shell-integration#_manual-installation.

  24. norambna commented on Feb 14, 2024

    @norambna

    As a workaround, try manual installation, which I expect should fix your issues: https://code.visualstudio.com/docs/terminal/shell-integration#_manual-installation.

    Yes, the "Manual installation" solved it on my system! Thanks and I also upvoted microsoft/vscode#205133

  25. matt-hires commented on Feb 15, 2024

    @matt-hires

    Workaround was also working for me, thx for your effort Kartik Raj (@karrtikr).

  26. locked as resolved and limited conversation to collaborators on Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

experimentingFeature is part of an experimenttriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions