Bug 1576924 - [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages
Summary: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python3
Version: 28
Hardware: Unspecified
OS: Unspecified
urgent
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1664722 1808301
TreeView+ depends on / blocked
 
Reported: 2018-05-10 18:09 UTC by Corey Farrell
Modified: 2020-02-28 08:40 UTC (History)
10 users (show)

Fixed In Version: python-setuptools-39.2.0-6.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-07-29 03:25:09 UTC
Type: Bug


Attachments (Terms of Use)

Description Corey Farrell 2018-05-10 18:09:09 UTC
Description of problem:
When trying to install starpy (https://github.com/asterisk/starpy) I 

Version-Release number of selected component (if applicable):
python3-3.6.5-1.fc28.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. Download a python module with a standard setup.py.
2. Run: python3 setup.py build
3. Run: sudo python3 setup.py install

Actual results:
Error output:
running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/test-easy-install-11875.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/local/lib/python3.6/site-packages/

This directory does not currently exist.  Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).


Expected results:
Module should be installed to /usr/lib/python3.6/site-packages

Additional info:
Work-around is to run:
sudo python3 setup.py install --prefix=/usr

This was not needed in Fedora 26, and is not needed with python2 (which installs to /usr/lib/python2.7/site-packages without needing to specify --prefix).

Comment 1 Miro Hrončok 2018-05-10 19:19:29 UTC
Actually the new prefix is a documented Fedora change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe

However the failure here is a bug.

Michal, could you please have a look at this? I remember proposing that python3-libs should own those directories, but for some reason, that would be bad and those are created on runtime, but I forgot when.

Comment 2 Michal Cyprian 2018-06-11 14:09:54 UTC
We discussed this case some time ago and we considered including /usr/lib(64)?/python3.6./site-packages in python3-libs.

When pip3 is run with root privileges for the first time, it simply creates missing directories. This failure happens only if user runs 'python3 setup.py install' or 'easy_install foo' on the system where sudo pip3 was not used before to install packages. I guess this is not very frequent use case.

If we want to fix this, two possible solutions come to my mind:
1. include /usr/local/lib(64)?/python3.6/site-packages in python3-libs (some exception is needed if I remember correctly)
2. Patch setuptools/distutils install command to create directories when necessary

Comment 4 Michael Clerx 2018-07-18 12:00:01 UTC
It fails in a similar way when using 

    python3 setup develop

or

  pip3 install -e .

Comment 6 Michael Clerx 2018-07-19 09:53:52 UTC
Why can't they be installed in /usr/lib or /usr/lib64, as is the case for Python2.7 ?

Comment 7 Miro Hrončok 2018-07-19 09:57:24 UTC
because users regularly nuked their systems with sudo pip3. (usually destroying dnf) See https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe for rationale.

Comment 8 Charalampos Stratakis 2018-07-20 14:41:47 UTC
I verified that the bug is there and also the PR fixes it. I'd prefer to take it upstream though.

Comment 9 Fedora Update System 2018-07-26 09:54:50 UTC
python-setuptools-39.2.0-6.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-47d56cbe45

Comment 10 Fedora Update System 2018-07-26 09:57:14 UTC
python-setuptools-37.0.0-2.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-66d5c87587

Comment 11 Fedora Update System 2018-07-26 14:17:06 UTC
python-setuptools-37.0.0-2.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-66d5c87587

Comment 12 Fedora Update System 2018-07-26 16:33:35 UTC
python-setuptools-39.2.0-6.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-47d56cbe45

Comment 13 Fedora Update System 2018-07-29 03:25:09 UTC
python-setuptools-39.2.0-6.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2018-08-09 16:50:48 UTC
python-setuptools-37.0.0-2.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.