I’m new to the ZED 2 camera. I ran to the similar problem as a couple other posts, which results in the error ModuleNotFoundError: No module named 'pyzed.sl'; 'pyzed' is not a package when running the example script. Though I tried to fix the problem, I wasn’t able to resolve it.
ZED SDK: 3.8
I am running the example in a virtual environment (yes I installed it in the virtual environment and yes it is activated), following your guide to set it up.
I ran the get_python_api.py script which results in the following output:
-> Downloading to 'C:\Program Files (x86)\ZED SDK'
ZED SDK 3.8
-> Checking if https://download.stereolabs.com/zedsdk/3.8/whl/win_amd64/pyzed-3.8-cp38-cp38-win_amd64.whl exists and is available
-> Found ! Downloading python package into C:\Program Files (x86)\ZED SDK\pyzed-3.8-cp38-cp38-win_amd64.whl
-> Installing necessary dependencies
Requirement already satisfied: numpy in c:\users\usr\anaconda3\envs\zed_env\env\lib\site-packages (1.24.3)
Processing c:\program files (x86)\zed sdk\pyzed-3.8-cp38-cp38-win_amd64.whl
Collecting numpy>=1.13 (from pyzed==3.8)
Using cached numpy-1.24.3-cp38-cp38-win_amd64.whl (14.9 MB)
Collecting cython>=0.28 (from pyzed==3.8)
Using cached Cython-0.29.34-py2.py3-none-any.whl (988 kB)
Installing collected packages: numpy, cython, pyzed
Successfully installed cython-0.29.34 numpy-1.24.3 pyzed-3.8
Installing OpenGL dependencies required to run the samples
-> Downloading PyOpenGL-3.1.5-cp38-cp38-win_amd64.whl
Processing c:\program files (x86)\zed sdk\pyopengl-3.1.5-cp38-cp38-win_amd64.whl
PyOpenGL is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
-> Downloading PyOpenGL_accelerate-3.1.5-cp38-cp38-win_amd64.whl
Processing c:\program files (x86)\zed sdk\pyopengl_accelerate-3.1.5-cp38-cp38-win_amd64.whl
PyOpenGL-accelerate is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
Pyzed directory is c:\users\usr\anaconda3\envs\zed_env\env\lib\site-packages
If I check the pyzed version i get the following output:
Summary: Use the ZED SDK with Python
Requires: cython, numpy
But if I look in the Anaconda Navigator for the packages in the virtual environment it won’t show up.
If I run the example script it produces the following error:
ModuleNotFoundError: No module named 'pyzed.sl'; 'pyzed' is not a package
It seems you know how to work with virtual envs, but it’s probably a virtual env issue. Are you use you are running the tutorial script in the same virtual env than you ran get_python_api.py ? Can you send the exact command line you send ?
Are you using python3 and not python (which is python2) ?
what if, outside of your jupyter notebook, right after cd C:\Program Files (x86)\ZED SDK, you run python3 -m pip show pyzed
and then, still in the same console, you run one of our tutorials with python3 <path-to-tutorial-1>/hello.py?
This error is actually quite different than Module not found. It finds the python module correctly, but fails to find some dependencies it has. It’s kind of typical these days when using virtual environment on windows, unfortunately.
The first step is indeed to copy the dlls from ZED SDK : sl_zed.dll and sl_ai.dll into the pyzed folder.
If that’s not enough, you can download a dependency walker tool (like this one) and use it on the pyzediot module (which is in the pyzed folder, and is named something like sl.cpython-310-x86_64-linux-gnu.xx)
Usually, what’s missing is from nvidia, for example nvencodeapi.dll, this kind of stuff.