Skip to content
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

getting [EnvCommandError] after upgrading Poetry for all commands #1895

Closed
3 tasks done
vsskanth opened this issue Jan 15, 2020 · 13 comments
Closed
3 tasks done

getting [EnvCommandError] after upgrading Poetry for all commands #1895

vsskanth opened this issue Jan 15, 2020 · 13 comments
Labels
kind/bug Something isn't working as expected

Comments

@vsskanth
Copy link

vsskanth commented Jan 15, 2020

  • 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).

Issue

I recently upgraded poetry poetry from 1.0.0 to 1.0.2 and now i am unable to execute any poetry commands like poetry env list or poetry shell or poetry add for my existing projects. I get the same error every time. I checked my path and i don't seem to have an invalid path so I don't know where the issue is coming from. I uninstalled and reinstalled poetry and still get the same error.

[EnvCommandError]
Command ['C:\\Users\\srikanth\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\pyfmi-test-ckR5wBVt-py3.8\\Scripts\\python.exe', '-'] errored with the following return code 1, and output:
The system cannot find the path specified.
C:\Python38
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)


Traceback (most recent call last):
  File "C:\Users\srikanth\.poetry\lib\poetry\_vendor\py3.8\clikit\console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "C:\Users\srikanth\.poetry\lib\poetry\_vendor\py3.8\clikit\api\command\command.py", line 120, in handle           status_code = self._do_handle(args, io)
  File "C:\Users\srikanth\.poetry\lib\poetry\_vendor\py3.8\clikit\api\command\command.py", line 163, in _do_handle       self._dispatcher.dispatch(PRE_HANDLE, event)
  File "C:\Users\srikanth\.poetry\lib\poetry\_vendor\py3.8\clikit\api\event\event_dispatcher.py", line 22, in dispatch
    self._do_dispatch(listeners, event_name, event)
  File "C:\Users\srikanth\.poetry\lib\poetry\_vendor\py3.8\clikit\api\event\event_dispatcher.py", line 89, in _do_dispatch
    listener(event, event_name, self)
  File "C:\Users\srikanth\.poetry\lib\poetry\console\config\application_config.py", line 88, in set_env
    env = env_manager.create_venv(io)
  File "C:\Users\srikanth\.poetry\lib\poetry\utils\env.py", line 475, in create_venv
    env = self.get(reload=True)
  File "C:\Users\srikanth\.poetry\lib\poetry\utils\env.py", line 347, in get
    return VirtualEnv(venv)
  File "C:\Users\srikanth\.poetry\lib\poetry\utils\env.py", line 1004, in __init__
    self._base = Path(self.run("python", "-", input_=GET_BASE_PREFIX).strip())
  File "C:\Users\srikanth\.poetry\lib\poetry\utils\env.py", line 838, in run
    return self._run(cmd, **kwargs)
  File "C:\Users\srikanth\.poetry\lib\poetry\utils\env.py", line 1071, in _run
    return super(VirtualEnv, self)._run(cmd, **kwargs)
  File "C:\Users\srikanth\.poetry\lib\poetry\utils\env.py", line 875, in _run
    raise EnvCommandError(e, input=input_)
@vsskanth vsskanth added the kind/bug Something isn't working as expected label Jan 15, 2020
@vsskanth
Copy link
Author

Solved it. Its a problem when you install and uninstall conda. it creates autorun bindings for cmd.exe in the registry leading to these errors.

Computer\HKEY_CURRENT_USER\Software\Microsoft\Command Processor
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor

@jimbroze
Copy link

jimbroze commented Feb 23, 2020

Solved it. Its a problem when you install and uninstall conda. it creates autorun bindings for cmd.exe in the registry leading to these errors.

Computer\HKEY_CURRENT_USER\Software\Microsoft\Command Processor
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor

I'm having this same issue. How did you fix it?

@vsskanth
Copy link
Author

vsskanth commented Feb 23, 2020 via email

@jimbroze
Copy link

jimbroze commented Feb 23, 2020

Check your PATH variable and those registry keys I mentioned. Make sure all paths are valid.

On Sun, Feb 23, 2020, 6:38 AM jimbroze @.***> wrote: I'm having this same issue. How did you fix it? — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <#1895?email_source=notifications&email_token=AHX37RCGD25GNPJ273VBWJ3REJN2TA5CNFSM4KHKYVKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMVZRBA#issuecomment-590059652>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHX37RCH3WQZPBCE7BNSKWLREJN2TANCNFSM4KHKYVKA .

Thanks. Embarrassingly, my non-Anaconda python interpreter wasn't added to the PATH variable.

@razor-x
Copy link

razor-x commented Mar 29, 2020

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.

@royjohal
Copy link

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.

Nowhere in the original post does the poster mention anything inside the <home>\AppData\Local\Microsoft\WindowsApps\python.exe folder.

@razor-x
Copy link

razor-x commented Apr 24, 2020

Originally when searching for a solution for an error with very similar error message on Windows this and another issue came up as top hits. I was simply adding something I hoped might help others or be related to solving the problem.

Note that when the issue is the one related to the WindowsApps folder I posted, it never comes up in the error either, so I would not expect an issue report to reference this path even when it is the underlying problem. It took some digging to discover they were connected.

@adriaanbd
Copy link

@razor-x How to solve this problem then?

@billfreeman44
Copy link

billfreeman44 commented Feb 3, 2021

@razor-x How to solve this problem then?

Something like this #1587 (comment) @adriaanbd

@adriaanbd
Copy link

adriaanbd commented Feb 3, 2021

@billfreeman44 Thank you! I read all posts in there but didn't find someone explicitly saying how to solve the issue related to the WindowsApps folder in the path, but I guess no one needs to state the obvious. I've uninstalled the Python that was installed by Windows Apps and installed it by using the executable from python.org and made sure it got added to PATH. I've also removed the WindowsApps entry from the Path.

Poetry works now.

PS C:\Users\johndoe> where.exe python
C:\Users\johndoe\AppData\Local\Programs\Python\Python39\python.exe

@billfreeman44
Copy link

@adriaanbd Yep, sorry. It was late into a long day for me so I forgot to mention the explicit step. At least now others will find your solution and can fix it :)

@m-martin-j
Copy link

Solved it. Its a problem when you install and uninstall conda. it creates autorun bindings for cmd.exe in the registry leading to these errors.

Computer\HKEY_CURRENT_USER\Software\Microsoft\Command Processor
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor

Running into this issue as well and can confirm that this solution finally helped me. (I tried to use poetry env use and poetry install.)
It turned out Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor had an entry Autorun with a value of C:\ProgramData\Anaconda3\condabin\conda_hook.bat. Deleting this entry solved my problem.

Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

7 participants