VS Code venv pyzed.sl ModuleNotFoundError

I am not using Anaconda for this project but I have an activated venv within my VS Code project. My pip installs look like this:

(venv) PS C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024> pip list
Package Version


certifi 2024.2.2
charset-normalizer 3.3.2
Cython 3.0.8
durationpy 0.6
idna 3.6
numpy 1.26.4
opencv-python 4.9.0.80
pip 24.0
PyOpenGL 3.1.6
PyOpenGL-accelerate 3.1.6
python-dateutil 2.8.2
pyzed 1.3.0
requests 2.31.0
setuptools 58.1.0
six 1.16.0
urllib3 2.2.1
Within my Libs I have 2 folders that I can clearly see that are related to pyzed. 1. pyzed includes: sl_ai64.dll and sl_zed64.dll. 2. pyzed-1.3.0.dist-info has: INSTALLER, METADATA, RECORD, REQUESTED, top_level.txt and WHEEL. This is the error message:

(venv) PS C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024> python hello_zed.py
Traceback (most recent call last):
File “C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024\hello_zed.py”, line 23, in
import pyzed.sl as sl
ModuleNotFoundError: No module named ‘pyzed.sl’; ‘pyzed’ is not a package

Hi, you need to run the script get_python_api.py that we provide with the SDK from within your virtual env.

I created a new venv just to have a clean slate

How I run the get_python_api.py script:

(venv) PS C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024\venv> python get_python_api.py

Output after I try to run the hello_zed.py script:

PS C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024> python hello_zed.py
Traceback (most recent call last):
File “C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024\hello_zed.py”, line 21, in
import pyzed.sl as sl
ModuleNotFoundError: No module named ‘pyzed’

pip list:

contourpy 1.1.1
cycler 0.12.0
fonttools 4.43.0
kiwisolver 1.4.5
matplotlib 3.8.0
mysql-connector-python 8.0.32
numpy 1.26.0
packaging 23.1
Pillow 10.0.1
pip 24.0
pyparsing 3.1.1
python-dateutil 2.8.2
setuptools 58.1.0
six 1.16.0

Lib files:

image

Hi, the get_python_api.py script is in your ZED SDK installation folder.
Can you run

python <put here your ZED SDK installation folder>/get_python_api.py

and send me the output?

Inside venv folder:

(venv) PS C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024\venv> python “C:\Program Files (x86)\ZED SDK\get_python_api.py”
→ Downloading to ‘C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024\venv’
Detected platform:
win_amd64
Python 3.10
ZED SDK 4.0
→ Checking if https://download.stereolabs.com/zedsdk/4.0/whl/win_amd64/pyzed-4.0-cp310-cp310-win_amd64.whl exists and is available
→ Found ! Downloading python package into C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024\venv\pyzed-4.0-cp310-cp310-win_amd64.whl
→ Installing necessary dependencies
Collecting numpy
Using cached numpy-1.26.4-cp310-cp310-win_amd64.whl.metadata (61 kB)
Using cached numpy-1.26.4-cp310-cp310-win_amd64.whl (15.8 MB)
Installing collected packages: numpy
Successfully installed numpy-1.26.4
Processing c:\users\lasse\documents\stereovision\stereovisioncapstone2024\venv\pyzed-4.0-cp310-cp310-win_amd64.whl
Collecting numpy>=1.13 (from pyzed==4.0)
Using cached numpy-1.26.4-cp310-cp310-win_amd64.whl.metadata (61 kB)
Collecting cython>=3.0.0 (from pyzed==4.0)
Using cached Cython-3.0.8-cp310-cp310-win_amd64.whl.metadata (3.2 kB)
Using cached Cython-3.0.8-cp310-cp310-win_amd64.whl (2.8 MB)
Using cached numpy-1.26.4-cp310-cp310-win_amd64.whl (15.8 MB)
Installing collected packages: numpy, cython, pyzed
Successfully installed cython-3.0.8 numpy-1.26.4 pyzed-4.0
Done
Installing OpenGL dependencies required to run the samples
→ Downloading PyOpenGL-3.1.6-cp310-cp310-win_amd64.whl
Processing c:\users\lasse\documents\stereovision\stereovisioncapstone2024\venv\pyopengl-3.1.6-cp310-cp310-win_amd64.whl
Installing collected packages: PyOpenGL
Successfully installed PyOpenGL-3.1.6
→ Downloading PyOpenGL_accelerate-3.1.6-cp310-cp310-win_amd64.whl
Processing c:\users\lasse\documents\stereovision\stereovisioncapstone2024\venv\pyopengl_accelerate-3.1.6-cp310-cp310-win_amd64.whl
Installing collected packages: PyOpenGL-accelerate
Successfully installed PyOpenGL-accelerate-3.1.6
Pyzed directory is c:\users\lasse\documents\stereovision\stereovisioncapstone2024\venv\lib\site-packages
(venv) PS C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024\venv>

