Poetry: Cannot install on Ubuntu 16.04, on both python 2 and 3

Created on 17 May 2018  路  8Comments  路  Source: python-poetry/poetry

> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial

I'm using the distro packages for Python and Pip:

 > python3 --version
 Python 3.5.2
 > pip3 --version
 pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)
 > python --version
 Python 2.7.12
 > pip --version
 pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)

I know that pip complains about it not being the latest version, but I think the installation should still work, right?

By complains I mean this:

You are using pip version 8.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Anyway:

 > curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python

and

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

both end up with this:

Retrieving metadata

Installing version: 0.9.0
 - Getting dependencies
[... output truncated by me...]
Successfully built pyrsistent toml cachecontrol functools32 scandir pastel msgpack-python
Installing collected packages: typing, functools32, jsonschema, six, scandir, pathlib2, first, click, pip-tools, certifi, chardet, idna, urllib3, requests, pylev, pastel, cleo, pyrsistent, virtualenv, cachy, pyparsing, toml, msgpack-python, lockfile, cachecontrol, requests-toolbelt, pkginfo, poetry
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run
    prefix=options.prefix_path,
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 732, in install
    **kwargs
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 837, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 1039, in move_wheel_files
    isolated=self.isolated,
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 247, in move_wheel_files
    prefix=prefix,
  File "/usr/lib/python2.7/dist-packages/pip/locations.py", line 153, in distutils_scheme
    i.finalize_options()
  File "/usr/share/python-wheels/setuptools-20.7.0-py2.py3-none-any.whl/setuptools/command/install.py", line 38, in finalize_options
    orig.install.finalize_options(self)
  File "/usr/lib/python2.7/distutils/command/install.py", line 289, in finalize_options
    raise DistutilsOptionError("can't combine user with prefix, "
DistutilsOptionError: can't combine user with prefix, exec_prefix/home, or install_(plat)base

馃槩

(Edit: pip3 install --user poetry worked. I'll leave the issue here and you can close it if you want. I'd say that the default installation instructions should work.)

Most helpful comment

The Poetry documentation will never recommend installing with sudo since this is a bad practice most of the time. If one wants to install it this way they can and are free do to so.

Nonetheless, Poetry installation is still a pain point and is something that needs to be tackled before Poetry can reach version 1.0.

I want the installer to make Poetry self-sufficient and self-updatable without hitting permissions issues.

The only way to achieve that is to install it in the user directory. For instance, cargo for Rust is installed in the ~/.cargo directory.

All 8 comments

This same error is happening with the Homebrew'ed version of Python on macOS: https://github.com/sdispater/poetry/issues/36

I am experiencing the issue on ubuntu 18.04

Anything that involves installing packages to system python will require root permission, which is one of the main reasons to avoid installing system packages i.e. sudo pip install my-package-with-buggy-deps

This is a common issue in python and the README should probably address it early on by either:

  1. switching to root user and carry on from there
  2. use sudo where needed

I usually prefer option 2, and from my usage this means:

# to install
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | sudo python3.6

# to setup bash completion
poetry completions bash | sudo tee /etc/bash_completion.d/poetry.bash-completion > /dev/null

I believe pip should _never_ be used with root permissions. The current installer is missing a --user flag, but there's already a PR open for that.

I wouldn't say _never_, its a perfectly valid use case for multi-user, system package installs, particularly if the package vendors its dependencies like poetry

The Poetry documentation will never recommend installing with sudo since this is a bad practice most of the time. If one wants to install it this way they can and are free do to so.

Nonetheless, Poetry installation is still a pain point and is something that needs to be tackled before Poetry can reach version 1.0.

I want the installer to make Poetry self-sufficient and self-updatable without hitting permissions issues.

The only way to achieve that is to install it in the user directory. For instance, cargo for Rust is installed in the ~/.cargo directory.

The only way to achieve that is to install it in the user directory. For instance, cargo for Rust is installed in the ~/.cargo directory.

In which case should it use base directories as specified by freedesktop?

The new installer's behavior fixes this by adopting the behavior that I hinted at here: https://github.com/sdispater/poetry/issues/112#issuecomment-407459442

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sobolevn picture sobolevn  路  3Comments

kierun picture kierun  路  3Comments

etijskens picture etijskens  路  3Comments

probablykasper picture probablykasper  路  3Comments

thejohnfreeman picture thejohnfreeman  路  3Comments