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
Compiling from source prints «ModuleNotFoundError: No module named 'binascii'» #90737
Comments
I compile python from source: $ python --version
Python 3.10.1+
$ cat /etc/config.site
ax_cv_c_float_words_bigendian=no
enable_silent_rules=yes
$ git describe
v3.10.2-74-ga5451c96a1
$ ./configure --enable-loadable-sqlite-extensions --disable-ipv6 --with-system-expat --with-system-libmpdec --enable-shared
$ make
gcc -c -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include -fPIC -DPy_BUILD_CORE -o Modules/_math.o Modules/_math.c
LD_LIBRARY_PATH=/git/cpython CC='gcc' LDSHARED='gcc -shared ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall' _TCLTK_INCLUDES='-I/usr/local/include' _TCLTK_LIBS='-L/usr/local/lib -ltk8.6 -ltkstub8.6 -ltcl8.6 -ltclstub8.6' ./python -E ./setup.py build
Traceback (most recent call last):
File "/git/cpython/./setup.py", line 50, in <module>
from distutils.command.install import install
File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/command/install.py", line 20, in <module>
from .. import _collections
File "/usr/local/lib/python3.10/site-packages/setuptools/__init__.py", line 16, in <module>
import setuptools.version
File "/usr/local/lib/python3.10/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 23, in <module>
import zipfile
File "/git/cpython/Lib/zipfile.py", line 6, in <module>
import binascii
ModuleNotFoundError: No module named 'binascii'
make: *** [Makefile:637: sharedmods] Error 1 When I compiled python 3.10 using python 3.8 one or two months ago, there was no such problem. Compiling python from source code, shall use the bundled distutils, not the installed one. My Linux From Scratch system appears not to have module binascii: $ locate binascii
/usr/local/lib/python3.10/lib-dynload/binascii.cpython-310-x86_64-linux-gnu.so
/usr/local/lib/python3.10/test/__pycache__/test_binascii.cpython-310.opt-1.pyc
/usr/local/lib/python3.10/test/__pycache__/test_binascii.cpython-310.opt-2.pyc
/usr/local/lib/python3.10/test/__pycache__/test_binascii.cpython-310.pyc
/usr/local/lib/python3.10/test/test_binascii.py
/usr/local/lib/python3.8/lib-dynload/binascii.cpython-38-x86_64-linux-gnu.so
/usr/local/lib/python3.8/site-packages/mypy/typeshed/stdlib/@python2/binascii.pyi
/usr/local/lib/python3.8/site-packages/mypy/typeshed/stdlib/binascii.pyi
/usr/local/lib/python3.8/test/__pycache__/test_binascii.cpython-38.opt-1.pyc
/usr/local/lib/python3.8/test/__pycache__/test_binascii.cpython-38.opt-2.pyc
/usr/local/lib/python3.8/test/__pycache__/test_binascii.cpython-38.pyc
/usr/local/lib/python3.8/test/test_binascii.py
/git/cpython/Modules/binascii.c
/git/cpython/Modules/clinic/binascii.c.h
/git/cpython/Lib/test/test_binascii.py
/git/cpython/Doc/library/binascii.rst |
You are affected by setuptools bug pypa/setuptools#3007 . The setuptools issues has a workaround. The next version of setuptools will come with a fix. |
The problem is, that Python’s install target depends on the system-wide setuptools, if there is system-wide setuptools. If there is no system-wide installed setuptools, apparently the installation works flawlessly. The solution is to tweak the source code of Python, not to depend on (system-wide installed) Python code outside of Python’s tarball. |
CPython's build system does not depend on setuptools. The problem is that setuptools 60.0 introduced a .pth file and _distutils_hack to inject itself into Python import system. Under some circumstances Python's build system is affected by the hack and breaks. |
Using system m4 and python3, and undoubtedly need a lot more tweaks to the find logic in various packages to use bundled zlib/png/etc. rather than spotting system versions, but this gets us as far as a running OSPRay example program on Ubuntu Linux. Probably will stop here for now with OSPRay, since the current focus is Appleseed, but this gives us a good idea of what supporting OSPRay will look like if and when. M4 is likely the most problematic of the ISPC dependencies to get set up as a readily buildable dependency, but Python may be more challenging than I'd like as well. I hit what appears to be this issue on Linux: python/cpython#90737 and I'm not even sure yet how to proceed with a build and install on Windows.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: