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

Poetry install command fails - EnvCommandError #2261

Closed
1 task done
yunti opened this issue Apr 2, 2020 · 6 comments
Closed
1 task done

Poetry install command fails - EnvCommandError #2261

yunti opened this issue Apr 2, 2020 · 6 comments
Labels
kind/bug Something isn't working as expected

Comments

@yunti
Copy link

yunti commented Apr 2, 2020

  • [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_)
@yunti yunti added the kind/bug Something isn't working as expected label Apr 2, 2020
@yunti yunti changed the title Poetry fails to install - EnvCommandError Poetry install command fails - EnvCommandError Apr 2, 2020
@yunti
Copy link
Author

yunti commented Apr 2, 2020

Solved by running brew doctor and following the instructions to resolve the python links with brew link.

Perhaps an error output to the user to possible check that or to clarify the issue is with the python istallation may help possible repeats of the issue.

@harit559
Copy link

harit559 commented 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

@jonasanso
Copy link

I have a brand new mac with macOS Catalina 10.15.4 and I have not installed any python project before.

I got the same error when running it the first time poetry install, brew doctor did not give any errors.

The issue got solved after I installed python 3 using brew install python3 just adding it for reference.

@bryanowzky
Copy link

Yeah the same problem here, what I did was install brew and then brew install python3 just with those steps I could run poetry install without problem.

@khanguslee
Copy link

khanguslee commented 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.

Copy link

github-actions bot commented Mar 2, 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 2, 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

6 participants