Skip to content

bug: Can't get shell-specific version to be working #193

Closed

Description

@srakrn

Describe the bug
After the installation of Pyenv with Chocolatey, it appears that I cannot get the shell-specific version to be working.

To Reproduce
Steps to reproduce the behavior:

  1. Go to PowerShell
  2. Run pyenv shell, this should output no shell-specific version configured
  3. Run pyenv shell 3.8.0
  4. Run pyenv shell, this should output no shell-specific version configured

Expected behavior
The latter execution of pyenv shell should indicate that the shell-specific Python version should be 3.8.0, or other versions as intended.

Desktop (please complete the following information):

  • OS: Windows 10 20H2
  • Tools used: PowerShell
  • Version: pyenv 2.64.3

Activity

  1. kirankotari commented on Nov 17, 2020

    @kirankotari
    Member

    @srakrn did you installed any python ?

  2. srakrn commented on Nov 17, 2020

    @srakrn
    Author

    Yes, I have installed a few of them. Both pyenv global and pyenv local works perfectly.

    image

    Also my paths accordingly

    image
    image

  3. molinav commented on Nov 21, 2020

    @molinav

    I can also observe this issue. It seems to be specific to the PowerShell, if I do this in the classical command prompt cmd.exe then pyenv shell works as expected though.

  4. srakrn commented on Nov 27, 2020

    @srakrn
    Author

    Can confirm it is PowerShell related issue as @molinav indicated.

    cmd:

    Microsoft Windows [Version 10.0.19042.630]
    (c) 2020 Microsoft Corporation. All rights reserved.
    
    C:\Users\Sirakorn.Lamyai>pyenv shell
    no shell-specific version configured
    
    C:\Users\Sirakorn.Lamyai>pyenv versions
      2.7.17
    * 3.7.7 (set by C:\Users\Sirakorn.Lamyai\.pyenv\pyenv-win\version)
      3.8.0
      3.8.2
    
    C:\Users\Sirakorn.Lamyai>pyenv shell 3.8.0
    
    C:\Users\Sirakorn.Lamyai>pyenv shell
    3.8.0
    

    PowerShell:

    Windows PowerShell
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    Try the new cross-platform PowerShell https://aka.ms/pscore6
    
    PS C:\Users\Sirakorn.Lamyai> pyenv shell
    no shell-specific version configured
    PS C:\Users\Sirakorn.Lamyai> pyenv shell 3.8.0
    PS C:\Users\Sirakorn.Lamyai> pyenv shell
    no shell-specific version configured
    
  5. molinav commented on Nov 28, 2020

    @molinav

    The problem seems to be with this line of code:

            ExecCommand("endlocal"& vbCrLf &"set PYENV_VERSION="& ver)
    

    because the set command is not having any effect. But if you type e.g. $env:PYENV_VERSION='3.9.0' in PowerShell, after that pyenv shell will return that the current Python version is 3.9.0.

  6. molinav commented on Nov 28, 2020

    @molinav
  7. WillyJL commented on Jul 5, 2021

    @WillyJL

    Bump? This is still an issue and looking into the current pyenv.vbs file the pyenv shell command doesn't even do anything anymore.
    Very annoying considering VSCode has a hardcoded pyenv shell {whatever} command running when you open a terminal if you have a custom env selected for the workspace...

  8. added a commit that references this issue on Jul 7, 2021
    6e6e781
  9. added a commit that references this issue on Jul 7, 2021
    c3198ff
  10. devmcp commented on May 16, 2022

    @devmcp

    I am on pyenv-win version 2.64.11 and this is still an issue for me in PowerShell

  11. kirankotari commented on May 16, 2022

    @kirankotari
    Member

    I am on pyenv-win version 2.64.11 and this is still an issue for me in PowerShell

    did you tried taking latest code? from master

  12. devmcp commented on May 25, 2022

    @devmcp

    I am on pyenv-win version 2.64.11 and this is still an issue for me in PowerShell

    did you tried taking latest code? from master

    Sorry for the delay. I was getting this issue when I had the latest version installed via scoop. I removed this and installed directly using the powershell script and it now works as expected. Thanks.

  13. Aziks0 commented on May 25, 2022

    @Aziks0

    The scoop installer doesn't create a shim for the pyenv.ps1 file. But you need this powershell script to be run for the shell command to work, otherwise the PYENV_VERSION env won't be set.

    So currently, the scoop "version" only works with CMD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions