af2complex icon indicating copy to clipboard operation
af2complex copied to clipboard

'scipy' has no attribute 'spatial'

Open james-vincent opened this issue 2 years ago • 8 comments

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.

james-vincent avatar Jul 12 '23 15:07 james-vincent

Irrelevant comment removed

FreshAirTonight avatar Jul 12 '23 15:07 FreshAirTonight

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

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

james-vincent avatar Jul 12 '23 16:07 james-vincent

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

FreshAirTonight avatar Jul 12 '23 16:07 FreshAirTonight

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

james-vincent avatar Jul 12 '23 16:07 james-vincent

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.

FreshAirTonight avatar Jul 12 '23 16:07 FreshAirTonight

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 avatar Jul 12 '23 16:07 james-vincent

Forgot to add, jax is correct version also:

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

james-vincent avatar Jul 12 '23 16:07 james-vincent

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.

james-vincent avatar Jul 12 '23 18:07 james-vincent