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
224 stars 148 forks source link

📑 Feature Request: Incorporate a new function to utils of Ersilia to get the Python Path of a Conda environment. #521

Closed carcablop closed 1 year ago

carcablop commented 1 year ago

Is your feature request related to a problem? Please describe.

When I tried to test a model, this was generating an error and it was not running inside the conda environment that was created from the model when I did the fetch, but it was running in another conda environment, this generates problems with dependencies, since these dependencies were only installed in the environment created when you fetched. So it was necessary to specify the python path of the conda environment of the model and pass it to the function so that it could be executed without errors.

Describe the solution you'd like.

In the utils folder of the Ersilia repository, in the script conda.py, we should have a function that returns the python path given a conda environment.

A function like this:


`def getPythonPath_env(name_env_model):
    python_path= subprocess.check_output("which python", shell=True).strip()
    index_env=python_path.decode('utf-8').find("envs/") + 5
    python_path_envs_model= python_path.decode('utf-8')[0:index_env]  
    return python_path_envs_model + name_env_model + "/bin/python"`

Describe alternatives you've considered

No response

Additional context.

No response

carcablop commented 1 year ago

Hello. This is the pull request to incorporate the function. https://github.com/ersilia-os/ersilia/pull/522

Thank you.

GemmaTuron commented 1 year ago

Hi @carcablop !

Thanks for this, before merging the commit, can you share more about the error? It had never occurred with other models before, so I want to understand if this is something specifically of the model you mention or general (so it should be in Ersilia's codebase), what was different in this model that made Ersilia not activate the correct environment?

carcablop commented 1 year ago

Hola @carcablop !

Gracias por esto, antes de fusionar la confirmación, ¿puede compartir más sobre el error? Nunca antes había ocurrido con otros modelos, así que quiero entender si esto es algo específico del modelo que mencionas o general (así debería estar en el código base de Ersilia), qué fue diferente en este modelo que hizo que Ersilia no activara el entorno correcto ?

Hi Gemma, the intention of adding the function is to incorporate it as a utility for future implementations, in cases where it is required to interact with conda through python. I made some corrections and made some changes suggested by Miquel. This is the new pull request https://github.com/ersilia-os/ersilia/pull/525

GemmaTuron commented 1 year ago

I've merged PR #525 ! thanks @carcablop