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

python 3.12 breaks pymt_era5 #1

Open
Timothy-W-Hilton opened this issue Jan 24, 2024 · 1 comment
Open

python 3.12 breaks pymt_era5 #1

Timothy-W-Hilton opened this issue Jan 24, 2024 · 1 comment

Comments

@Timothy-W-Hilton
Copy link

First and foremost, thanks for this great tool and the example of wrapping a data product in the BMI.

I'm finding that the installation instructions do not produce a working pymt_Era5 installation for me. The culprit seems to be Python 3.12, which conda create -n pymt python=3 now defaults to. The install instructions work for me if I pin Python to 3.11.

Minimal working example:

mamba create --yes -n pymt311 python=3.11 pymt pymt_era5
mamba activate pymt311
python --version
python -c "from pymt.models import Era5;print(Era5.__name__)"

results in success:

Python 3.11.7
Era5

But allowing the default Python3 (currently 3.12.1) results in a failure to locate some package directories:

mamba create --yes  -n pymt3xx python=3 pymt pymt_era5
mamba activate pymt3xx
python --version
python -c "from pymt.models import Era5;print(Era5.__name__)"

results in:

Python 3.12.1
Traceback (most recent call last):
  File "/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/model_metadata/find.py", line 51, in find_metadata_files
    with as_cwd(datadir, create=False):
  File "/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/model_metadata/scripting.py", line 14, in as_cwd
    os.chdir(path)
FileNotFoundError: [Errno 2] No such file or directory: '/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/bmi_era5/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/pymt_era5/data/Era5'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/pymt/models.py", line 40, in <module>
    for model in _load_models():
                 ^^^^^^^^^^^^^^
  File "/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/pymt/models.py", line 23, in _load_models
    model = bmi_factory(model)
            ^^^^^^^^^^^^^^^^^^
  File "/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/pymt/framework/bmi_bridge.py", line 575, in bmi_factory
    class BmiWrapper(BmiCap):
  File "/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/pymt/framework/bmi_bridge.py", line 577, in BmiWrapper
    __doc__ = bmi_docstring(cls)
              ^^^^^^^^^^^^^^^^^^
  File "/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/pymt/framework/bmi_docstring.py", line 102, in bmi_docstring
    meta = PluginMetadata(plugin)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/pymt/framework/bmi_metadata.py", line 101, in __init__
    ModelMetadata.__init__(self, path_to_mmd)
  File "/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/model_metadata/modelmetadata.py", line 64, in __init__
    self._files = find_metadata_files(self._path)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/model_metadata/find.py", line 55, in find_metadata_files
    raise MetadataNotFoundError(datadir)
model_metadata.errors.MetadataNotFoundError: /home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/bmi_era5/home/timh/mambaforge/envs/pymt3xx/lib/python3.12/site-packages/pymt_era5/data/Era5
@gantian127
Copy link
Owner

@Timothy-W-Hilton Thank you for posting the issue. I will look into it and try to find a solution for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants