toxinpred3 icon indicating copy to clipboard operation
toxinpred3 copied to clipboard

Cannot run model

Open lukaas33 opened this issue 6 months ago • 1 comments

Hi, I cannot run the model on an example input by the instructions provided in the readme.

Installation: Python 3,10 in Docker with the following dependencies: toxinpred3 scikit-learn==1.0.2 pandas numpy

Example input (irrelevant because it doesn't reach this point):

>example_protein
MKTAYIAKQRQISFVKSHFSRQDILDLWIYHTQGYFPDWQNYTPGPGIRYPLKF
>second_protein
GAVLILKKKGHHEAELKPLAQSHATKHKIPIKYLEFISEAIIHVLHSRHPGDFGADA

Command toxinpred3 -i input.fa

Error

Traceback (most recent call last):
  File "/usr/local/bin/toxinpred3", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/toxinpred3/python_scripts/toxinpred3.py", line 364, in main    
    prediction('seq.aac', 'seq.dpc', nf_path+'/../model/toxinpred3.0_model.pkl','seq.pred')
  File "/usr/local/lib/python3.10/site-packages/toxinpred3/python_scripts/toxinpred3.py", line 81, in prediction
    clf = joblib.load(file_name2)
  File "/usr/local/lib/python3.10/site-packages/joblib/numpy_pickle.py", line 749, in load
    obj = _unpickle(
  File "/usr/local/lib/python3.10/site-packages/joblib/numpy_pickle.py", line 626, in _unpickle
    obj = unpickler.load()
  File "/usr/local/lib/python3.10/pickle.py", line 1213, in load
    dispatch[key[0]](self)
  File "/usr/local/lib/python3.10/pickle.py", line 1538, in load_stack_global
    self.append(self.find_class(module, name))
  File "/usr/local/lib/python3.10/pickle.py", line 1580, in find_class
    __import__(module, level=0)
  File "/usr/local/lib/python3.10/site-packages/sklearn/__init__.py", line 82, in <module>
    from .base import clone
  File "/usr/local/lib/python3.10/site-packages/sklearn/base.py", line 17, in <module>
    from .utils import _IS_32BIT
  File "/usr/local/lib/python3.10/site-packages/sklearn/utils/__init__.py", line 23, in <module>
    from .murmurhash import murmurhash3_32
  File "sklearn/utils/murmurhash.pyx", line 1, in init sklearn.utils.murmurhash
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 fr

lukaas33 avatar Oct 09 '25 13:10 lukaas33

I think the issue is caused by an incompatibility between numpy and scikit-learn. I was able to solve the issue by pinning numpy to an older version (1.21.6). I suggest that this is also done in the package because normal install is now broken or that the documentation is updated.

lukaas33 avatar Oct 10 '25 13:10 lukaas33