install-poetry.py fails with "no module named 'virtualenv'" when run with Python from the Microsoft Store
See original GitHub issue-
I am on the latest Poetry version.
-
I have searched the issues of this repo and believe that this is not a duplicate.
-
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option). -
OS version and name: Windows 10 20H2 (10.0.19042.1052)
-
Poetry version: N/A
-
Link of a Gist with the contents of your pyproject.toml file: N/A
Issue
I’m trying the new installer with Pyton 3.9 from the Microsoft Store.
PS C:\> get-command python
CommandType Name Version Source
----------- ---- ------- ------
Application python.exe 0.0.0.0 C:\Users\sam\AppData\Local\Microsoft\WindowsApps\python.exe
PS C:\> (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -UseBasicParsing).Content | python
Retrieving Poetry metadata
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
C:\Users\sam\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Scripts
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
You are installing 1.1.6. When using the current installer, this version does not support updating using the 'self update' command. Please use 1.2.0a1 or later.
Installing Poetry (1.1.6)
Installing Poetry (1.1.6): Creating environment
Traceback (most recent call last):
File "<stdin>", line 831, in <module>
File "<stdin>", line 827, in main
File "<stdin>", line 440, in run
File "<stdin>", line 462, in install
File "<stdin>", line 526, in make_env
ModuleNotFoundError: No module named 'virtualenv'
When install-poetry.py
runs pip
to install the virtualenv
module, it doesn’t check the return code. If I change the installer to use subprocess.check_call
then I get:
Installing Poetry (1.1.6): Creating environment
An error has occured: Command '['C:\\Users\\sam\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\python.exe', '-m', 'pip', 'install', 'virtualenv', '-t', 'C:\\Users\\sam\\AppData\\Local\\Temp\\tmpsno44236']' returned non-zero exit status 1.
Traceback (most recent call last):
File "c:\users\sam\appdata\local\temp\install-poetry.py", line 440, in run
self.install(version)
File "c:\users\sam\appdata\local\temp\install-poetry.py", line 462, in install
env_path = self.make_env(version)
File "c:\users\sam\appdata\local\temp\install-poetry.py", line 518, in make_env
subprocess.check_call(
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Users\\sam\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\python.exe', '-m', 'pip', 'install', 'virtualenv', '-t', 'C:\\Users\\sam\\AppData\\Local\\Temp\\tmpsno44236']' returned non-zero exit status 1.
… but I’ve no idea where the output of pip
is disappearing to.
If I try to run pip
manually, I get…
PS C:\Users\sam\AppData\Local\Temp> python -m pip install virtualenv -t vvv
ERROR: Can not combine '--user' and '--target'
WARNING: You are using pip version 21.1.1; however, version 21.1.2 is available.
You should consider upgrading via the 'C:\Users\sam\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip' command.
No idea what’s going on there. But I think the installer should have caught the error & displayed it to me.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
I have more or less the same issue with Ubuntu 20.08, when I try to execute the following:
I believe it’s because of that part of the installation:
The
virtualenv
installed lacks a special module necessary to proceed with, which is thevirtualenv.seed.via_app_data
one. I tried uninstalling virtualenv multiple times without any success.The root cause of this issue was resolved by #4099. See the bottom part of https://github.com/python-poetry/poetry/issues/4463#issuecomment-972734348 for more information.