Poetry: EnvCommandError in Windows

Created on 16 Nov 2019  路  4Comments  路  Source: python-poetry/poetry

  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] I have searched the documentation and believe that my question is not covered.

Issue


Hi ~ after fresh install of poetry, I got the follow error when using poetry update in an virtural environment.

[EnvCommandError]
Command ['C:\\Users\\hoish\\env\\base\\Scripts\\python.exe', '-'] errored with the following return code 1, and output:

The system cannot find the path specified.
C:\Users\hoish\AppData\Local\Programs\Python\Python37
input was : import sys
if hasattr(sys, "real_prefix"):
    print(sys.real_prefix)
elif hasattr(sys, "base_prefix"):
    print(sys.base_prefix)
else:
    print(sys.prefix)

update [--no-dev] [--dry-run] [--lock] [--] [<packages>]...

my setup as follow:
poetry version: 0.12.17
virtual env path: C:Usershoishenvbase
original python path: C:UsershoishAppDataLocalProgramsPythonPython37python.exe
python version: 3.7.4

note that the path that poetry cannot find does exist, and it is the value of sys.base_prefix

Is it related to my enviornment variables? Any idea?

Most helpful comment

Note that in Windows 10:

> where.exe python
C:\Users\Razor\AppData\Local\Microsoft\WindowsApps\python.exe

But this is NOT python. It is a program that opens the windows store to install python. If this is found in your PATH and poetry tries to use it AND you have NOT installed python from the windows store, you can get this error.

All 4 comments

I found that poetry is affected by another software https://github.com/adoxa/ansicon, after removing ansicon everything is fine.

I have the same issue, but I don't have Ansicon. Any other reason why I might get the error?

in my case, Ansicon affects poetry by modifing the import addresss, through some kind of hooking / injection. You may check if you've installed something like that. Or you may open a new issue showing your error messages and see if someone could help :)

Note that in Windows 10:

> where.exe python
C:\Users\Razor\AppData\Local\Microsoft\WindowsApps\python.exe

But this is NOT python. It is a program that opens the windows store to install python. If this is found in your PATH and poetry tries to use it AND you have NOT installed python from the windows store, you can get this error.

Was this page helpful?
0 / 5 - 0 ratings