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

Importing gribapi before eccodes fails due to a circular import #116

Open
peterazmanov opened this issue Dec 24, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@peterazmanov
Copy link

peterazmanov commented Dec 24, 2024

What happened?

I use gribapi module directly without importing eccodes first, after upgrade from 1.7.1->any recent version, the import fails.

What are the steps to reproduce the bug?

pip install eccodes
python -c "import gribapi"

Version

2.39.1 (Python 3.12.3)

Platform (OS and architecture)

Ubuntu 24.04 (6.8.0-50-generic, x86_64)

Relevant log output

cannot import name 'CODES_FEATURES_ALL' from partially initialized module 'gribapi' (most likely due to a circular import) (<path-to-venv>/eccodes2-Lqr16Bgk-py3.12/lib/python3.12/site-packages/gribapi/__init__.py)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<path-to-venv>/eccodes2-Lqr16Bgk-py3.12/lib/python3.12/site-packages/gribapi/__init__.py", line 13, in <module>
    from .gribapi import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "<path-to-venv>/eccodes2-Lqr16Bgk-py3.12/lib/python3.12/site-packages/gribapi/gribapi.py", line 34, in <module>
    from gribapi.errors import GribInternalError
  File "<path-to-venv>/eccodes2-Lqr16Bgk-py3.12/lib/python3.12/site-packages/gribapi/errors.py", line 16, in <module>
    from .bindings import ENC, ffi, lib
  File "<path-to-venv>/eccodes2-Lqr16Bgk-py3.12/lib/python3.12/site-packages/gribapi/bindings.py", line 102, in <module>
    library_path = find_binary_libs("eccodes")
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<path-to-venv>/eccodes2-Lqr16Bgk-py3.12/lib/python3.12/site-packages/gribapi/bindings.py", line 81, in find_binary_libs
    from eccodes._eccodes import versions as _versions
  File "<path-to-venv>/eccodes2-Lqr16Bgk-py3.12/lib/python3.12/site-packages/eccodes/__init__.py", line 13, in <module>
    from .eccodes import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "<path-to-venv>/eccodes2-Lqr16Bgk-py3.12/lib/python3.12/site-packages/eccodes/eccodes.py", line 12, in <module>
    from gribapi import (
ImportError: cannot import name 'CODES_FEATURES_ALL' from partially initialized module 'gribapi' (most likely due to a circular import) (<path-to-venv>/eccodes2-Lqr16Bgk-py3.12/lib/python3.12/site-packages/gribapi/__init__.py)

Accompanying data

No response

Organisation

No response

@peterazmanov peterazmanov added the bug Something isn't working label Dec 24, 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
None yet
Development

No branches or pull requests

1 participant