I have installed python api in my base environement (python 3.10). Everything works well. However, when I want to use it in conda environment, even though I can install python API via “get_python_api.py” in /usr/local/zed, when I import pyzed.sl, it always shows "undefined symbol:. I have tried three virtual environemnets (python 3.7, python 3.9, and python 3.10). All of them return this error. How to address this?
One thing I found is, in my pyzed package folder of the base environment, there are two files sl. xxx. so. However, in my other environment, there is only sl.cpythonxxx.so. Not sure whether this is the cause of the problem?
One thing I found is, in my pyzed package folder of the base environment, there are two files sl. xxx. so. However, in my other environment, there is only sl.cpythonxxx.so. Not sure whether this is the cause of the problem?
[Discourse post]
Hello,
If it works on your base environment, maybe the LD_LIBRARY_PATH is not set as expected for the conda environments. Can you try :
export LD_LIBRARY_PATH=/home/pc3080/anaconda3/envs/py310/lib:$LD_LIBRARY_PATH
If it does not work, we can try to force an installation in the conda environement with
conda install -c conda-forge gcc=12.1.0 && conda install -c conda-forge libstdcxx-ng=12
I hope that will solve the issue.
Stereolabs Support
Unfortunately, none of these solutions works…
Sorry to hear that.
Let’s try to make a symbolic link in your environment lib to fix the issue, as such :
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /home/pc3080/anaconda3/envs/py310/lib/libstdc++.so.6
Adapt the path to your libstdc++.so.6 if it is not in /usr/lib/x86_64-linux-gnu.
Let me know if that helps !
Stereolabs Support
Nah it does not work either, and I have checked that my virtual environment does have libstdc++.so.6
One thing I remember is, when I install zed sdk, when the system asks me whether I want to install python API, I choose yes. At that time, the python3 was in my base environment. Do you think it could be the reason for my current situation? But actually, I felt like my operation should be correct at that time…
Hi,
I don’t think so, if you ran get_python_api() in the conda environment, there should be no issue.
I have read that
conda install cmake
could help, maybe you can give it a try ?
You can also try to reinstall libgcc, I forgot to add it in my first awnser.
conda uninstall libgcc
conda install libgcc
( you can also uninstall before installing the two libraries I specified in my first awnser)
Otherwise I do not see any other solution than reinstalling conda, I do not think the SDK installation is the issue here. Let me know if that solved it !
Unfortunately, none of these solutions work… What’s worse, after I re-install zed sdk, the base environment doesn’t even work anymore…
Okay I found the reason…
The thing is, the newest zed sdk is 4.0.6, which seems updated on Aug. 10. However, my zed sdk is installed before Aug. 10. So I guess it is 4.0.5 or something. When I call get_python_api.py, it will directly fetch the .whl files from zed database. Thus, when I call it these days, it will install the python API for 4.0.6, not 4.0.5, which leads to this error
Last night when I re-installed the zed sdk, I just installed it from my cache file, not zed website, cause I was not aware that the SDK had updated. When I checked zed website today, I just realized this is the real reason.
Even though I have fixed the error, I am kinda mad about it. For users, when I install zed sdk, and call get_python_api.py from my installed sdk, I will definitely not be aware of any version mismatch issue. Recently, zed updates very frequently, which is good. But I feel like there should be some mechanism to detect such a mismatch. I hope my suggestion will help improve zed sdk. And I truly appreciate that you provide a lot of potential solutions for me. Thanks!
Hi,
Thank you for posting the solution. This is noted, I will let the team know about it.