openslide / openslide-python

Python bindings to OpenSlide
https://openslide.org/
GNU Lesser General Public License v2.1
374 stars 183 forks source link

/lib/x86_64-linux-gnu/libgobject-2.0.so.0: undefined symbol: ffi_type_uint32, version LIBFFI_BASE_7.0 #194

Closed shenxiaochenn closed 1 year ago

shenxiaochenn commented 1 year ago

Operating system

Ubentu

Platform

x86_64-linux

OpenSlide Python version

None

OpenSlide version

None

Slide format

None

Issue details

import openslide
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/hpcstack/anaconda3/envs/py39/lib/python3.9/site-packages/openslide/__init__.py", line 30, in <module>
    from openslide import lowlevel
  File "/home/hpcstack/anaconda3/envs/py39/lib/python3.9/site-packages/openslide/lowlevel.py", line 84, in <module>
    _lib = cdll.LoadLibrary('libopenslide.so.0')
  File "/home/hpcstack/anaconda3/envs/py39/lib/python3.9/ctypes/__init__.py", line 460, in LoadLibrary
    return self._dlltype(name)
  File "/home/hpcstack/anaconda3/envs/py39/lib/python3.9/ctypes/__init__.py", line 382, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /lib/x86_64-linux-gnu/libgobject-2.0.so.0: undefined symbol: ffi_type_uint32, version LIBFFI_BASE_7.0

I do not know hot to solve this. Can you help me?? thanks

bgilbert commented 1 year ago

You haven't mentioned the versions of Ubuntu, OpenSlide, and OpenSlide Python you're using. However, it seems likely that you're using some shared libraries from Anaconda and some from Ubuntu, and they're not compatible. You should get OpenSlide and its dependencies either entirely from Ubuntu or entirely from Anaconda.

YoihenBachu commented 1 year ago

export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libffi.so.7

just run this command in your Ubuntu terminal before running the code that uses the openslide and it works like magic. I was having issue with the same error in WSL environment with Ubuntu-20.04.

Note that it doesn't fix the issue permanently and importing openslide in VS-Code Jupyter notebook is still not working. Will give the updates if issue is fixed. Thank you