FreshAirTonight / af2complex

Predicting direct protein-protein interactions with AlphaFold deep learning neural network models.
146 stars 19 forks source link

'scipy' has no attribute 'spatial' #21

Open james-vincent opened 1 year ago

james-vincent commented 1 year ago

From af2complex/src/alphafold/common/confidence.py

pairwise_dist = scipy.spatial.distance.cdist(a, b, metric='euclidean') AttributeError: module 'scipy' has no attribute 'spatial'

when running example1.sh. There does not appear to be an import statement for scipy.spatial.

FreshAirTonight commented 1 year ago

Irrelevant comment removed

james-vincent commented 1 year ago

It's scipy.spatial, no scipy.special:

pairwise_dist = scipy.spatial.distance.cdist(a, b, metric='euclidean')

FreshAirTonight commented 1 year ago

Both scipy.spatial and scipy.special are required by confidence.py. The installation of AF2 requires scripy.

james-vincent commented 1 year ago

I don't understand the comment. The issue I am reporting is that confidence.py does not import scipy.spatial. Should it?

FreshAirTonight commented 1 year ago

If you have installed the scipy module as required by AF2, see this file, the error message should be gone. Scipy.spatial was not explicitly imported in confidence.py as you correctly pointed out, but the spatial module will be imported in other part of the code before confidence.py.

james-vincent commented 1 year ago

It seems after installing AF2 I have two copies of scipy, one in regular site-packages and one that comes with jax:

find ./ -name scipy -type d ./lib/python3.7/site-packages/jax/_src/scipy ./lib/python3.7/site-packages/jax/_src/third_party/scipy ./lib/python3.7/site-packages/jax/scipy ./lib/python3.7/site-packages/scipy

The one that comes with jax does not contain the spatial module:

ls ./lib/python3.7/site-packages/jax/scipy cluster interpolate ndimage.py signal.py special.py init.py fft.py linalg.py optimize sparse stats pycache

james-vincent commented 1 year ago

Forgot to add, jax is correct version also:

python.af2complex -c 'import jax;print(jax.version)' 0.3.25

james-vincent commented 1 year ago

The numpy version after instalaltion of AF2 2.3.1 did not match the version listed in af2complex requirements.txt. I reinstalled and set numpy==1.21.6. Now the example job runs correctly.