pAPRika
pAPRika copied to clipboard
Numpy Error in Tutorial
We are running into a problem doing the analysis portion of the tutorial. Up until analysis everything works fine but we are getting the following error:
Traceback (most recent call last):
File "/gpfs/fs2/scratch/erobin20/paprika_tutorial/paprikaTutorial.py", line 315, in <module>
free_energy.compute_free_energy()
File "/home/erobin20/miniconda3/envs/paprika/lib/python3.11/site-packages/paprika/analysis.py", line 1219, in compute_free_energy
self.run_ti(phase, prepared_data, method)
File "/home/erobin20/miniconda3/envs/paprika/lib/python3.11/site-packages/paprika/analysis.py", line 965, in run_ti
[np.max(force_constants[r]).magnitude for r in range(len(active_rest))]
File "/home/erobin20/miniconda3/envs/paprika/lib/python3.11/site-packages/paprika/analysis.py", line 965, in <listcomp>
[np.max(force_constants[r]).magnitude for r in range(len(active_rest))]
^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: no implementation found for 'numpy.max' on types that implement __array_function__: [<class 'openff.units.units.Quantity'>]
I'm not sure if it is relevant but we also saw this warning:
2023-12-05 11:09:39 PM Running production in window p016...
2023-12-05 11:09:45 PM Running production in window p017...
/home/erobin20/miniconda3/envs/paprika/lib/python3.11/site-packages/paprika/analysis.py:649: UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
data_points = [len(np.asarray(x).T) for x in self.simulation_data[phase]]
There are [15, 18, 0] windows in this attach-pull-release calculation.
In window p000 we will translate the guest 0.0 angstrom.
In window p001 we will translate the guest 1.1 angstrom
This was run using a fresh Conda install of pAPRika, with Python 3.11.6, Numpy 1.26.0, openff-units 0.1.8, and paprika 1.2.0.
Any help you can provide would be greatly appreciated.
Best, Emily Robinson
Hi Emily,
Try changing line 965 of the file /home/erobin20/miniconda3/envs/paprika/lib/python3.11/site-packages/paprika/analysis.py to the following:
[np.max([rest.magnitude for rest in force_constants[r]]) for r in range(len(active_rest))]
Please let me know whether or not that solves this issue. Thanks for reporting this!
@jaketanderson, good catch! Do we need to apply a PR to patch the code and/or pin certain libraries to a particular version?
@enrobinson did the above solution work for you?
That change did solve the issue, thank you so much for your help!
i would just like to add that i came here because the current conda package does not contain this patch.
First time installation today in a new environment through conda-forge and i got the exact same issue, which was solved with the proposed patch.
Kind regards
Charles-Alexandre
@jeff231li @jaketanderson is anyone up for releasing a new version?
@slochower I'm interested in learning how to cut a release. @j-wags actually brought this up to Jeff and I, and Jeff raised a concern that pAPRika in its current form may break the paprika module inside evaluator. I think I ought to do more homework and look at what possible (or definite) conflicts exist. Do you have an idea about what changes may break the paprika-testing or paprika-latest-features branches in evaluator?
@mattwthompson and I would be happy to help get @jaketanderson up to speed on devops practices and releases, but we don't have the bandwidth right now to coordinate API changes or interface breaks. I'm also seeing that the interface code in openff-evaluator hasn't been meaningfully changed in 4 years so it'd be good to have a once-over by a maintainer to reaffirm it's ready for use.
To make a release here simpler, how about we temporarily remove Evaluator's pAPRika interface? Then Matt and I can help @jaketanderson get up to speed on general software dev and maintenance without the overhead of updating the interface in another package. Then once things seem to be in good shape Jake can re-add the evaluator-pAPRika interface.
@jaketanderson I think it's okay to cut a new release with updated dependencies and remove the pAPRika module from Evaluator for now. I can help you resolve the conflicts in Evaluator with the updated pAPRika package, and then we can re-add pAPRika to Evaluator. I'll leave the decision up to you since you are the main user of pAPRika and the host-guest binding module in Evaluator, and I support whatever decision you make.
@jeff231li That plan sounds good, I say let's go for it. I scheduled a meeting with Jeff W. to learn the ropes regarding releasing new package versions. After that I should be good to go.