Bug 1406133

Summary: `pip install` is broken (path/permissions)
Product: [Fedora] Fedora Reporter: Christian Stadelmann <fedora>
Component: python-pipAssignee: Tomas Orsava <torsava>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 25CC: bkabrda, donald, metherid, ncoghlan, pviktori, TicoTimo, torsava
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-31 15:29:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Christian Stadelmann 2016-12-19 19:47:21 UTC
Description of problem:
Pip is unable to install local packages, rendering the package useless.

Version-Release number of selected component (if applicable):
python-pip-8.1.2-2.fc25.noarch
python-2.7.12-7.fc25.x86_64

How reproducible:
always

Steps to Reproduce:
1. run `pip install autoflake` as regular user

Actual results:
$ pip install --disable-pip-version-check autoflake
Collecting autoflake
  Using cached autoflake-0.6.6.tar.gz
Collecting pyflakes>=0.8.1 (from autoflake)
  Using cached pyflakes-1.3.0-py2.py3-none-any.whl
Installing collected packages: pyflakes, autoflake
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 326, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 742, in install
    **kwargs
  File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 834, in install
    strip_file_prefix=strip_file_prefix
  File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 1037, in move_wheel_files
    strip_file_prefix=strip_file_prefix,
  File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 346, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 317, in clobber
    ensure_dir(destdir)
  File "/usr/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib64/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/pyflakes-1.3.0.dist-info'

Expected results:
install autoflake as regular user

Comment 1 Petr Viktorin (pviktori) 2016-12-20 09:44:10 UTC
To install as a regular user, run `pip install --user autoflake`.

Without --user, pip is useful to install into virtual environments.

Comment 2 Christian Stadelmann 2016-12-20 15:13:44 UTC
Oh, I forgot that, thanks!

Is there any chance we can get pip to give the user the hint you just gave me?

Comment 3 Petr Viktorin (pviktori) 2016-12-20 15:34:23 UTC
There is an issue for that upstream: https://github.com/pypa/pip/issues/1668

Comment 4 Petr Viktorin (pviktori) 2017-10-31 15:29:20 UTC
We won't be working on this from the Fedora side. As you can see in the upstream issue, this is quite complicated, and any quick fix we do here is likely to conflict with upstream later.

The issue is tracked upstream, and it'll get into Fedora when it's released there. So, I'll close this report as UPSTREAM.