Description of problem:
After the upgrade of python36-setuptools, packages cannot be created via easy_install any more. It expects to use a directory /usr/local/lib/python36 which does not exist
Version-Release number of selected component (if applicable):
I reproduced this on a fresh centos:7 docker image
Steps to Reproduce:
1. yum -y install epel-release
2. yum-config-manager --enable cr
3. yum inspect python36-setuptools
4. easy_install-3.6 pip
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/test-easy-install-368.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
Successful installation of the package.
It works with the previous version, 0.19
I wonder if this is actually a problem in setuptools or if the Fedora change about /usr/local/lib got smuggled into EPEL7 without anybody noticing.
Anyway probably too late to change that, so here's the setuptools fix: https://src.fedoraproject.org/rpms/python-setuptools/blob/master/f/create-site-packages.patch
But this would just create the empty site-packages directory when calling easy install, while there already is an existing site-package in /usr/lib/python36 already
Oh, interesting, it looks like that is also they it was handled with the older setuptools.
See https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe for why this was done in Fedora. Not sure if this is supposed to be in EPEL, but I guess even if it shouldn't, it's too late now.
(In reply to Miro Hrončok from comment #5)
> See https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe for why this
> was done in Fedora. Not sure if this is supposed to be in EPEL, but I guess
> even if it shouldn't, it's too late now.
It could be backported but this change was only intended for Fedora.
An existing container with the previous setuptools version has a directory /usr/lib/python3.6/site-packages which only contains a directory named __pycache__
the older version easy_install installed everything to /usr/local/lib/python3.6/site-packages.
With Miros patch, the current version of python36-setuptools would do the same and easy_install should work again.
If I apply this patch manually, I can install packages with easy_install. But I noticed that now easy_install.py is in /usr/lib/python3.6, whereas everything installed with easy_install ends up in /usr/local/lib/python3.6.
This behavior is different to the previous version :-(
> This behavior is different to the previous version
Nothing changed in setuptools about this, it's a change in the python36 package. Not sure when it got in.
BTW You should not be sudo easy_installing things. That's very dangerous. Get a Python virtual environment, or at least use pip install --user.
I compared the python36 versions of all installed packages from a docker image about two weeks ago before the update of python36-setuptools to a current docker image where I install all packages freshly.
I have python36, python36-libs and python36-setuptools. Of all three only python36-setuptools is in a newer version.
Unfortunately I don't know anything about packaging and don't understand the syntax of the .spec file enough to understand what is going on.
Regarding not sudo easy_installing things:
I only use easy_install once while building the docker image because I want to provide pipenv. I want to use pip to install pipenv, but there is no pip command and no python36-pip package to yum install. So I start with easy_install...
The docker image is then only used with users that don't have sudo rights.
Let's see what can we do about missing pip.
Anyway this might take a while. As a workaround of the immediate problem, create the directory before installing pip.
Also, try using this to install pip:
python3 -m ensurepip
Note that this is also dangerous with sudo, but a bit less than easy_install.
$ docker run -ti jsmigel/centos-epel /bin/bash
[root@ea092e28ba9e /]# yum install python36
[root@ea092e28ba9e /]# python3.6 -m ensurepip
Looking in links: /tmp/tmpprhtejdj
Installing collected packages: setuptools, pip
Successfully installed pip-10.0.1 setuptools-39.0.1
[root@ea092e28ba9e /]# python3.6 -m pip --version
pip 10.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
[root@ea092e28ba9e /]# python3.6 -m pip install -U pip
Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
100% |################################| 1.3MB 12.1MB/s
Installing collected packages: pip
Found existing installation: pip 10.0.1
Successfully uninstalled pip-10.0.1
Successfully installed pip-18.1
[root@ea092e28ba9e /]# python3.6 -m pip --version
pip 18.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
python3.6 -m ensurepip works
python3.6 -m pip install -U pip does not.
ensurepip also leaves the system in the same state as easy_intall in the old version.
I can live with ensurepip perfectly fine. using easy_install was just a workaround I am glad I got rid of. Thank you!
But I guess people who do have to use easy install still are in trouble.
Yes, this is indeed a bug that needs to be fixed. I'm just providing workarounds.
Anyway, you might be interested in https://src.fedoraproject.org/rpms/python-pip/pull-request/22
Patrick, any chance you could review the PR and test the built RPM from it?
sorry for pointing that out I am used to work in ticket systems where people take any excuse to close a ticket no matter what...
so I tried, running in a stock centos:7 image:
yum -y install epel-release && yum-config-manager --enable cr && yum install -y python36 && curl -o setuptools.rpm https://kojipkgs.fedoraproject.org//work/tasks/3669/31953669/python36-setuptools-39.2.0-2.el7.noarch.rpm && yum install setuptools.rpm && easy_install-3.6 pip
This will successfully install easy_install and pip.
I looked a bit deeper, setuptools now does get installed in /usr/lib/python3.6/site-packages while pip got installed in /usr/local/lib/python3.6/site-package.
With the previous version, setuptools ended up in /usr/local/lib/python3.6/site-packages.
But from the interpreter I can both import setuptools and pip, so both directories get checked.
Given that in python we don't import modules with absolute paths, I guess this is good enough.
> setuptools now does get installed in /usr/lib/python3.6/site-packages while pip got installed in /usr/local/lib/python3.6/site-package
That was expected.
> With the previous version, setuptools ended up in /usr/local/lib/python3.6/site-packages.
That was not expected.
> Given that in python we don't import modules with absolute paths, I guess this is good enough.
python3-setuptools-39.2.0-2.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-e29af3c9e7
python3-setuptools-39.2.0-2.el7 has been pushed to the Fedora EPEL 7 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-EPEL-2019-e29af3c9e7
python3-setuptools-39.2.0-2.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.