NOAA-ORR-ERD / LibGOODS

Library for accessing data useful for the NOAA / GNOME model
https://libgoods.readthedocs.io/en/latest/
Other
1 stars 2 forks source link

model_catalogs doesn't import from full install #17

Open ChrisBarker-NOAA opened 2 years ago

ChrisBarker-NOAA commented 2 years ago

If I do:

pip install model_catalogs

then I can't import it:

$ python -c "import model_catalogs"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/chris.barker/miniconda3/envs/gnome_test/lib/python3.8/site-packages/model_catalogs/__init__.py", line 59, in <module>
    shutil.copy(
  File "/Users/chris.barker/miniconda3/envs/gnome_test/lib/python3.8/shutil.py", line 418, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/Users/chris.barker/miniconda3/envs/gnome_test/lib/python3.8/shutil.py", line 264, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/chris.barker/miniconda3/envs/gnome_test/lib/python3.8/site-packages/model_catalogs/catalogs/transform.yaml'

I think there's a data file not getting installed.

It works if you use an editable install.

ChrisBarker-NOAA commented 2 years ago

NOTE: I added the data files, but it won't actually work correctly.

The tests fail with: "complete" model source files are not yet available. Runmodel_catalogs.complete_source_catalog()to create this directory.

But that won't work with a proper install -- it will only work with an editable install.

Not too horrible while under active development -- but I think we need to be a bit more clear about code vs data, and where generated files with be stored.

lukecampbell commented 1 year ago

@ChrisBarker-NOAA is this still an issue?

ChrisBarker-NOAA commented 1 year ago

Looks like this is working now -- closing.

ChrisBarker-NOAA commented 1 year ago

Reopening because I just noticed that the CI tests are using an editable install for the tests:

        run: |
          python -m pip install -e . --no-deps --force-reinstall

I think the tests should probably use a regular, non-editable install, to avoid similar issues arising in the future.