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

FileNotFoundError when running benchcab v4.0.0 #267

Closed
SeanBryan51 opened this issue Mar 14, 2024 · 3 comments · Fixed by #272
Closed

FileNotFoundError when running benchcab v4.0.0 #267

SeanBryan51 opened this issue Mar 14, 2024 · 3 comments · Fixed by #272
Assignees
Labels
bug Something isn't working

Comments

@SeanBryan51
Copy link
Collaborator

Running benchcab run with benchcab v4.0.0 fails to load resources from the package data directory and throws a FileNotFoundError:

$ benchcab run
Traceback (most recent call last):
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-24.01/bin/benchcab", line 10, in <module>
    sys.exit(main())
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-24.01/lib/python3.10/site-packages/benchcab/main.py", line 42, in main
    parse_and_dispatch(parser)
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-24.01/lib/python3.10/site-packages/benchcab/main.py", line 32, in parse_and_dispatch
    func(**args)
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-24.01/lib/python3.10/site-packages/benchcab/benchcab.py", line 368, in run
    self.checkout(config_path)
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-24.01/lib/python3.10/site-packages/benchcab/benchcab.py", line 221, in checkout
    config = self._get_config(config_path)
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-24.01/lib/python3.10/site-packages/benchcab/benchcab.py", line 136, in _get_config
    self._config = read_config(config_path)
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-24.01/lib/python3.10/site-packages/benchcab/config.py", line 169, in read_config
    validate_config(config)
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-24.01/lib/python3.10/site-packages/benchcab/config.py", line 58, in validate_config
    schema = bu.load_package_data("config-schema.yml")
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-24.01/lib/python3.10/site-packages/benchcab/utils/__init__.py", line 56, in load_package_data
    raw = pkgutil.get_data("benchcab", os.path.join("data", filename)).decode("utf-8")
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-24.01/lib/python3.10/pkgutil.py", line 639, in get_data
    return loader.get_data(resource_name)
  File "<frozen importlib._bootstrap_external>", line 1073, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/g/data/hh5/public/apps/miniconda3/envs/analysis3-24.01/lib/python3.10/site-packages/benchcab/data/config-schema.yml'

To reproduce:

module load conda/analysis3-unstable
cd /scratch/$PROJECT/$USER
git clone [email protected]:CABLE-LSM/bench_example.git bench_example_tmp
cd bench_example_tmp
benchcab run

I have also reproduced the error in a custom conda environment.

@SeanBryan51 SeanBryan51 added the bug Something isn't working label Mar 14, 2024
@SeanBryan51
Copy link
Collaborator Author

SeanBryan51 commented Mar 19, 2024

The uploaded tarball for benchcab v4.0.0 is missing the site-packages/benchcab/data directory (see https://anaconda.org/accessnri/benchcab/files).

Building the conda package locally on Gadi and installing it seems to include the data directory which is strange. Perhaps something specific to the automated deployment is broken (workflow logs for the deployment are here: https://github.com/CABLE-LSM/benchcab/actions/runs/8182061626/job/22372810738).

@SeanBryan51
Copy link
Collaborator Author

I've managed to reproduce and fix the error in my personal fork of benchcab by replacing the include_package_data option in setup.cfg with the package_data option.

Hot fix release coming soon.

@SeanBryan51
Copy link
Collaborator Author

SeanBryan51 commented Mar 20, 2024

It might be possible that we are not testing the installed version of the package in our CI workflow. This is one of the major disadvantages in using a flat layout. It would be interesting to see if the CI fails to find the data directory when switching to a src layout.

*Edit: switching to src layout and removing the package_data option causes the CI to fail to find the data directory: https://github.com/SeanBryan51/benchcab/actions/runs/8353949217/job/22866490538?pr=2. We should make this change before resolving this issue.

This was referenced Mar 20, 2024
@SeanBryan51 SeanBryan51 self-assigned this Mar 20, 2024
@SeanBryan51 SeanBryan51 linked a pull request Mar 20, 2024 that will close this issue
SeanBryan51 added a commit that referenced this issue Mar 20, 2024
Currently the uploaded tarball for benchcab v4.0.0 is missing the
site-packages/benchcab/data directory (see
https://anaconda.org/accessnri/benchcab/files). This change fixes this
by replacing the include_package_data option with the package_data
option in setup.cfg (see Data Files Support).

Conda package deployment was tested here in a forked repository and the
uploaded tarball contains the package data directory.

Fixes #267
SeanBryan51 added a commit that referenced this issue Mar 20, 2024
Currently the uploaded tarball for benchcab v4.0.0 is missing the
site-packages/benchcab/data directory (see
https://anaconda.org/accessnri/benchcab/files). This change fixes this
by replacing the include_package_data option with the package_data
option in setup.cfg (see Data Files Support).

Conda package deployment was tested here in a forked repository and the
uploaded tarball contains the package data directory.

Fixes #267
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

Successfully merging a pull request may close this issue.

1 participant