ersilia-os / ersilia

The Ersilia Model Hub, a repository of AI/ML models for infectious and neglected disease research.
https://ersilia.io
GNU General Public License v3.0
225 stars 147 forks source link

Outreachy Code Project: <Fortune Max> #236

Closed fortune-max closed 2 years ago

fortune-max commented 2 years ago

Applicant:

Welcome to the Ersilia Open Source Initiative. This issue will serve to track all your contributions for the project “Improve the Ersilia Model Hub, a FOSS platform offering pre-trained AI/ML models for research”.

Please tick the tasks as you complete them. To make a final application it is not required to have completed all tasks. This project requires knowledge of the Python programming language. The tasks are not ordered from more to less important, they are simply related to different skills. Start where you feel most comfortable.


Initial steps

fortune-max commented 2 years ago

I am not sure if it's a common enough issue but on Mac it seems you have to install hdf5 library perhaps using homebrew as the python dependency (hf5py) requires the library to be present locally first.

Followed the installation instructions here: https://ersilia.gitbook.io/ersilia-book/quick-start/installation

To fix run: brew install hdf5@1.8

Then on ARM chip Macs: ln -s /opt/homebrew/opt/hdf5@1.8/lib/libhdf5.10.dylib /usr/local/lib/libhdf5.dylib

On Intel chip Macs: ln -s /usr/local/opt/hdf@1.8/lib/libhdf5.10.dylib /usr/local/lib/libhdf5.dylib

fortune-max commented 2 years ago

Another Mac specific issue I encountered while setting up.

The .bashrc file is read when starting up ersilia.

As my default shell is zsh, no .bashrc file exists. This causes ersilia/default.py/bashrc_cli_snippet function call to fail (line 119).

It is not immediately obvious this is the cause from the error thrown.

Running touch ~/.bashrc fixed this locally for me.

fortune-max commented 2 years ago

Running ersilia fetch molecular-weight kept failing for me until I ran conda create -n eosbase-bentoml-0.11.0-py37

and activated environment conda activate eosbase-bentoml-0.11.0-py37

Kept throwing a source environment not found File "/Users/fortune/code/ersilia/ersilia/utils/conda.py", line 297, in clone raise Exception("{0} source environment does not exist".format(src_env)) Exception: eosbase-bentoml-0.11.0-py37 source environment does not exist

fortune-max commented 2 years ago

For Apple Silicon, the h5py dependency doesn't work with pip install as it has to be built from source and the headers and shared library files are not present.

Before running pip install -e . , make sure to install hdf5 with brew

brew install hdf5@1.8

Add the necessary flags to your session to allow local compilation of h5py:

export LDFLAGS="-L/opt/homebrew/opt/hdf5@1.8/lib" export CPPFLAGS="-I/opt/homebrew/opt/hdf5@1.8/include"

Make the shared library accessible to compiler

ln -s /opt/homebrew/opt/hdf5@1.8/lib/libhdf5.10.dylib /usr/local/lib/libhdf5.dylib

Then finally install erisilia dependencies

pip install -e .

FOR INTEL MACs: Replace all /opt/homebrew/ with /usr/local/

fortune-max commented 2 years ago
Screenshot 2022-04-16 at 12 09 18

Screenshot of a model in use to determine molecular weight of aspirin.

fortune-max commented 2 years ago
Screenshot 2022-04-16 at 13 39 18

Local catalog of installed models.

GemmaTuron commented 2 years ago

Hi @fortune-max

Thanks for checking the set up and installation of Ersilia. Please, could you report those problems in the form of a bug tracker opening a new issue for each one of them?

fortune-max commented 2 years ago

Sure, I'll be glad to help make the setup process go smoother for people sharing a similar environment as I am.

fortune-max commented 2 years ago

Hi @GemmaTuron

Is there a reason the dependencies are being installed using pip instead of with conda install?

Using conda install --file requirements.txt instead of pip install -e . is preferable to me and actually works around the h5py dependency compilation installation issue I faced.

See https://ersilia.gitbook.io/ersilia-book/quick-start/installation

fortune-max commented 2 years ago

I have attempted to install ersilia's dependencies using conda. Unfortunately a number of them are unavailable from conda's repo alone. I think the best way would be to have the instructions say

conda install h5py

Then

pip install -e .

to get around the issue for Mac users. I will detail more of my findings in the issue I open.

GemmaTuron commented 2 years ago

Hi @fortune-max

Thanks for the suggestions we will look into them as soon as possible. Unfortunately we won't be able to provide feedback before the application deadline so please go ahead and make your application listing these contributions so far.

Thanks!

fortune-max commented 2 years ago

Sure Gemma,

Glad to have helped. Will add to contributions now.