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

Python3 module not found: 'zlib' #68

Open
PPPPierre opened this issue Jul 31, 2023 · 1 comment
Open

Python3 module not found: 'zlib' #68

PPPPierre opened this issue Jul 31, 2023 · 1 comment

Comments

@PPPPierre
Copy link

PPPPierre commented Jul 31, 2023

I first found this problem when I compiled a image for my project where need 'requests' module for python.
I chose python-requests in make buildroot_rootfs-menuconfig then compile the image based on the steps shown in readme.
Finally I entered the system but I failed in running python import requests. It returned an error as followed:

>>>import requests
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.9/site-packages/requests/init.py", line 43, in
File "/usr/lib/python3.9/site-packages/urllib3/init.py", line 13, in
File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 40, in
File "/usr/lib/python3.9/site-packages/urllib3/response.py", line 5, in
ModuleNotFoundError: No module named 'zlib'

Then I tried to import directly zlib, it gave me this:

>>>import zlib
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'zlib'

The same problem is found with tagv3.1.5
The information about this problem is very rare on the internet, the closest one that I found is this.
It seems the cross-compile tool-chain didnt well compiled libz during the compilation.

Can you fix this problem, thx !

@andyhu-stf
Copy link
Collaborator

andyhu-stf commented Aug 7, 2023

Hi PPPierre, please select BR2_PACKAGE_PYTHON_REQUESTS and BR2_PACKAGE_PYTHON3_ZLIB through make buildroot_initramfs-menuconfig or make buildroot_rootfs-menuconfig , then build SDK again. It work well on my board.

if you do not want to build the work/ again, you can try:
e.g. for buildroot_initramfs:

make -C ./work/buildroot_initramfs/ O=./work/buildroot_initramfs python3-dirclean  # (For BR2_PACKAGE_PYTHON3_ZLIB is in python3)
rm work/buildroot_initramfs/images/rootfs.tar
make -jx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants