sr99622 / libonvif

Onvif library with GUI implementation and built in YOLOX
GNU Lesser General Public License v2.1
139 stars 38 forks source link

onvif-gui fails with undefined symbol: _Py_RefTotal #92

Open rogerjames99 opened 1 month ago

rogerjames99 commented 1 month ago

onvif-gui fails with the following stack trace.

roger@dragon:~$ onvif-gui
Traceback (most recent call last):
  File "/home/roger/.local/bin/onvif-gui", line 5, in <module>
    from gui.main import run
  File "/home/roger/.local/lib/python3.10/site-packages/gui/__init__.py", line 1, in <module>
    from .main import MainWindow
  File "/home/roger/.local/lib/python3.10/site-packages/gui/main.py", line 42, in <module>
    from gui.panels import CameraPanel, FilePanel, SettingsPanel, VideoPanel, AudioPanel
  File "/home/roger/.local/lib/python3.10/site-packages/gui/panels/__init__.py", line 1, in <module>
    from .camerapanel import CameraPanel
  File "/home/roger/.local/lib/python3.10/site-packages/gui/panels/camerapanel.py", line 26, in <module>
    from gui.onvif import NetworkTab, ImageTab, VideoTab, PTZTab, SystemTab, LoginDialog, \
  File "/home/roger/.local/lib/python3.10/site-packages/gui/onvif/__init__.py", line 7, in <module>
    from .datastructures import Session, StreamState, MediaSource, Camera
  File "/home/roger/.local/lib/python3.10/site-packages/gui/onvif/datastructures.py", line 25, in <module>
    import libonvif as onvif
  File "/home/roger/.local/lib/python3.10/site-packages/libonvif/__init__.py", line 19, in <module>
    sys.modules[name] = importlib.util.module_from_spec(spec)
ImportError: /home/roger/.local/lib/python3.10/site-packages/libonvif/libonvif.cpython-36dm-x86_64-linux-gnu.so: undefined symbol: _Py_RefTotal
roger@dragon:~$

I get this error with the snap version and a source build.

I am running Ubuntu 22.04-3.

Any help gratefully received!

sr99622 commented 1 month ago

Hi Roger, thank you for reaching out, the feedback is greatly appreciated.

My best guess based on the messages from the stack trace would be that there is a mismatch between the python version under which the application was compiled and the python version under which it is trying to run.

From the stack trace, it looks like the application is trying to use the python library installed in .local, which would be different than the standard location, which is usually /usr for Ubuntu 22.04. If a virtual environment was used during installation, that would have the python installation in the environment directory, e.g. /home/roger/myenv. There is a command that can be used to help sort this out which python3 that should respond with the location of the python executable being used in the current environment, giving a general idea of where the location is.

Generally, it is recommended to install onvif-gui using a virtual environment. This may have been done during installation. It is then necessary to remain in that virtual environment, or re-start it, in order to launch the application. If the terminal was closed and re-opened, it is necessary to re-start the virtual environment, e.g. source myenv/bin/activate, where myenv is the location of the virtual environment. If the virtual environment is activated, the command prompt in terminal will show a (myenv) prepended.

If you can try activating the virtual environment described in the installation instructions, that may clear up the issue. If not, I would suggest creating one and installing from source, preserving the compiler output messages from step 4 of the Install From Source instructions. Those messages will provide more detailed information that could be used to further troubleshoot if necessary.

Best Regards,

Stephen