(venv) PS C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024> python hello_zed.py
Traceback (most recent call last):
File “C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024\hello_zed.py”, line 21, in
import pyzed.sl as sl
ImportError: DLL load failed while importing sl: Määritettyä osaa ei löydy.
(venv) PS C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024>

Inside workspace:

(venv) PS C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024> python “C:\Program Files (x86)\ZED SDK\get_python_api.py”
→ Downloading to ‘C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024’
Detected platform:
win_amd64
Python 3.10
ZED SDK 4.0
→ Checking if https://download.stereolabs.com/zedsdk/4.0/whl/win_amd64/pyzed-4.0-cp310-cp310-win_amd64.whl exists and is available
→ Found ! Downloading python package into C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024\pyzed-4.0-cp310-cp310-win_amd64.whl
→ Installing necessary dependencies
Collecting numpy
Using cached numpy-1.26.4-cp310-cp310-win_amd64.whl (15.8 MB)
Installing collected packages: numpy
Successfully installed numpy-1.26.4
Processing c:\users\lasse\documents\stereovision\stereovisioncapstone2024\pyzed-4.0-cp310-cp310-win_amd64.whl
Collecting numpy>=1.13
Using cached numpy-1.26.4-cp310-cp310-win_amd64.whl (15.8 MB)
Collecting cython>=3.0.0
Using cached Cython-3.0.8-cp310-cp310-win_amd64.whl (2.8 MB)
Installing collected packages: numpy, cython, pyzed
Successfully installed cython-3.0.8 numpy-1.26.4 pyzed-4.0
Done
Installing OpenGL dependencies required to run the samples
→ Downloading PyOpenGL-3.1.6-cp310-cp310-win_amd64.whl
Processing c:\users\lasse\documents\stereovision\stereovisioncapstone2024\pyopengl-3.1.6-cp310-cp310-win_amd64.whl
Installing collected packages: PyOpenGL
Successfully installed PyOpenGL-3.1.6
→ Downloading PyOpenGL_accelerate-3.1.6-cp310-cp310-win_amd64.whl
Processing c:\users\lasse\documents\stereovision\stereovisioncapstone2024\pyopengl_accelerate-3.1.6-cp310-cp310-win_amd64.whl
Installing collected packages: PyOpenGL-accelerate
Successfully installed PyOpenGL-accelerate-3.1.6
Pyzed directory is c:\users\lasse\documents\stereovision\stereovisioncapstone2024\venv\lib\site-packages

(venv) PS C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024> python hello_zed.py
Traceback (most recent call last):
File “C:\Users\lasse\Documents\StereoVision\StereoVisionCapstone2024\hello_zed.py”, line 21, in
import pyzed.sl as sl
ImportError: DLL load failed while importing sl: Määritettyä osaa ei löydy.

Hi @Lazarus,

From this link : python - ImportError: DLL load failed: The specified module could not be found - Stack Overflow
Can you run

dumpbin /dependents

It will help you find out what DLL the pyzed module is trying to find. Then, you can find out exactly which one it can find, and which one it cannot.
Finally, you can add to your PATH the folder that is missing, or copy the DLLs into pyzed’s folder.