-
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
Directory not empty: 'urllib3' when upgrading pip #11368
Comments
The Dockerfile works for me
|
@uranusjr came here because I have a bunch of GHA builds failing with similar issues. I have created a reproducer at https://github.com/abn/reproducer-pip-11368 See https://github.com/abn/reproducer-pip-11368/runs/8042452418?check_suite_focus=true#step:3:71 for the specific failure. This has been happening on multiple projects. The weird part is that the builds work fine locally. Additional point of note here is that in my case the builds are done using |
Verbose Log
Created temporary directory: /tmp/pip-unpack-suo34b4g
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 22.0.4
Uninstalling pip-22.0.4:
Created temporary directory: /tmp/pip-uninstall-nqm3v44c
Removing file or directory /usr/local/bin/pip
Removing file or directory /usr/local/bin/pip3
Removing file or directory /usr/local/bin/pip3.10
Created temporary directory: /usr/local/lib/python3.10/site-packages/~ip-22.0.4.dist-info
Removing file or directory /usr/local/lib/python3.10/site-packages/pip-22.0.4.dist-info/
Created temporary directory: /usr/local/lib/python3.10/site-packages/~ip
ERROR: Could not install packages due to an OSError.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/shutil.py", line 815, in move
os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/usr/local/lib/python3.10/site-packages/pip/' -> '/usr/local/lib/python3.10/site-packages/~ip'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 405, in run
installed = install_given_reqs(
File "/usr/local/lib/python3.10/site-packages/pip/_internal/req/__init__.py", line 68, in install_given_reqs
uninstalled_pathset = requirement.uninstall(auto_confirm=True)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/req/req_install.py", line 638, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/req/req_uninstall.py", line 369, in remove
moved.stash(path)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/req/req_uninstall.py", line 267, in stash
renames(path, new_path)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/utils/misc.py", line 305, in renames
shutil.move(old, new)
File "/usr/local/lib/python3.10/shutil.py", line 833, in move
rmtree(src)
File "/usr/local/lib/python3.10/shutil.py", line 724, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/local/lib/python3.10/shutil.py", line 657, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/local/lib/python3.10/shutil.py", line 663, in _rmtree_safe_fd
onerror(os.rmdir, fullname, sys.exc_info())
File "/usr/local/lib/python3.10/shutil.py", line 661, in _rmtree_safe_fd
os.rmdir(entry.name, dir_fd=topfd)
OSError: [Errno 39] Directory not empty: 'urllib3'
1 location(s) to search for versions of pip:
* https://pypi.org/simple/pip/
Fetching project page and analyzing links: https://pypi.org/simple/pip/
Getting page https://pypi.org/simple/pip/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/pip/" in the cache
Request header has "max_age" as 0, cache bypassed
There was an error checking the latest version of pip
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pip/_internal/self_outdated_check.py", line 148, in pip_self_version_check
best_candidate = finder.find_best_candidate("pip").best_candidate
File "/usr/local/lib/python3.10/site-packages/pip/_internal/index/package_finder.py", line 868, in find_best_candidate
candidates = self.find_all_candidates(project_name)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/index/package_finder.py", line 809, in find_all_candidates
page_candidates = list(page_candidates_it)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/index/sources.py", line 134, in page_candidates
yield from self._candidates_from_page(self._link)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/index/package_finder.py", line 769, in process_project_url
html_page = self._link_collector.fetch_page(project_url)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/index/collector.py", line 566, in fetch_page
return _get_html_page(location, session=self.session)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/index/collector.py", line 471, in _get_html_page
resp = _get_html_response(url, session=session)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/index/collector.py", line 123, in _get_html_response
resp = session.get(
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py", line 542, in get
File "/usr/local/lib/python3.10/site-packages/pip/_internal/network/session.py", line 454, in request
return super().request(method, url, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py", line 529, in request
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py", line 645, in send
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/cachecontrol/adapter.py", line 57, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/requests/adapters.py", line 417, in send
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/requests/adapters.py", line 228, in cert_verify
OSError: Could not find a suitable TLS CA certificate bundle, invalid path: /usr/local/lib/python3.10/site-packages/pip/_vendor/certifi/cacert.pem |
Looks like issue might have to do with That issue also references #103. |
I can confirm that the workaround specified in the with:
...
extra-args: |
--storage-opt=overlay.mount_program= |
pip just uses standard Python functions to interact with the filesystem. So does it imply this is a CPython bug? |
Welp, I missed the question. Just checked the build without the mitigation, and it seems it just "works" now (see https://github.com/abn/reproducer-pip-11368/actions/runs/4957985233/jobs/8870312079). No idea if the root cause somehow got fixed somewhere else or if GH just updated their environments. But for now, I cannot seem to reproduce the issue anymore. |
Combining with how the Dockerfile seems to reproduce only on certain environments (the OP’s but not mine), I wonder whether it may actually be a bug in the container layer (GHA also uses containers for their jobs) that is since fixed. In any case I’ll close this for now since there’s nothing further we can do. A new issue can always be opened if a similar issue pops up again. |
Description
When trying to upgrade pip from 22.0.4 to 22.2.2 on debian, I get the following error during the upgrade process
afterwards pip binary (
/usr/local/bin/pip
) does not exist anymoreAnother user online seems to have faced the same issue on alpine (for the same pip versions): https://stackoverflow.com/questions/73084494/pip-upgrading-within-the-python-alpine-image-error-could-not-install-packages
Expected behavior
Upgrade does not fail and I can use pip afterwards
pip version
22.0.4
Python version
3.10.5
OS
Debian
How to Reproduce
Using docker (for example):
Output
Code of Conduct
The text was updated successfully, but these errors were encountered: