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.

Poetry install command fails - EnvCommandError

See original GitHub issue
  • [x ] I am on the latest Poetry version.

  • [x ] 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: macOS Catalina 10.15.3

  • Poetry version: 1.05

  • fish version: 3.1.0

Issue

After checking the toml file with poetry check which was fine. Attempting to install gave the below error. (Note also trying poetry env use 3 gave the same error as does poetry env info. Using python3 works fine and loads the REPL)

[EnvCommandError]
Command ['/Users/yunti/Library/Caches/pypoetry/virtualenvs/switcher5-8hLu6-cI-py3.7/bin/python', '-'] errored with the following return code -6, and output:
dyld: Library not loaded: @executable_path/../Python3
  Referenced from: /Users/yunti/Library/Caches/pypoetry/virtualenvs/switcher5-8hLu6-cI-py3.7/bin/python
  Reason: image not found
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 "/Users/yunti/.poetry/lib/poetry/_vendor/py2.7/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/Users/yunti/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/Users/yunti/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 163, in _do_handle
    self._dispatcher.dispatch(PRE_HANDLE, event)
  File "/Users/yunti/.poetry/lib/poetry/_vendor/py2.7/clikit/api/event/event_dispatcher.py", line 22, in dispatch
    self._do_dispatch(listeners, event_name, event)
  File "/Users/yunti/.poetry/lib/poetry/_vendor/py2.7/clikit/api/event/event_dispatcher.py", line 89, in _do_dispatch
    listener(event, event_name, self)
  File "/Users/yunti/.poetry/lib/poetry/console/config/application_config.py", line 89, in set_env
    env = env_manager.create_venv(io)
  File "/Users/yunti/.poetry/lib/poetry/utils/env.py", line 657, in create_venv
    return VirtualEnv(venv)
  File "/Users/yunti/.poetry/lib/poetry/utils/env.py", line 1022, in __init__
    self._base = Path(self.run('python', '-', input_=GET_BASE_PREFIX).strip())
  File "/Users/yunti/.poetry/lib/poetry/utils/env.py", line 856, in run
    return self._run(cmd, **kwargs)
  File "/Users/yunti/.poetry/lib/poetry/utils/env.py", line 1089, in _run
    return super(VirtualEnv, self)._run(cmd, **kwargs)
  File "/Users/yunti/.poetry/lib/poetry/utils/env.py", line 893, in _run
    raise EnvCommandError(e, input=input_)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

18reactions
harit559commented, Apr 6, 2020

I also encountered this after brew install another package (which updated my python version). I fixed this by

  1. rm -rf /Users/(user)/Library/Caches/pypoetry/virtualenvs/yourvirtualenv/
  2. poetry install 😀 This should fix your problem
1reaction
khangusleecommented, Jul 25, 2020

I also encountered this after brew install another package (which updated my python version). I fixed this by

  1. rm -rf /Users/(user)/Library/Caches/pypoetry/virtualenvs/yourvirtualenv/
  2. poetry install 😀 This should fix your problem

Thanks for this! This helped solve my problem after I did a brew update a couple of days ago.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[EnvCommandError] returned on `poetry install` and `poetry env`
1. GH Action here. Error: Run poetry install EnvCommandError Command D:\a\sync_with_poetry\sync_with_poetry\.venv\Scripts\python.
Read more >
Poetry install fails with EnvCommandError: looks for version ...
I had this same error because for some reason poetry install always failed to create a virtual enviroment path in %APPDATA% .
Read more >
EnvCommandError in Windows using Poetry - Random Wits
Now add some library like pandas. $ poetry add pandas. However this command is causing the poetry to crash. Creating virtualenv myproject-xkRwmYf0-py3.7 in ......
Read more >
EnvCommandError - cannot get django tutorial to deploy
I've tried to get a test deploy of the django tutorial deployed but cannot get it to work. I created an environment variable...
Read more >
Commands | master | Documentation | Poetry - Python ...
If you try to add a package that is already present, you will get an error. However, if you specify a constraint, like...
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