PermafrostDiscoveryGateway / viz-staging

PDG Visualization staging pipeline
Apache License 2.0
2 stars 1 forks source link

Installation issue with `colormaps` dependency #31

Closed julietcohen closed 4 months ago

julietcohen commented 5 months ago

When installing the colormaps dependency, a new error has arisen in the terminal, and it is applicable to both viz-staging and viz-raster, as both require colormaps. This is likely due to the colormaps library rather than viz-staging or viz-raster. I am creating this issue here to document troubleshooting and the solution for future reference.

The issue occurs:

error message ``` Collecting git+https://github.com/PermafrostDiscoveryGateway/viz-staging.git Cloning https://github.com/PermafrostDiscoveryGateway/viz-staging.git to /tmp/pip-req-build-238ljiae Running command git clone --filter=blob:none --quiet https://github.com/PermafrostDiscoveryGateway/viz-staging.git /tmp/pip-req-build-238ljiae Resolved https://github.com/PermafrostDiscoveryGateway/viz-staging.git to commit 3c259a02e8740bd2fce7f740779147dbaa37f02c Preparing metadata (setup.py) ... done Collecting colormaps@ git+https://github.com/pratiman-91/colormaps.git#egg=colormaps Cloning https://github.com/pratiman-91/colormaps.git to /tmp/pip-install-dt2s7gki/colormaps_10ea6edc538c435193d4c8d8f8a68451 Running command git clone --filter=blob:none --quiet https://github.com/pratiman-91/colormaps.git /tmp/pip-install-dt2s7gki/colormaps_10ea6edc538c435193d4c8d8f8a68451 Resolved https://github.com/pratiman-91/colormaps.git to commit 8f96cd26fc4e18c2bc4fcfbc0c90b73e3048c228 Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [69 lines of output] /tmp/pip-build-env-52o7xtz3/overlay/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py:75: _MissingDynamic: `license` defined outside of `pyproject.toml` is ignored. !! ******************************************************************************** The following seems to be defined outside of `pyproject.toml`: `license = 'LICENSE'` According to the spec (see the link below), however, setuptools CANNOT consider this value unless `license` is listed as `dynamic`. https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ To prevent this problem, you can list `license` under `dynamic` or alternatively remove the `[project]` table from your file and rely entirely on other means of configuration. ******************************************************************************** !! _handle_missing_dynamic(dist, project_table) /tmp/pip-build-env-52o7xtz3/overlay/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py:75: _MissingDynamic: `dependencies` defined outside of `pyproject.toml` is ignored. !! ******************************************************************************** The following seems to be defined outside of `pyproject.toml`: `dependencies = ['matplotlib', 'numpy']` According to the spec (see the link below), however, setuptools CANNOT consider this value unless `dependencies` is listed as `dynamic`. https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ To prevent this problem, you can list `dependencies` under `dynamic` or alternatively remove the `[project]` table from your file and rely entirely on other means of configuration. ******************************************************************************** !! _handle_missing_dynamic(dist, project_table) Traceback (most recent call last): File "/home/jcohen/venv/k8s-parsl-viz/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in main() File "/home/jcohen/venv/k8s-parsl-viz/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/home/jcohen/venv/k8s-parsl-viz/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/pip-build-env-52o7xtz3/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/tmp/pip-build-env-52o7xtz3/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-52o7xtz3/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup exec(code, locals()) File "", line 117, in File "/tmp/pip-build-env-52o7xtz3/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 103, in setup return distutils.core.setup(**attrs) File "/tmp/pip-build-env-52o7xtz3/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 159, in setup dist.parse_config_files() File "/tmp/pip-build-env-52o7xtz3/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 627, in parse_config_files pyprojecttoml.apply_configuration(self, filename, ignore_option_errors) File "/tmp/pip-build-env-52o7xtz3/overlay/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 67, in apply_configuration return _apply(dist, config, filepath) File "/tmp/pip-build-env-52o7xtz3/overlay/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 56, in apply _apply_project_table(dist, config, root_dir) File "/tmp/pip-build-env-52o7xtz3/overlay/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 82, in _apply_project_table corresp(dist, value, root_dir) File "/tmp/pip-build-env-52o7xtz3/overlay/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 183, in _license _set_config(dist, "license", val["text"]) KeyError: 'text' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. ```

Reproduce the error:

Create new conda env and activate it: conda create -n test_colormaps python=3.9 conda activate test_colormaps Install for latest release of viz-staging: pip install git+https://github.com/PermafrostDiscoveryGateway/viz-staging.git

Temporary Solution to install colormaps outside of viz-staging or viz-raster:

  1. create new conda env: conda create -n test_colormaps python=3.9 then activate: conda activate test_colormaps
  2. comment out the requirement for colormaps in local viz-staging setup.py
  3. download the 0.4.0 release manually
  4. edit the pyproject.toml in colormaps-0.4.0, changing requires = ["setuptools>=61.0"] to requires = ["setuptools==61.0"] as recommended by this post.
  5. pip install -e viz-staging and then pip install -e colormaps-0.4.0

This did work to install both, but I would like to determine why this issue arose. It's confusing that it would be necessary to edit the pyproject.toml file now, when I did not have to before, for the same release of the package. It will be necessary to resolve this is a different way, like by editing the viz-staging setup.py so that users do not have to download a local version of the colormaps release 0.4.0 and edit the pyproject.toml.

Just adding the requirement 'setuptools==61.0', to the viz-staging setup.py shows the same error.

julietcohen commented 5 months ago

@robyngit noticed that colormaps is now available with pip, so we no longer need to install it vis github in the setup.py. She suggested a simpler solution than the one I posted above: change the install_requires line for colormaps in the setup.py of both viz-staging and viz-raster to colormaps==0.4.0. This works without having the change the setuptools line in the pyproject.toml like I did above!