-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
WSL : Python executable coming from outside... and failing. #3488
Comments
I had the same issue on WSL, I noticed something interesting. |
pipenv is also pulling up python.exe for me Config / settings
I also bumped into this issue from inside a WSL environment. I have python 3.7 installed, but pip is installing to my python3.6 site packages by default. I only specify python 3 in my Pipfile:
Error
|
I ran into this as well today. Very strange that it looks for the Python in the Windows path. |
The python version on Windows is higher than that on WSL, making it come before the latter one.. Specify python path explicitly can fix the problem: $ pipenv --python /usr/bin/python3 |
@frostming I am unsure why you closed this, can you elaborate? This is a real concern that you most likely will get a large influx of issues on. This is a serious bug that will hit anyone developing in WSL. In the Windows 10, May 2019 update (19.03) python.exe and python3.exe are found by default, but they do not point to a real Python executable. I.e. a user have these without having installed Python in Windows. Read this announcement https://devblogs.microsoft.com/python/python-in-the-windows-10-may-2019-update/ and more specifically this quote:
I get this failure even though I have only installed python into the WSL distribution, and my project resides in the /home/username/ dir. 11:56:55 computer1 ~/code/scrapy (master)$ which python
/usr/bin/python
11:57:01 computer1 ~/code/scrapy (master)$ which python3
/usr/bin/python3
11:57:04 computer1 ~/code/scrapy (master)$ printenv PATH
/home/username/code/scrapy/.venv/bin:/home/username/.pyenv/shims:/home/username/.pyenv/bin:/home/username/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_1804.2019.521.0_x64__79rhkp1fndgsc:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Users/username/AppData/Local/Microsoft/WindowsApps:/snap/bin This completely breaks working in WSL and automatic installing like with pyenv, or using direnv with |
@thernstig I didn't say this is not an issue. Let's track it in #3807 There should be a fix in |
How do you maintain multiple Python versions? Specifically 3.6 and 3.7? |
@shamoons I personally use pyenv for that. (https://github.com/pyenv/pyenv) |
I got annoyed from having to specify my python version every time so I just removed |
Also works to just disable the app execution alias (Settings > Apps > Apps & features > Manage app execution aliases): https://superuser.com/a/1461471/56154 |
Issue description
Attempting to use pipenv to create a virtualenv on Windows(10) Subsystem Linux (Ubuntu distro), pipenv fails during the virtualenv creation. The issues seems to be that pipenv decides to use a python executable from windows, instead of the one from the WSL distro.
The flow I used to install pipenv on WSL was :
pip3 install --user --upgrade pip
,pip install --user pipenv
. Note user shell must be restarted to get the correct pip.Note I also have Python 3.7.2 installed on Windows.
Expected result
Pipenv decides to use python 3.7.1 coming from WSL environment, and environment is created with success :
Actual result
Steps to replicate
Pipfile :
Workaround
Running instead :
pipenv install --python=/usr/bin/python3.7
fixes the problem by specifying which python needs to be used.
$ pipenv --support
Pipenv version:
'2018.11.26'
Pipenv location:
'/home/alexv/.local/lib/python3.6/site-packages/pipenv'
Python location:
'/usr/bin/python3'
Python installations found:
3.7.2
:/mnt/c/Program Files/Python37/python.exe
3.7.2
:/mnt/c/Program Files/Python37/pythonw.exe
3.7.1
:/usr/bin/python3.7
3.7.1
:/usr/bin/python3.7m
3.6.7
:/usr/bin/python3
3.6.7
:/usr/bin/python3.6m
PEP 508 Information:
System environment variables:
LS_COLORS
HOSTTYPE
LESSCLOSE
LANG
DIRENV_DIR
OLDPWD
DIRENV_DIFF
VIRTUAL_ENV
USER
DIRENV_WATCHES
PWD
HOME
NAME
XDG_DATA_DIRS
PIPENV_ACTIVE
SHELL
TERM
SHLVL
LOGNAME
PATH
WSLENV
LESSOPEN
BASH_FUNC_show_virtual_env%%
_
PIP_DISABLE_PIP_VERSION_CHECK
PYTHONDONTWRITEBYTECODE
PIP_SHIMS_BASE_MODULE
PIP_PYTHON_PATH
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
PIPENV_ACTIVE
:1
Debug–specific environment variables:
PATH
:/bin:/home/alexv/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/Python37/Scripts:/mnt/c/Program Files/Python37:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/m nt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/A lexV/AppData/Roaming/Python/Python37/Scripts:/mnt/c/tools/Cmder:/mnt/c/tools/direnv:/mnt/c/tools/Syncthing:/mnt/c/Users/AlexV/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/AlexV/AppData/Local/GitHubDesktop/bin:/snap/bin
SHELL
:/bin/bash
LANG
:C.UTF-8
PWD
:/mnt/c/Users/AlexV/Documents/GitHub/functional-python/01
VIRTUAL_ENV
: ``Contents of
Pipfile
('/mnt/c/Users/AlexV/Documents/GitHub/functional-python/01/Pipfile'):Contents of
Pipfile.lock
('/mnt/c/Users/AlexV/Documents/GitHub/functional-python/01/Pipfile.lock'):The text was updated successfully, but these errors were encountered: