question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to create Virtual Environment with MS Store Python

See original GitHub issue

OS: Windows 11 Python version: 3.10.3 Initial poetry install via Powershell command: (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -

Had some problems with initial install, so ran uninstall with no problems. However, on attempting to reinstall, got the following message:

Installing Poetry (1.1.13)
Installing Poetry (1.1.13): Creating environment
Actual environment location may have moved due to redirects, links or junctions.
  Requested location: "C:\Users\321gp\AppData\Roaming\pypoetry\venv\Scripts\python.exe"
  Actual location:    "C:\Users\321gp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\Roaming\pypoetry\venv\Scripts\python.exe"
Actual environment location may have moved due to redirects, links or junctions.
  Requested location: "C:\Users\321gp\AppData\Roaming\pypoetry\venv\Scripts\python.exe"
  Actual location:    "C:\Users\321gp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\Roaming\pypoetry\venv\Scripts\python.exe"
Installing Poetry (1.1.13): An error occurred. Removing partial environment.
Poetry installation failed.
See C:\Users\321gp\poetry-installer-error-2yr835li.log for error logs.

Error log contains the following:

No pyvenv.cfg file

Traceback:

  File "<stdin>", line 879, in main
  File "<stdin>", line 515, in run
  File "<stdin>", line 536, in install
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1008.0_x64__qbz5n2kfra8p0\lib\contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "<stdin>", line 608, in make_env
  File "<stdin>", line 594, in make_env
  File "<stdin>", line 326, in make
  File "<stdin>", line 349, in pip
  File "<stdin>", line 346, in python
  File "<stdin>", line 339, in run

Checking the links listed, C:\Users\... \Roaming\pypoetry\venv\ does not exist.

Suggestions on how to correct this?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
s-viourcommented, Apr 24, 2022

I was having this issue too, and found not so much a fix, but a workaround:

try setting the POETRY_HOME environment variable before running the install script to a directory you created. (i.e $env:POETRY_HOME="$env:userprofile\pypoetry") after that, run the install script again

0reactions
finswimmercommented, Jun 29, 2022

Hello everybody,

I slowly made progress here. The problem with Python installed from the MS Store is, that it is an UWP app and Microsoft redirects access to some folder into a sandbox folder. And this is not always done transparent.

I’ve created a proof-of-concept to workaround this. The install-poetry.py script needed a fix and Poetry itself. You can find it here:

One can test it like this:

curl https://raw.githubusercontent.com/finswimmer/install.python-poetry.org/fix/ms-store/install-poetry.py | python3 - --git https://github.com/finswimmer/poetry.git@python-ms-store

Please note: It’s a POC and the code is not as beautiful as it could be.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to create Python virtual environment from "Add ...
Right clicking on the “Python Environments” tab under a Python project brings up the “Add environment” window. As an Anaconda environment is currently...
Read more >
Can't create virtual env with Python 3.9 in Windows
Unset the $PYTHONPATH environment variable. That is what is causing python3.9 to incorrectly find code inside Python-3.7.
Read more >
How To Set Up a Virtual Python Environment (Windows)
Create a Virtual Python Environment​​ The following commands will create a new virtual environment under my-project/my-venv . If Windows cannot find virtualenv. ...
Read more >
Issue 46056: Cannot use virtual environment on Windows 10 ...
I just installed Python3.10.1 from the Windows 10 App Store. Most workflows depend on creating virtual environments, but (1) python -m venv ...
Read more >
How To Set Up A Python Virtual Environment On Windows 10
In this video, we demonstrate how to set up a python virtual environment on Windows 10.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found