-
Notifications
You must be signed in to change notification settings - Fork 2.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
fix: fix venv paths redirected by Python from MS Store #5931
Conversation
a37d7d1
to
f881ed9
Compare
5ffda7d
to
3766a98
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the typing is a bit of a mess -- the get_real_windows_path
function takes a Path but immediately coerces it back to a string. Why don't we make it accept a Union of str or Path since that is what goes on internally anyway?
3766a98
to
29a93ea
Compare
Good idea 👍 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Running Poetry with Python installed from the Microsoft Store have to tackle multiple issues.
The system's Python interpreter is located at something like
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0
. But the user is not allowed to run any executable from there. Instead one should use the binaries locates atC:\Users\username\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\
.Another problem us, that applications from the Microsoft Store are not allowed to write directly into
%LocalAppdata%
, instead any attempt to do this is redirected to a sandbox folder located atC:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0
.The first problem described above is an issue, when trying to find the interpreter, that should be used for creating a new venv. This can be solved by replacing the
%ProgramFiles%
part of the path by%LocalAppdata/Microsoft%
.The second problem described above is an issue, when a new venv should be created at the default location under
C:\Users\klare\AppData\Local\pypoetry\Cache\virtualenvs
. Fortunately when one try to access this place during runtime, thePath
object is a symlink that can be resolved and than be passed to the subprocess call that creates the venv.This
install-poetry.py
script is affected by the same problems. A possible fix is prepared at python-poetry/install.python-poetry.org#18Resolves: #5331