SciTools / cf-units

Units of measure as required by the Climate and Forecast (CF) Metadata Conventions
https://cf-units.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
64 stars 46 forks source link

cf-units doesn't install with pip on Python 3.12.3 #432

Open huaracheguarache opened 2 months ago

huaracheguarache commented 2 months ago

🐛 Bug Report

I am unable to install cf-units using a Python venv together with pip using Python version 3.12.3. I get an error message saying that wheel failed to build for cf-units (see attached traceback).

How to Reproduce

Steps to reproduce the behaviour:

  1. Create a python virtual environment: python -m venv .venv
  2. Activate it: source .venv/bin/activate
  3. Upgrade pip: python -m pip install --upgrade pip
  4. Try to install cf-units: python -m pip install cf-units

Expected Behaviour

cf-units installs without issues.

Environment

Additional Context

Click to expand this section... ```bash (.venv) michael@localhost:~/src/koding/test$ python -m pip install cf-units Collecting cf-units Using cached cf-units-3.2.0.tar.gz (165 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting antlr4-python3-runtime==4.7.2 (from cf-units) Using cached antlr4_python3_runtime-4.7.2-py3-none-any.whl Collecting cftime>=1.2 (from cf-units) Using cached cftime-1.6.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (8.7 kB) Collecting jinja2 (from cf-units) Using cached jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB) Collecting numpy (from cf-units) Using cached numpy-2.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB) Collecting MarkupSafe>=2.0 (from jinja2->cf-units) Using cached MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.0 kB) Using cached cftime-1.6.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB) Using cached numpy-2.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.0 MB) Using cached jinja2-3.1.4-py3-none-any.whl (133 kB) Using cached MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28 kB) Building wheels for collected packages: cf-units Building wheel for cf-units (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for cf-units (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [19 lines of output] Traceback (most recent call last): File "/var/home/michael/src/koding/test/.venv/lib64/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in main() File "/var/home/michael/src/koding/test/.venv/lib64/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 "/var/home/michael/src/koding/test/.venv/lib64/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel return _build_backend().build_wheel(wheel_directory, config_settings, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-_zcl5ayp/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 410, in build_wheel return self._build_with_temp_dir( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-_zcl5ayp/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir self.run_setup() File "/tmp/pip-build-env-_zcl5ayp/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup exec(code, locals()) File "", line 152, in File "", line 75, in get_package_data ValueError: Require to set UDUNITS2_XML_PATH for a cf-units wheel build. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for cf-units Failed to build cf-units ERROR: Could not build wheels for cf-units, which is required to install pyproject.toml-based projects ```
ocefpaf commented 2 months ago

There are no wheels for py312. You need to build it from source there. You will need udunits2 to build it from source.

echoix commented 2 months ago

In the OSGeo/grass-addons repo, trying to use Python 3.12thus creating a wheel locally fails even in CI. Is it possible to take a new look at this? We are getting closer to the next 3.13 release in October than we are from the last 3.12 release

rcomer commented 2 months ago

I guess we need #423 since that adds support for py312. Then of course we need a new release.

echoix commented 2 months ago

I see... I postponed the migration to Python 3.12 (I was syncing the CI workflows with the changes that the non-addons repo grass was using, and the new release would have used 3.12 by default).

ocefpaf commented 2 months ago

I guess we need #423 since that adds support for py312. Then of course we need a new release.

I believe that we don't need #423, PR #368, that was already merged, would do. I am building cf-units for Python 3.12 in conda-forge for a while now. All we need is a new release here. Note that #427 would be nice though, that one adds numpy 2.0 support.

stephenworsley commented 2 months ago

@SciTools/peloton We agree that a release is perhaps overdue for this, @pp-mo @bjlittle will be looking into this.