Traceback (most recent call last):
File “c:\Program Files (x86)\ZED SDK\samples\spatial mapping\spatial mapping\python\spatial_mapping.py”, line 174, in
main()
File “c:\Program Files (x86)\ZED SDK\samples\spatial mapping\spatial mapping\python\spatial_mapping.py”, line 71, in main
viewer = gl.GLViewer()
File “c:\Program Files (x86)\ZED SDK\samples\spatial mapping\spatial mapping\python\ogl_viewer\viewer.py”, line 212, in init
self.projection = sl.Matrix4f()
AttributeError: module ‘pyzed’ has no attribute ‘Matrix4f’
I sucessfully downloaded python api,and pyzed.sl worked when I put dll files correctly. Then I run spatial mapping.py in samples, and I got this problem. Any idea for this? I didn’t changed anything from the sample code. I think its the reason why the viewer didn’t appear.
spatial_mapping.py (7.5 KB)
here is my file. i’m working in Windows 11 with python 3.10.12, Zed, and I do not know the exact version, but the first line of the zed-config-version file says the version is 4.0.5. The viewer does not appear, and since i don’t know what Matrix4f is, I can’t solve it. The depth sensing sample works well with a viewer.
If possible, can you send me the file with no error?
@skgr07 Ok, seems to be 4.0.5 then. You can check it by running a tool like ZED Explorer, it will be written at the bottom.
I was able to run your code without issues on Python 3.10, but I don’t use anaconda. Can you try running the script directly from the python executable in command line (like a powershell python.exe .\spatial_mapping.py)?
If it doesn’t work, can you try re-running the get_python_api.py script and try again?
I tried it without conda, and I got new error like this. Where is the right directory for pyopengl whl files? I think I should move it manually. the files were install in c:users, not in the right path.
It looks like the command you typed started python instead of running pip install. Can you share the exact output of the command python3 -m pip install pyopengl ?
I first use
python.exe -m pip install --force-reinstall pyzed
And I used pip to check if pyzed was installed correctly.
The pyzed package was install in the right directory.
I first use
python.exe -m pip install --force-reinstall pyzed
And I used pip to check if pyzed was installed correctly.
The pyzed package was install in the right directory.
And this is what I got.
this is pyzed package folder. Is there any files missing?
It seems that you are in a situation with pyzed installed in your conda environment python 3.10 and pyopenGL and numpy installed in your local python repertory 3.11
Can you run :
- run C:\Users\user\AppData\Local\Programs\Python\Python311>python.exe get_python_api.py
- run C:\Users\user\AppData\Local\Programs\Python\Python311>python.exe -m pip install numpy
- run C:\Users\user\AppData\Local\Programs\Python\Python311>python.exe -m pip install cython
- run the line at the end of get_python_api.py, something like python.exe -m pip install --force-reinstall pyzed-*.**.whl, with the same python.exe as the others.
- run C:\Users\user\AppData\Local\Programs\Python\Python311>python.exe -m pip install pyopengl
And then test your sample ? Please send all the logs that you get.
It should also work if you type all the commands in your conda enviroment, as long as you use the same python for all commands.
I tried force reinstall pyzed and opengl
Requirement already satisfied: pyopengl in c:\users\user\appdata\local\programs\python\python311\lib\site-packages (3.1.7)