Kukuster/SumStatsRehab

AttributeError: /usr/lib64/libmagic.so.1: undefined symbol: magic_list

jingydz opened this issue · 1 comments

##Comman
git clone https://github.com/Kukuster/SumStatsRehab.git && cd SumStatsRehab
pip install -r requirements.txt
python3 setup.py build
python3 setup.py install
SumStatsRehab --help

##Bug
SumStatsRehab]$ SumStatsRehab --help
Traceback (most recent call last):
File "/xxx/software/miniconda3/bin/SumStatsRehab", line 33, in
sys.exit(load_entry_point('SumStatsRehab==1.2.1', 'console_scripts', 'SumStatsRehab')())
File "/xxx/software/miniconda3/bin/SumStatsRehab", line 25, in importlib_load_entry_point
return next(matches).load()
File "/xxx/software/miniconda3/lib/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/xxx/software/miniconda3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/xxx/software/miniconda3/lib/python3.9/site-packages/SumStatsRehab-1.2.1-py3.9.egg/SumStatsRehab.py", line 14, in
from lib.prepare_GWASSS_columns import prepare_GWASSS_columns
File "/xxx/software/miniconda3/lib/python3.9/site-packages/SumStatsRehab-1.2.1-py3.9.egg/lib/prepare_GWASSS_columns.py", line 10, in
from lib.file import resolve_bare_text_file
File "/xxx/software/miniconda3/lib/python3.9/site-packages/SumStatsRehab-1.2.1-py3.9.egg/lib/file.py", line 10, in
import magic
File "/xxx/software/miniconda3/lib/python3.9/site-packages/magic/init.py", line 452, in
_add_compat(globals())
File "/xxx/software/miniconda3/lib/python3.9/site-packages/magic/init.py", line 416, in _add_compat
from magic import compat
File "/xxx/software/miniconda3/lib/python3.9/site-packages/magic/compat.py", line 98, in
_list = _libraries['magic'].magic_list
File "/xxx/software/miniconda3/lib/python3.9/ctypes/init.py", line 395, in getattr
func = self.getitem(name)
File "/xxx/software/miniconda3/lib/python3.9/ctypes/init.py", line 400, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib64/libmagic.so.1: undefined symbol: magic_list

I reproduced the issue on fresh Ubuntu 20.04.1 Docker image, with miniconda 24.3.0, python 3.10.12.

We will have to make an update. But for now, I recommend the following steps to fix your issue:

1) Manually change the requirements for scipy version in both requirements.txt and setup.py files

from: scipy==1.6.1
to: scipy==1.10.1

2) Install system package libmagic and/or reinstall python package python-magic. Depending on your system [R], run:

Debian-based Linux

pip uninstall python-magic
apt install libmagic1 -y
pip install -r requirements.txt # will reinstall python-magic and scipy 

MacOS

pip uninstall python-magic
brew install libmagic
pip install -r requirements.txt # will reinstall python-magic and scipy 

Windows

pip uninstall python-magic
pip install -r requirements.txt # will reinstall python-magic and scipy 
pip install python-magic-bin

3) Reinstall SumStatsRehab:

python3 setup.py build
python3 setup.py install

After this SumStatsRehab --help should work.

scipy update will not affect the functionality: we rely only on normal distribution (scipy.stats.norm), and it was not changed between these versions according to the scipy release notes.