Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'scipy' has no attribute 'spatial' #21

Open
james-vincent opened this issue Jul 12, 2023 · 8 comments
Open

'scipy' has no attribute 'spatial' #21

james-vincent opened this issue Jul 12, 2023 · 8 comments

Comments

@james-vincent
Copy link

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
Copy link
Owner

FreshAirTonight commented Jul 12, 2023

Irrelevant comment removed

@james-vincent
Copy link
Author

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

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

@FreshAirTonight
Copy link
Owner

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

@james-vincent
Copy link
Author

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

@FreshAirTonight
Copy link
Owner

FreshAirTonight commented Jul 12, 2023

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
Copy link
Author

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
Copy link
Author

Forgot to add, jax is correct version also:

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

@james-vincent
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants