Skip to content
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

pip issues using 3.7.6 build #30

Closed
mnsanandres opened this issue Feb 18, 2020 · 8 comments
Closed

pip issues using 3.7.6 build #30

mnsanandres opened this issue Feb 18, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@mnsanandres
Copy link

Initial tests with the python interpreter looks OK but for some reason, pip doesn't seem to work:

[root@bfat3-fedora-1 bin]# ./pip3 install distro
-bash: ./pip3: /build/out/python/install/bin/python3: bad interpreter: No such file or directory
[root@bfat3-fedora-1 bin]# ./python3 -m pip install distro
ERROR: Could not install packages due to an EnvironmentError: Dynamic loading not supported

I'm not sure why the absolute path of I suppose the original build location is referenced.

@indygreg
Copy link
Collaborator

Is this a regression?

@mnsanandres
Copy link
Author

mnsanandres commented Feb 18, 2020

Not sure by that but what I did is download the latest from https://github.com/indygreg/python-build-standalone/releases/tag/20200216, extract the contents and run pip from there.

Specifically, I used cpython-3.7.6-linux64-musl-20200216T2355.tar.zst.

@indygreg
Copy link
Collaborator

Are you running the musl distribution? I would only expect Dynamic loading not supported to fail in a fully statically linked binary. Assuming yes, the question then becomes: what is attempting to load a shared library when running pip install?

FWIW lots of code in Python assumes Python is built in a very specific way and that a libpython exists. The statically linked builds that python-build-standalone produces invalidate these assumptions. I've had to employ various patches to various components to get CPython to work in a statically linked environment. It is a royal pain to support and I wouldn't at all be surprised if something regressed in Python 3.7.6 or in a newer version of pip.

@mnsanandres
Copy link
Author

mnsanandres commented Feb 18, 2020

Yes I am using the musl distribution. Running pip in verbose gives me:

There was an error checking the latest version of pip
Traceback (most recent call last):
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_internal/self_outdated_check.py", line 207, in pip_self_version_check
    best_candidate = finder.find_best_candidate("pip").best_candidate
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_internal/index/package_finder.py", line 881, in find_best_candidate
    candidates = self.find_all_candidates(project_name)
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_internal/index/package_finder.py", line 826, in find_all_candidates
    project_url, link_evaluator=link_evaluator,
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_internal/index/package_finder.py", line 799, in process_project_url
    links=page_links,
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_internal/index/package_finder.py", line 779, in evaluate_links
    candidate = self.get_install_candidate(link_evaluator, link)
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_internal/index/package_finder.py", line 758, in get_install_candidate
    is_candidate, result = link_evaluator.evaluate_link(link)
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_internal/index/package_finder.py", line 195, in evaluate_link
    supported_tags = self._target_python.get_tags()
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_internal/models/target_python.py", line 103, in get_tags
    impl=self.implementation,
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_internal/pep425tags.py", line 148, in get_supported
    platforms=platforms,
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_vendor/packaging/tags.py", line 242, in cpython_tags
    platforms = list(platforms or _platform_tags())
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_vendor/packaging/tags.py", line 657, in _linux_platforms
    if _is_manylinux_compatible(name, glibc_version):
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_vendor/packaging/tags.py", line 422, in _is_manylinux_compatible
    return _have_compatible_glibc(*glibc_version)
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_vendor/packaging/tags.py", line 512, in _have_compatible_glibc
    version_str = _glibc_version_string()
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_vendor/packaging/tags.py", line 428, in _glibc_version_string
    return _glibc_version_string_confstr() or _glibc_version_string_ctypes()
  File "/opt/python/install/lib/python3.7/site-packages/pip-20.0.2-py3.7.egg/pip/_vendor/packaging/tags.py", line 469, in _glibc_version_string_ctypes
    process_namespace = ctypes.CDLL(None)  # type: ignore
  File "/opt/python/install/lib/python3.7/ctypes/__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: Dynamic loading not supported

Not sure what specific library is being loaded but I'll see if I can trace that.

@indygreg indygreg added the bug Something isn't working label Feb 18, 2020
@indygreg
Copy link
Collaborator

Thanks for the stack trace. This code looks very similar to other code I'm having to patch to work around ctypes usage. I think I fixed one call site in the upgraded setuptools but missed this one. This is definitely a regression from the pip 20.0.2 upgrade in the latest release...

Oh, the bugs you find when you are building Python differently from the rest of the world...

@mnsanandres
Copy link
Author

Glad to share. But going to back to first command execution:

[root@bfat3-fedora-1 bin]# ./pip3 install distro
-bash: ./pip3: /build/out/python/install/bin/python3: bad interpreter: No such file or directory

Any idea why that /build/out/... is used when running the pip3 binary (instead of running it as module)?

indygreg added a commit to indygreg/PyOxidizer that referenced this issue Feb 18, 2020
@mnsanandres
Copy link
Author

Thank you for the fast release, I can confirm that it now works. Any thoughts on my last question though?

@mnsanandres
Copy link
Author

Upon inspection of the pip "binary", it looks like it is just a python script with no extension. Changing the path for python in shebang line would fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants