-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrading to pip 10: It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall. #5247
Comments
Se #4805 and #3389 for the history. Basically, pip cannot properly uninstall packages installed by "pure" distutils, because distutils doesn't record enough metadata for us to do so. We've previously removed the installation metadata, so that it looks like we did the install, but we've had to leave files behind. That causes issues. Since pip 8, we've been trying to stop doing this, because it's a cause of problems, but our initial attempt was reverted because it affected too many people at the time. With pip 10, we've finally stopped trying to uninstall distutils packages, and now we report the problem to the user as you see here. Basically, if you (or some infrastructure you use) installed a package using distutils, you need to manage (and in particular) uninstall it "using distutils". Unfortunately distutils doesn't include an uninstall command, so "uninstall using distutils" means manually removing the package. |
@pfmoore Thanks for the quick answer! This is rather inconvenient because most of the packages come installed as dependencies and we do not manage it ourselves. Automating the removal will be interesting. I see there is some movement to only upgrade packages, without uninstalling them first. It would be great if this would eventually happen. We could close this issue since it is widely discussed somewhere else. Thanks! |
Try removing package manually from "site-packages". This works perfect! |
I seem to get round this problem by providing the version of pip with the command |
I used follow steps and resolved this problem
|
This seems to fix the issue for me: stacks-network/stacks-core#504 In the orignal case above, that'd be:
|
Don't know who you are, but I love you. |
So @pfmoore what would you recommend for a team that automates their pip installations? We set up our server using terraform, so we automatically call pip install for smart-open and boto3 and then we have numpy, scipy, boto, sklearn, and datadog in a requirements.txt. We get the distutils error for urllib3 for multiple installs (because smart-open installed it). The installs work when I use Also, is there any chance that distutils will add an uninstall feature or more metadata? Have you guys talked to that team about this? |
@ruby-is-pretty-cool I have no real opinion on that. You say of urllib3 "because smart-open installed it" but I don't see anything in smart-open that declares a dependency on urllib3, so I don't know what you mean by that. If smart-open is somehow installing urllib3 in a way that triggers this issue, that sounds like a smart-open problem.
Not that I know of, and no we haven't talked to them about it. I doubt they would, as distutils doesn't really implement new features these days (but feel free to ask if you want to). The official packaging documentation doesn't recommend using distutils directly anyway, so if projects are doing so, it's really up to them to manage the implications. |
I just tried installing smart-open. It depends on requests, which in turn depends on urllib3. That is installed properly by pip when I do the install in a virtualenv. Are you doing this installation in a system environment? In which case, are you seeing (and trying to upgrade) the system installed urllib3? If so, the normal advice "don't use pip on system packages" applies - use a virtualenv or if you need to install to your system environment use distro packages. |
I am pretty new to Python packaging, but I have a feeling that either a virtualenv or distro packages will fix our issue - I'll have to look into them more. Thank you for your help! |
This is insane. Installations are being broken because of some religion-like believing. if some setup.py entry of some package touches urllib3, then there is no way to tells it to ignore it. In our case, we must upgrade urllib3 because in Ubuntu 14 the installed version of pip (v1.5.x) refuses to install packages from https URLs. The point is that nobody would upgrade "system" packages if they would not stop working. In linux kernel project this behavior is "breaking userspace" and Torvalds does not react nicely to it. It is incredible python people takes it so naturally fine. At least you should warn people in pip messages with something like "this version of pip will refuse to work if it means to upgrade system packages, do this and do that. Use pip version 9.x if you are working with old installers or old systems." or similar. |
This comment has been minimized.
This comment has been minimized.
I agree with @pabloa - This has been going on forever now, a vanilla install of CentOS 7 cannot install And yes, @JohnBDonner, that little flag just saved me a LOT of time. THANK YOU |
pypa/pip#5247. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=216907803
This "not our problem, someone else fix it" is to be expected from pip. The software doesn't even pretend to manage package conflicts. I got this message as part of an ansible deployment of containers to many systems. Thank you for those of you who supplied workarounds. I've changed the ordering - "pip install docker" prior to "pip install --upgrade pip" - worked this time. Hopefully this won't cause problems (such as data corruption) in future. |
My reading of this is that we should be using virtual environments to protect ourselves from oddness in our environments... however, I was able to get past this for now by adding the
https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-user |
You could also try working with the exact version of the transient dependency that was installed by your environment / $ pipenv graph | egrep 'airflow|awscli|PyYAML'
apache-airflow==1.10.1
- PyYAML [required: >=3.0, installed: 3.13]
awscli==1.15.85
- PyYAML [required: >=3.10,<=3.13, installed: 3.13] A simple $ pipenv install PyYAML==3.11
Installing PyYAML==3.11…
...
Locking [packages] dependencies…
✔ Success!
$ pipenv graph | egrep 'airflow|awscli|PyYAML'
apache-airflow==1.10.1
- PyYAML [required: >=3.0, installed: 3.11]
awscli==1.15.85
- PyYAML [required: >=3.10,<=3.13, installed: 3.11] My Pipfile / Pipfile.lock subsequently installs cleanly on Ubuntu 14.04LTS using I also checked and That being said, avoid system dependencies and environmental issues at all costs. Use |
There are error installing package using pip10 because is not possible uninstall packages.
This worked well for me. But does upgrading pip after this give any problems to the installed packages?? |
@s-eswar So far, we are not found problems about the package, but maybe one situation that if use the high version of the pip install package, then use the lower version re-install or check may be occur dependency problem. I suggest that always use lower version. For instance, pip 9.0.3. |
@wangxf1987 but for using ML libraries with the same config, don't we get errors regarding upgradation/use of lower version. |
@s-eswar I am not sure ML libraries whether prefect works under lower version. I using pip=9.0.3 works will with the latest version of the Kubernetes. It's should be check the requirements file whether need to the latest version of the pip or testing in the dev env. |
I believe the part "now we report the problem to the user" is called "pushing your technological debt onto someone else". I'd like to thank everyone for bring me into the fiasco. Especially since I am not a Python dev and I have no idea how to fix it. I get to wates hours on this problem now. Hooray! |
Remove Dist Package and RUN
Removing folder from distutils works |
by upgrading to newer version it should solve the problems but pip introduces problems what a irony. |
The solution is to uninstall it manually, so go to.../anaconda3/lib/python3.*/site-packages/ and delete all files and folders of the package |
@ramonamis This successfully upgraded it for me. |
This also worked for imutils: pip install --upgrade imutils --ignore-installed imutils |
it works for me, Thanks! |
this is a bad solution. I cannot do anything now.
|
I'm locking this thread now. @pfmoore's initial comment covers everything here. The rest of this thread has divulged into support requests or straight up abuse directed at the maintainers. |
Description:
I am trying to install docker-py, it is a usual part of our infrastructure setup workflow and we run it for quite some time. I get the following error for some packages:
Everything works as expected with pip 9.0.2. Did something change? What can I do to fix this? (except pinning the version of pip to 9.0.2 or 9.0.3)
What I've run:
First installation attempt with pip 10
Downgraded to pip 9.0.3 and then got this:
I also noticed issues with installing awscli, it complains some packages are not installed. (Installing them first fixes the issue though).
If i try to forcereinstall awscli for example, I get the same error for PyYAML:
The text was updated successfully, but these errors were encountered: