inlab-geo / cofi

Common Framework for Inference
https://cofi.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
17 stars 4 forks source link

`pip install cofi` fails due to lack of Fortran compiler #26

Closed valentineap closed 2 years ago

valentineap commented 2 years ago

I attempted to install cofi on my new desktop. It seems I have not yet installed a fortran compiler. As a result the pip install fails with an ugly set of errors: err.log

The key part seems to be:

  INFO: building '_rfc' extension
  error: extension '_rfc' has Fortran sources but no Fortran compiler found

Is it possible to either: i. Register a Fortran compiler as a dependency and automagically install one as needed, or ii. Fail gracefully with a useful error message if Fortran isn't available?

Full command history as follows:

# Use virtualenv rather than conda for environment management
python -m venv cofi_env
source cofi_env/bin/activate
pip install cofi
valentineap commented 2 years ago

Just to confirm that after installing gfortran, my pip install cofi succeeded.

jwhhh commented 2 years ago

It's possible to: i. Register a Fortran compiler (and its libraries) as a dependency in conda, but not with pip as it's only for the Python ecosystem ii. Raise a better error message

I'll work on raising a better error message very soon, and will leave this issue open until this has been implemented.

Making cofi available through conda is another short-term goal.

jwhhh commented 2 years ago

Wheels on M1 Mac is not supported yet because it's not supported by github actions. Here is a failed build job.

Another note is that we don't plan to include any forward code example in cofi itself; instead, we include forward examples through cofi-examples repo. The reason why Malcolm's RFC code is a part of cofi now (temporarily) is that skbuild seems to raise an error for pure Python package. I'm looking into this (whether we can remove RFC and let skbuild work) now.

jwhhh commented 2 years ago

Wheels on M1 Mac is not supported yet because it's not supported by github actions. Here is a failed build job.

Another note is that we don't plan to include any forward code example in cofi itself; instead, we include forward examples through cofi-examples repo. The reason why Malcolm's RFC code is a part of cofi now (temporarily) is that skbuild seems to raise an error for pure Python package. I'm looking into this (whether we can remove RFC and let skbuild work) now.

Fortran compiler is no longer needed in current version of cofi, as we've managed to make skbuild and cibuildwheels work without any compiled code. See pull request #30.

Still, just in case we will have compiled library in our source code in the future, it's meaningful to handle the packaging installation step to raise a better error message. Please see #31 for the fix.