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

🐛 Bug: Bentoml and Python3.12 compatibility #1379

Open
Abellegese opened this issue Nov 13, 2024 · 7 comments
Open

🐛 Bug: Bentoml and Python3.12 compatibility #1379

Abellegese opened this issue Nov 13, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@Abellegese
Copy link
Contributor

Describe the bug.

Recently got this error when fetching eos3b5e from a github on python 3.12 conda env and got this error:

  File "/home/abellegese/miniconda3/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2191, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
🚨🚨🚨 Something went wrong with Ersilia 🚨🚨🚨

Error message:

Expecting value: line 1 column 1 (char 0)
If this error message is not helpful, open an issue at:
 - https://github.com/ersilia-os/ersilia
Or feel free to reach out to us at:
 - hello[at]ersilia.io

If you haven't, try to run your command in verbose mode (-v in the CLI)
 - You will find the console log file in: /home/abellegese/eos/current.log

Describe the steps to reproduce the behavior

No response

Operating environment

Ubuntu

@Abellegese Abellegese added the bug Something isn't working label Nov 13, 2024
@DhanshreeA DhanshreeA self-assigned this Nov 14, 2024
@DhanshreeA
Copy link
Member

@Abellegese I remember the stack trace having more to it - ie specifically, I am asking for the part of the trace where this bug originates from ersilia's copy of bentoml. If possible could you attach that to the issue as well?

@Abellegese
Copy link
Contributor Author

Okay @DhanshreeA will update it.

@GemmaTuron GemmaTuron changed the title 🐛 Bug: Bentoml and Python3.12 comatibility 🐛 Bug: Bentoml and Python3.12 compatibility Nov 28, 2024
@GemmaTuron GemmaTuron moved this from On Hold to In Progress in Ersilia Model Hub Nov 28, 2024
@GemmaTuron
Copy link
Member

Hi @DhanshreeA and @Abellegese

Can you update this issue? And set a deadline for completion

@DhanshreeA DhanshreeA moved this from In Progress to On Hold in Ersilia Model Hub Nov 29, 2024
@DhanshreeA DhanshreeA removed their assignment Nov 29, 2024
@DhanshreeA DhanshreeA self-assigned this Dec 16, 2024
@DhanshreeA
Copy link
Member

DhanshreeA commented Dec 17, 2024

I am unable to reproduce the exact error that @Abellegese has reported here, however, I do notice an issue with Python 3.12 and fetching from github, however I do experience a similar error (ie in that it is coming from pkg_resources module):

Traceback (most recent call last):
  File "/home/dee/.pyenv/versions/ersilia-312/bin/bentoml", line 5, in <module>
    from bentoml.cli import cli
  File "/home/dee/.pyenv/versions/3.12.5/envs/ersilia-312/lib/python3.12/site-packages/bentoml/__init__.py", line 27, in <module>
    from bentoml.saved_bundle import load_from_dir, save_to_dir  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dee/.pyenv/versions/3.12.5/envs/ersilia-312/lib/python3.12/site-packages/bentoml/saved_bundle/__init__.py", line 15, in <module>
    from bentoml.saved_bundle.bundler import save_to_dir
  File "/home/dee/.pyenv/versions/3.12.5/envs/ersilia-312/lib/python3.12/site-packages/bentoml/saved_bundle/bundler.py", line 31, in <module>
    from bentoml.saved_bundle.local_py_modules import (
  File "/home/dee/.pyenv/versions/3.12.5/envs/ersilia-312/lib/python3.12/site-packages/bentoml/saved_bundle/local_py_modules.py", line 27, in <module>
    from bentoml.saved_bundle.pip_pkg import get_all_pip_installed_modules
  File "/home/dee/.pyenv/versions/3.12.5/envs/ersilia-312/lib/python3.12/site-packages/bentoml/saved_bundle/pip_pkg.py", line 23, in <module>
    from pkg_resources import Requirement
ModuleNotFoundError: No module named 'pkg_resources'

Edit: This was in a fresh ersilia environment created using Python 3.12, and then running: ersilia fetch eos3b5e --from_github.

@DhanshreeA
Copy link
Member

Okay, I believe we have run into this before. However, this only fixed ersilia code using the pkg_resources module - which doesn't address this issue coming up from bentoml.

@DhanshreeA DhanshreeA moved this from On Hold to In Progress in Ersilia Model Hub Dec 17, 2024
@DhanshreeA DhanshreeA moved this from In Progress to On Hold in Ersilia Model Hub Dec 18, 2024
@DhanshreeA DhanshreeA removed their assignment Dec 18, 2024
@DhanshreeA
Copy link
Member

Downgrading the priority here for two reasons:

  1. In Python 3.12, models will work if fetched from Docker
  2. We will try to do a massive refactoring of all models to update their installation files (from Dockerfile to install.yml) and hopefully get rid of bentoml completely - In fact this could be our 2.0.0 release (@miquelduranfrigola)

@DhanshreeA
Copy link
Member

Another update:

We will continue to use our BentoML fork for packaging models, however, we will utilise Ersilia Pack for as many old models, and all new models. This is necessary because Ersilia Pack utilises FastAPI which only supports Python 3.8 and above. We will refactor most models to use an upgraded Python version especially if they use Python 3.7 or below. However, for those models that cannot be upgraded, and are still important for us to keep in the hub, we will continue to utilise BentoML.

This scenario merits adding to the code, a conditional check that checks if the user is running ersilia in a Python 3.12 (or above) environment - in this case, if the user is fetching a model from source, ie GitHub, local path, or S3, we will force packing this model using Ersilia Pack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: On Hold
Development

No branches or pull requests

3 participants