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

ImportError: cannot import name 'model' from 'alphafold3.model' (unknown location) #361

Closed
ACIITB23 opened this issue Mar 21, 2025 · 4 comments
Labels
setup Problem with installation or setting things up

Comments

@ACIITB23
Copy link

Commnad I am using: singularity exec --nv alphafold3new.sif python3 run_alphafold.py --input_dir='/home/achaudh6/Desktop/alphafold3/Faild_json' --model_dir='/home/achaudh6/Desktop/alphafold3' --output_dir='/home/achaudh6/Desktop/alphafold3/Failed_out' --db_dir='/home/achaudh6/Desktop/alphafold3/public_databases'

Getting errors

Traceback (most recent call last):
  File "/data/user/home/achaudh6/Desktop/alphafold3/run_alphafold.py", line 47, in <module>
    from alphafold3.model import model
ImportError: cannot import name 'model' from 'alphafold3.model' (unknown location)

I have reinstalled Alphafold3 and tried again but it couldn't work. I also followed this #314

Could you please help me to fix this issue?

@Augustin-Zidek Augustin-Zidek added the setup Problem with installation or setting things up label Mar 24, 2025
@Augustin-Zidek
Copy link
Collaborator

Is it possible you missed the Docker build step?

docker build -t alphafold3 -f docker/Dockerfile .

See https://github.com/google-deepmind/alphafold3/blob/main/docs/installation.md#running-using-singularity-instead-of-docker

@AnshBajwa13
Copy link

Hi, this

ImportError: cannot import name 'model' from 'alphafold3.model'

often occurs in containerized environments (like Singularity or Docker) when the code inside the container image is out of sync with the version being run, or if the installation within the image is incomplete.

As noted in a similar discussion in issue #314, a frequent cause is updating the Alphafold3 source code after the Singularity image (.sif file) was originally built. Even if you have the latest run_alphafold.py outside, the container still uses the older internal code structure, causing the import to fail.

The most probable solution is to rebuild your Singularity image (alphafold3new.sif) using the current/updated Alphafold3 source code. This ensures the environment inside the container matches the expected structure.
If rebuilding doesn't resolve it, secondary checks could include verifying that src/alphafold3/model/model.py exists inside the container and ensuring the correct working directory is specified via --pwd in the singularity exec command. However, rebuilding the image is the primary fix suggested for this specific import error in this context.

@ACIITB23
Copy link
Author

@AnshBajwa13 @Augustin-Zidek
It is working now.
Thanks for the above suggestion.

@Augustin-Zidek
Copy link
Collaborator

Great to hear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
setup Problem with installation or setting things up
Projects
None yet
Development

No branches or pull requests

3 participants