poetry: Poetry fails to install on macOS High Sierra using Homebrew Python 3

Poetry fails to install on macOS High Sierra (10.13.4) using Homebrew Python 3 (3.6.5).

$ curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python3
Retrieving metadata

Installing version: 0.8.5
  - Getting dependencies
An error has occured: Command '('python', '-m', 'pip', 'install', 'poetry==0.8.5', '--target', '/var/folders/zk/1bgll_755dddcqh6snjdsmt00000gn/T/poetry-installer-ra11xs2z/dist')' returned non-zero exit status 1.
b'/usr/bin/python: No module named pip\n'

The reason this happens is the Installer.call() method has python hardcoded as the Python executable name. In my opinion, this is a soft violation of PEP 394. To solve this problem, call sys.executable to obtain the filesystem location of the version of Python running the get-poetry.py script. Pull request #60 has a suggested fix.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 17 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I appear to be having the same issue. Here is the command being run (ran?)… runded (that’s definitely right):

Command '('/usr/local/opt/python/bin/python3.6', '-m', 'pip', 'install', 'poetry==0.8.5', '--target', '/var/folders/3v/j70_9wm15ln0jg8whc_tq8wm0000gn/T/poetry-installer-zwa96x3h/dist')'

And the error being output:

distutils.errors.DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both

This StackOverflow post fixed my issue but I am not sure I like the fix since it’s a system wide setting but I don’t know enough about the context around pip/homebrew to come up with another workaround. I am using your version of get_poetry.py, @lgw4 .

I don’t really have much helpful input. Only saying I was also affected.

@pawelad Unfortunately, installing pipsi on macOS using Python 3 from Homebrew is also broken (perhaps for the same reasons; this is a problem with how the Homebrew packagers are configuring the Python installation). pipsi can be made to work with Homebrew’s Python 3, but doing so is quite hacky. FWIW, I love the idea of pipsi and wish it was a default part of Python.

@sdispater - given this and #36, what do you think about suggesting pipsi (https://github.com/mitsuhiko/pipsi) for installation? I’d be happy to help with the readme changes.

@bradj I’m not sure what a good solution to this would be (or even if there is one). As far as I can tell, there is some reason the Homebrew Python packagers set both the home and prefix/exec-prefix values. As you pointed out, the fix on SO really isn’t one. If anyone has suggestions, I’d love to hear them.