[EnvCommandError] returned on `poetry install` and `poetry env`
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 Pro
-
Poetry version: 1.0.9
-
Link of a Gist with the contents of your pyproject.toml file: https://github.com/ernopp/smilebot/blob/master/pyproject.toml
Issue
Hi
There is an issue with my poetry installation
I am on version 1.0.9
C:\Users\ernest\dev\smilebot>poetry -V
Poetry version 1.0.9
My TOML appears correct
C:\Users\ernest\dev\smilebot>poetry check
All set!
But when I try to run poetry env info
or poetry install
(and same is true of many other commands I suspect) I get:
C:\Users\ernest\dev\smilebot>poetry install -vvv
[EnvCommandError]
Command ['C:\\Users\\ernest\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\shoponsmile-python-ovOS_Rxi-py3.8\\Scripts\\python.exe', '-'] errored with the following return code 1, and output:
The system cannot find the path specified.
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\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\clikit\console_application.py", line 131, in run
status_code = command.handle(parsed_args, io)
File "C:\Users\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\clikit\api\command\command.py", line 120, in handle
status_code = self._do_handle(args, io)
File "C:\Users\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\clikit\api\command\command.py", line 163, in _do_handle
self._dispatcher.dispatch(PRE_HANDLE, event)
File "C:\Users\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\clikit\api\event\event_dispatcher.py", line 22, in dispatch
self._do_dispatch(listeners, event_name, event)
File "C:\Users\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\clikit\api\event\event_dispatcher.py", line 89, in _do_dispatch
listener(event, event_name, self)
File "C:\Users\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\poetry\console\config\application_config.py", line 89, in set_env
env = env_manager.create_venv(io)
File "C:\Users\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\poetry\utils\env.py", line 489, in create_venv
env = self.get(reload=True)
File "C:\Users\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\poetry\utils\env.py", line 352, in get
return VirtualEnv(venv)
File "C:\Users\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\poetry\utils\env.py", line 1022, in __init__
self._base = Path(self.run("python", "-", input_=GET_BASE_PREFIX).strip())
File "C:\Users\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\poetry\utils\env.py", line 856, in run
return self._run(cmd, **kwargs)
File "C:\Users\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\poetry\utils\env.py", line 1089, in _run
return super(VirtualEnv, self)._run(cmd, **kwargs)
File "C:\Users\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\poetry\utils\env.py", line 893, in _run
raise EnvCommandError(e, input=input_)
I can see and run the python executable at C:\Users\ernest\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\shoponsmile-python-ovOS_Rxi-py3.8\Scripts
…
This happens whether I install poetry via pip or via the curl command (tried both)
Any help appreciated
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Reactions:28
- Comments:27 (5 by maintainers)
I was having the same issue when caching .venv directory on a Windows runner. It turns out restoring cache breaks symlinks in the virtual env.
The solution is to first create virtualenv manually with:
python -m venv .venv --copies
Which does not rely on symlinks and then run:
poetry install
I have the same issue, but removing virtualenv fix the thing…