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.
Upon further testing, it appears that Homebrew's Python 3 install may be broken in such a way that installing Poetry using get-poetry.py will never be easy. I still believe the suggested fix is correct for most POSIX systems (that is, it will make sure that Poetry is installed into the site-packages of the Python version running get-poetry.py).
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.
@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.
Chiming in to say that I'm having the same issue as @bradj on macOS with a Homebrewed Python:
distutils.errors.DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both
I think this particular problem is a dup of #36.
@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.
@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.
Can someone try curl -sSL https://raw.githubusercontent.com/sdispater/poetry/develop/get-poetry.py | python and tell me if that works?
@sdispater yup, that works for me!
(after also being affected by above error, ie distutils.errors.DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both)
@sdispater Works for me as well (with Homebrew Python 3.6.5 on macOS 10.13.4). I modified your command to be curl -sSL https://raw.githubusercontent.com/sdispater/poetry/develop/get-poetry.py | python3 and it worked great.
I got
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/opt/homebrew/lib/python3.6/site-packages/poetry-0.9.1.dist-info'
Consider using the `--user` option or check the permissions.
@cs01 It seems there is a permission issue. The installer, via pip, does not have access to the directory.
Did you install your Python version using sudo by any chance?
@sdispater
Can someone try curl -sSL https://raw.githubusercontent.com/sdispater/poetry/develop/get-poetry.py | python and tell me if that works?
Works for me now, too. I'm running Homebrewed Python 3.6.5 on macOS 10.13.4.
....however, if try upgrading Poetry immediately after installation, I get this error:
$ poetry self:update
Updating to 0.10.0
[RuntimeError]
Unable to determine poetry's path
self:update [--preview] [--] [<version>]
But perhaps this is a separate issue.
Did you install your Python version using sudo by any chance?
I did not install it myself, but it is owned by root in group wheel.
>> curl -sSL https://raw.githubusercontent.com/sdispater/poetry/develop/get-poetry.py | python3
Retrieving metadata
Installing version: 0.10.1
- Getting dependencies
- Vendorizing dependencies
- Installing poetry
An error has occured: Command '('/opt/homebrew/opt/python36/bin/python3.6', '-m', 'pip', 'install', '--upgrade', '--no-deps', '/var/folders/jf/5kt7zmz13pggxdg86f6gdqp05rpb8z/T/poetry-installer-rzqw63cy/poetry-0.10.1-py2.py3-none-any.whl')' returned non-zero exit status 1.
Processing /var/folders/jf/5kt7zmz13pggxdg86f6gdqp05rpb8z/T/poetry-installer-rzqw63cy/poetry-0.10.1-py2.py3-none-any.whl
Installing collected packages: poetry
Found existing installation: poetry 0.10.1
Uninstalling poetry-0.10.1:
Successfully uninstalled poetry-0.10.1
Rolling back uninstall of poetry
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/opt/homebrew/lib/python3.6/site-packages/__pycache__/_pyrsistent_version.cpython-36.pyc'
Consider using the `--user` option or check the permissions.
It looks like I already have a version installed in python 2, but the upgrade doesn't work.
>> type python
python is /usr/bin/python
>> python -m poetry -V
Poetry 0.9.1
>> poetry
-bash: poetry: command not found
>> curl -sSL https://raw.githubusercontent.com/sdispater/poetry/develop/get-poetry.py | python
Retrieving metadata
Installing version: 0.10.1
- Getting dependencies
- Vendorizing dependencies
- Installing poetry
An error has occured: Command '('/usr/bin/python', '-m', 'pip', 'install', '--upgrade', '--no-deps', '/var/folders/jf/5kt7zmz13pggxdg86f6gdqp05rpb8z/T/poetry-installer-f3H9IA/poetry-0.10.1-py2.py3-none-any.whl')' returned non-zero exit status 1
Processing /var/folders/jf/5kt7zmz13pggxdg86f6gdqp05rpb8z/T/poetry-installer-f3H9IA/poetry-0.10.1-py2.py3-none-any.whl
Installing collected packages: poetry
Found existing installation: poetry 0.9.1
Uninstalling poetry-0.9.1:
Successfully uninstalled poetry-0.9.1
Rolling back uninstall of poetry
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/poetry'
Consider using the `--user` option or check the permissions.
But if I install with pipsi it works fine.
I opened a PR which I think fixes this issue: #146 Would you like to give it a try?
This issue affects most Linux distributions, since Python comes pre-installed and pip install requires sudo by default.
The behavior of the installer has changed and this issue should be fixed.
Most helpful comment
I appear to be having the same issue. Here is the command being run (ran?)... runded (that's definitely right):
And the error being output:
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.