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

Compiling from source prints «ModuleNotFoundError: No module named 'binascii'» #90737

Closed
dilyanpalauzov mannequin opened this issue Jan 30, 2022 · 4 comments
Closed
Labels
3.10 only security fixes build The build process and cross-build topic-installation

Comments

@dilyanpalauzov
Copy link
Mannequin

dilyanpalauzov mannequin commented Jan 30, 2022

BPO 46579
Nosy @tiran

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:

assignee = None
closed_at = <Date 2022-01-30.11:02:51.017>
created_at = <Date 2022-01-30.08:52:22.713>
labels = ['build', 'expert-installation', '3.10']
title = "Compiling from source prints \xc2\xabModuleNotFoundError: No module named 'binascii'\xc2\xbb"
updated_at = <Date 2022-01-30.13:10:09.856>
user = 'https://bugs.python.org/dilyanpalauzov'

bugs.python.org fields:

activity = <Date 2022-01-30.13:10:09.856>
actor = 'christian.heimes'
assignee = 'none'
closed = True
closed_date = <Date 2022-01-30.11:02:51.017>
closer = 'christian.heimes'
components = ['Installation']
creation = <Date 2022-01-30.08:52:22.713>
creator = 'dilyan.palauzov'
dependencies = []
files = []
hgrepos = []
issue_num = 46579
keywords = []
message_count = 4.0
messages = ['412134', '412138', '412142', '412143']
nosy_count = 2.0
nosy_names = ['christian.heimes', 'dilyan.palauzov']
pr_nums = []
priority = 'normal'
resolution = 'third party'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'compile error'
url = 'https://bugs.python.org/issue46579'
versions = ['Python 3.10']

@dilyanpalauzov
Copy link
Mannequin Author

dilyanpalauzov mannequin commented Jan 30, 2022

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

@dilyanpalauzov dilyanpalauzov mannequin added 3.10 only security fixes topic-installation build The build process and cross-build labels Jan 30, 2022
@tiran
Copy link
Member

tiran commented Jan 30, 2022

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.

@tiran tiran closed this as completed Jan 30, 2022
@tiran tiran closed this as completed Jan 30, 2022
@dilyanpalauzov
Copy link
Mannequin Author

dilyanpalauzov mannequin commented Jan 30, 2022

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.

@tiran
Copy link
Member

tiran commented Jan 30, 2022

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
starseeker added a commit to starseeker/brlcad_externals that referenced this issue Sep 15, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.10 only security fixes build The build process and cross-build topic-installation
Projects
None yet
Development

No branches or pull requests

1 participant