-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Pyenv not being added to PATH in WSL if Pyenv-Win is on PATH #2026
Comments
Looks like shims are not on PATH. If you've upgraded to Pyenv 2 from an earlier version -- did you add |
FWIW, I'm having these exact same symptoms on Linux Mint. Just started yesterday after I did an apt upgrade and rebooted. Existing envs are broken, as are newly created ones. My .bashrc contains the command eval "$(pyenv init -)" instead of the one recommended there. I just changed it to use --path, and now everything's working again. |
@distobj You need to not change If you rather replace it, you'll lose the shell function and all its benefits (completion and some subcommands). |
Changing to --path worked. Adding --path worked. Closing. What changed? I don't know. The install doc could use a little more commentary on - vs --path (appears to control whether the path is added, necessary when the init is sourced, which seems to be happening maybe in different distros?) |
@native-api, I may not be reading it correctly, but your comment makes it seem like you don't need to set your shims in non-login shells, and I do not think that is correct. I agree that you need to run both
Alternatively,
Of course there are exceptions depending on your shell. Typical systems have two start-up files: In that context it makes sense that you'd only want to run |
A non-login shell is always a descendant of a login shell. So if you set up the PATH in the session's login shell, you don't need to do it again in non-login ones. |
i recently installed WSL in windows 11 and appear to be having a related problem. I'm trying to run vscode on top of WSL. My
but i'm getting an error, repeating multiple times, as you can see:
Anyone know how to fix this? Separately, I have it working on the windows side with It's not clear to me that the PATH is being updated correctly. vscode and windows system environmental variables precede my user variables on PATH. |
@andersrmr Not relevant to Pyenv. We do not use |
I was getting the same error, I resolved it by modifying the .bashrc and .profile lines for these:
This will make sure to add the pyenv root dir in the path even if it pyenv-win is detect on the host machine. |
For anyone else having this issue because pyenv-win is installed, see the comment here:
You may also need to change the last line to:
|
Perhaps we can adjust the initialization code to work in the case when Pyenv-Win is on PATH. Alternatively -- and perhaps preferrably -- why does it even end up on PATH is WSL? I'm not familiar with WSL. AFAIK it's an Ubuntu VM with the host FS visible as a mount. Why even add something from the host FS to PATH? Windows executables cannot run in the VM, can they? So what's the point? |
You can run window commands like
|
With above reply, I cannot resolve my issue that is same with you ( pyenv-win in Window, pyenv in WSL2) but refer to the article, https://stackoverflow.com/a/76483889/14103688 export PYENV_ROOT="$HOME/.pyenv" BIN_OLD="/mnt/c/Users/username/.pyenv/pyenv-win/bin" |
pyenv mysteriously not working on WSL after Win11 upgrade
I've been using Pyenv happily with WSL and WIN11 forever. Feels like forever. Years. I prefer WSL1 because it is 10x faster for what I use (long story), and I'm still on Ubuntu 18.04 for my WLS1 shell.
I install via the basic "pull and bash" mechanism. I do a clone of the git repo into the usual location in the home directory, execute the path elements to point there, then pyenv init, in my .bash_alises , which has always worked before.
Right around when I upgraded to Windows 11 - probably two weeks ago, when Win11 came through the beta channel (not alpha), I noticed my python version was python2 instead of python3.
Digging in, I see that pyenv is installed properly, still, but when I 'which python' I get '/usr/bin/python', even though I have exec'd the init so the shims should be installed. Either the shims are not getting installed or they are getting removed or overridden?
I've checked every obvious thing I can find, and it just seems like the shims don't install. I've also tried going to a fresh WSL2 install on U20.04. I've looked at the path --- virtualenv was in front, and I removed that.
If I had to guess, I would assume there's some dependancy on the uname, which probably changed. The current one is:
Linux SUPERFLY 4.4.0-22000-Microsoft #1-Microsoft Fri Jun 04 16:28:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux
I've looked through the various scripts that should install the shims and just don't see anything.
Halp? Next places to look?
Description
18.041)The text was updated successfully, but these errors were encountered: