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-ersilia does not work with python 3.12 #1214

Closed
miquelduranfrigola opened this issue Jul 26, 2024 · 6 comments
Closed

🐛 Bug: bentoml-ersilia does not work with python 3.12 #1214

miquelduranfrigola opened this issue Jul 26, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@miquelduranfrigola
Copy link
Member

Describe the bug.

The package bentoml-ersilia cannot be installed in python 3.12. This is a critical bug and we need to fix it.

I get the following error when trying pip install git+https://github.com/ersilia-os/bentoml-ersilia.git:

Collecting git+https://github.com/ersilia-os/bentoml-ersilia.git
  Cloning https://github.com/ersilia-os/bentoml-ersilia.git to /tmp/pip-req-build-fcsmaorw
  Running command git clone --filter=blob:none --quiet https://github.com/ersilia-os/bentoml-ersilia.git /tmp/pip-req-build-fcsmaorw
  Resolved https://github.com/ersilia-os/bentoml-ersilia.git to commit 34a26149d92b5dc4a09b6f51aaaa85b3d8116ae4
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      /tmp/pip-req-build-fcsmaorw/versioneer.py:423: SyntaxWarning: invalid escape sequence '\s'
        LONG_VERSION_PY['git'] = '''
      Traceback (most recent call last):
        File "/opt/conda/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/opt/conda/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/opt/conda/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-zounq322/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-zounq322/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-zounq322/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 497, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-zounq322/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 81, in <module>
        File "/tmp/pip-req-build-fcsmaorw/versioneer.py", line 1482, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "/tmp/pip-req-build-fcsmaorw/versioneer.py", line 1414, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-req-build-fcsmaorw/versioneer.py", line 344, in get_config_from_root
          parser = configparser.SafeConfigParser()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.```

### Describe the steps to reproduce the behavior

conda create -n testenv python=3.12
conda activate testenv
pip install git+https://github.com/ersilia-os/bentoml-ersilia.git


### Operating environment

Ubuntu 20.04 LTS
@DhanshreeA
Copy link
Member

Related to #995

@DhanshreeA
Copy link
Member

DhanshreeA commented Jul 26, 2024

SafeConfigParser class has been deprecated since 3.2 and fully removed from 3.12 as documented here and it seems the defacto API now is the ConfigParser class.

Also looking at the versioneer.py in bentoml-ersilia, I really don't understand what's happening in this line, specifically the import statement that is trying to import the class ConfigParser and aliasing it as the module configparser, because if the code goes into the except block, it would try to import the class SafeConfigParser from ConfigParser in this function.

In any case, I propose adding an if condition to check the version of python process running this code and importing the correct class (ie ConfigParser correctly)

@DhanshreeA
Copy link
Member

Hey @miquelduranfrigola I've tried to fix it here: ersilia-os/bentoml-ersilia#1, please review and feel free to merge anytime.

@miquelduranfrigola
Copy link
Member Author

I've merged. Did you check that it works in a python 3.12 conda environment?

@DhanshreeA
Copy link
Member

DhanshreeA commented Jul 29, 2024

@miquelduranfrigola - I've tested it with Python 3.12, it works! In a 3.12 conda env, I installed bentoml-ersilia followed by ersilia and tested running some basic ersilia commands (version, catalog, help) - no failures. I think it should be good to close, what do you think?

@DhanshreeA DhanshreeA moved this from Queue to In Progress in Ersilia Model Hub Jul 29, 2024
@miquelduranfrigola
Copy link
Member Author

Amazing. Thanks. Let's close it then.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Ersilia Model Hub Jul 29, 2024
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
Archived in project
Development

No branches or pull requests

2 participants