python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.76k stars 2.27k forks source link

Cannot install on Ubuntu 16.04, on both python 2 and 3 #112

Closed costincaraivan closed 6 years ago

costincaraivan commented 6 years ago
> 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.)

digitalresistor commented 6 years ago

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

BorePlusPlus commented 6 years ago

I am experiencing the issue on ubuntu 18.04

ciarancourtney commented 6 years ago

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
cauebs commented 6 years ago

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.

ciarancourtney commented 6 years ago

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

sdispater commented 6 years ago

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.

BorePlusPlus commented 6 years ago

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?

sdispater commented 6 years ago

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

github-actions[bot] commented 8 months ago

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.