Descriptionpeptdeep library command failing with error:
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
....
Traceback (most recent call last):
File "multiprocessing\pool.py", line 125, in worker
File "C:\Users\Jason\workspaces\pwiz\pwiz_tools\Skyline\bin\x64\Debug\Tools\Python\3.12.4\alphapeptdeep\Lib\site-packages\peptdeep\pretrained_models.py", line 936, in _predict_func_for_mp
return self.predict_all(
^^^^^^^^^^^^^^^^^
File "C:\Users\Jason\workspaces\pwiz\pwiz_tools\Skyline\bin\x64\Debug\Tools\Python\3.12.4\alphapeptdeep\Lib\site-packages\peptdeep\pretrained_models.py", line 1112, in predict_all
self.predict_rt(precursor_df,
File "C:\Users\Jason\workspaces\pwiz\pwiz_tools\Skyline\bin\x64\Debug\Tools\Python\3.12.4\alphapeptdeep\Lib\site-packages\peptdeep\pretrained_models.py", line 898, in predict_rt
df = self.rt_model.predict(precursor_df,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jason\workspaces\pwiz\pwiz_tools\Skyline\bin\x64\Debug\Tools\Python\3.12.4\alphapeptdeep\Lib\site-packages\peptdeep\model\model_interface.py", line 548, in predict
predicts = self._predict_one_batch(*features)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jason\workspaces\pwiz\pwiz_tools\Skyline\bin\x64\Debug\Tools\Python\3.12.4\alphapeptdeep\Lib\site-packages\peptdeep\model\model_interface.py", line 855, in _predict_one_batch
).cpu().detach().numpy()
^^^^^^^
RuntimeError: Numpy is not available
To Reproduce
Steps to reproduce the behavior:
In terminal, run pip install peptdeep
With a prepared alphapeptdeep settings.yaml file, run <path-to>\peptdeep.exe library <path-to>\settings.yaml
Workaround
Downgrading numpy to 1.26.4 gets rid of this issue. This can be considered a workaround.
Expected behavior
Successfully predict a spectral library and output a predict.speclib.hdf file.
Version (please complete the following information):
Installation Type: pip install peptdeep and pip install peptdeep[stable] has the same issue
Platform information
system Windows11
processor AMD x64
Python information:
peptdeep version: 1.2.1
numpy version: 2.0.1
torch: 2.4.0
Additional context
This issue is due to a known pytorch and numpy compatability issue: https://github.com/pytorch/pytorch/issues/107302. Specifically, the .numpy() method stopped working in pytorch (for numpy 2.0).
Although the issue claimed to have the numpy backward compatibility added after pytorch 2.2, and the issue is already closed, there are still reports of the same issue very recently (eg1, eg2). Plus there is a similar issue still open with the same failure in Windows (eg3).
As we wait for the pytorch fix, I suggest to add numpy < 2.0 to the requirement.txt file, to bake the workaround into the stable version of peptdeep package, so that users don't experience the error with the peptdeep CLI.
Yes, this is because some of dependent packages are not compiled by numpy2 yet. I have add numpy<2 in the requirement.txt in the latest development branch
Description
peptdeep library
command failing with error:To Reproduce Steps to reproduce the behavior:
pip install peptdeep
settings.yaml
file, run<path-to>\peptdeep.exe library <path-to>\settings.yaml
Workaround Downgrading
numpy
to 1.26.4 gets rid of this issue. This can be considered a workaround.Expected behavior Successfully predict a spectral library and output a
predict.speclib.hdf
file.Logs peptdeep_library.log
Version (please complete the following information):
pip install peptdeep
andpip install peptdeep[stable]
has the same issueAdditional context This issue is due to a known pytorch and numpy compatability issue: https://github.com/pytorch/pytorch/issues/107302. Specifically, the
.numpy()
method stopped working in pytorch (for numpy 2.0).Although the issue claimed to have the numpy backward compatibility added after pytorch 2.2, and the issue is already closed, there are still reports of the same issue very recently (eg1, eg2). Plus there is a similar issue still open with the same failure in Windows (eg3).
As we wait for the pytorch fix, I suggest to add
numpy < 2.0
to therequirement.txt
file, to bake the workaround into the stable version ofpeptdeep
package, so that users don't experience the error with thepeptdeep
CLI.