You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When AlphaFold3 is installed outside of the Python prefix (whether a base installation or a virtual environment), the import
fromalphafold3.cppimportcif_dict
(e.g., in the build_data and run_alphafold.py scripts), fails with error
ImportError: Could not find the libcifpp components.cif file.
As far as I can tell, this is due to the lookup in src/alphafold3/model/mkdssp_pybind.c that searches for share/libcifpp/components.cif in the value returned by site.getsitepackages(). This will only return the site packages directory under the base installation.
Rationale
There are cases for installing packages outside of the base prefix, and making them available using the PYTHONPATH variable. Our primary use case is when using EasyBuild to make software available to users in a high-performance computing environment. When EasyBuild installs a Python package, it sets PYTHONPATH as part of a module file to allow users access to the package when requested. This improves the modularity of our Python package offerings.
Suggested solution
I suggest replacing the lookup for share/libcifpp/components.cif in site.getsitepackages(). Instead, it should search relative to its own installation path, e.g., pathlib.Path(alphafold3.__path__[0]) / '../share/libcifpp/components.cif'. This finds the file in the existing expected situation when AlphaFold3 is installed in the Python prefix, or if it is installed externally and brought in via PYTHONPATH.
Hello, thanks for the suggestion. I understand the rationale, but I also fear that while this fixes your use-case, it might break the setup for another set of users. I also know our current solution works for 99% of users (based on user feedback), while I have no data for the proposed solution.
Have you verified the approach you are suggesting works in the Docker and Singularity setup that we recommend to users in docs/installation.md? Have you tested this setup with a local installation that doesn't use Docker? Could you send a PR and test it against our GitHub CI?
I have tested this fix with a local installation (both inside the Python prefix and outside) that does not use Docker and it is working well. I unfortunately can't easily test the Docker instructions because our HPCC does not allow for Docker builds (and I don't have easy access to cloud credits).
As outlined in CONTRIBUTING.md, I need to review whether my employer has signed the Google CLA before I can send my fix as a PR.
Problem
When AlphaFold3 is installed outside of the Python prefix (whether a base installation or a virtual environment), the import
(e.g., in the
build_data
andrun_alphafold.py
scripts), fails with errorAs far as I can tell, this is due to the lookup in
src/alphafold3/model/mkdssp_pybind.c
that searches forshare/libcifpp/components.cif
in the value returned bysite.getsitepackages()
. This will only return the site packages directory under the base installation.Rationale
There are cases for installing packages outside of the base prefix, and making them available using the
PYTHONPATH
variable. Our primary use case is when using EasyBuild to make software available to users in a high-performance computing environment. When EasyBuild installs a Python package, it setsPYTHONPATH
as part of a module file to allow users access to the package when requested. This improves the modularity of our Python package offerings.Suggested solution
I suggest replacing the lookup for
share/libcifpp/components.cif
insite.getsitepackages()
. Instead, it should search relative to its own installation path, e.g.,pathlib.Path(alphafold3.__path__[0]) / '../share/libcifpp/components.cif'
. This finds the file in the existing expected situation when AlphaFold3 is installed in the Python prefix, or if it is installed externally and brought in viaPYTHONPATH
.I believe that this also should be changed in the
build_data
script.The text was updated successfully, but these errors were encountered: