inbo / niche_vlaanderen

Python package to run the NICHE Vlaanderen model
https://inbo.github.io/niche_vlaanderen/
MIT License
5 stars 2 forks source link

Problem installing or updating to niche_vlaanderen-1.3 #382

Closed Wardlorenz closed 1 week ago

Wardlorenz commented 3 months ago

I followed the installation as described in the Git-HUB tutorial. When doing the installation via 'pip install niche_vlaanderen an error is produced making the installation unsuccesful and the model not functional. This happens with the installation of the newest version of niche_vlaanderen (1.3 - version.). And happens both with the command line "pip install niche_vlaanderen" and "pip install niche_vlaanderen-1.3"

The same error occurs for a couple of colleages of mine, trying the same installation (in miniconda, using windows operating system). One of the colleages succeeded in installing the 1.3 version about a month ago, but using the same computer couldn't reproduce the installation. All of us run into a bug at the same time when "PYGEOS" is collected/activated.

Underneath is the error that is produced.

We managed to install the niche_vlaanderen1.2 version, that seems to be still functional with the downloaded "zip package" of the niche_vlaanderen 1.3 version.

Is anyone else experiencing this problem, and is there a way solving it. What limitations can we expect using the outdated 1.2 version of the model?

Thanks in advance!

prtscr

_**Collecting pygeos (from niche_vlaanderen==1.3) Using cached pygeos-0.14.tar.gz (141 kB) 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 ╰─> [35 lines of output]

:8: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html C:\Users\wlorenz\AppData\Local\Temp\pip-install-a7uion6b\pygeos_b3b5606d5ed24b8a882c1afc14919a92\versioneer.py:421: SyntaxWarning: invalid escape sequence '\s' LONG_VERSION_PY['git'] = ''' Could not find geos-config executable. Either append the path to geos-config to PATH or manually provide the include_dirs, library_dirs, libraries and other link args for compiling against a GEOS version >=3.5. Compiling pygeos/_geometry.pyx because it changed. Compiling pygeos/_geos.pyx because it changed. [1/2] Cythonizing pygeos/_geometry.pyx [2/2] Cythonizing pygeos/_geos.pyx Traceback (most recent call last): File "C:\Users\wlorenz\Miniconda3\envs\niche\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in main() File "C:\Users\wlorenz\Miniconda3\envs\niche\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wlorenz\Miniconda3\envs\niche\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wlorenz\AppData\Local\Temp\pip-build-env-iwg3sjsg\overlay\Lib\site-packages\setuptools\build_meta.py", line 327, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wlorenz\AppData\Local\Temp\pip-build-env-iwg3sjsg\overlay\Lib\site-packages\setuptools\build_meta.py", line 297, in _get_build_requires self.run_setup() File "C:\Users\wlorenz\AppData\Local\Temp\pip-build-env-iwg3sjsg\overlay\Lib\site-packages\setuptools\build_meta.py", line 313, in run_setup exec(code, locals()) File "", line 214, in File "C:\Users\wlorenz\AppData\Local\Temp\pip-install-a7uion6b\pygeos_b3b5606d5ed24b8a882c1afc14919a92\versioneer.py", line 1480, in get_version return get_versions()["version"] ^^^^^^^^^^^^^^ File "C:\Users\wlorenz\AppData\Local\Temp\pip-install-a7uion6b\pygeos_b3b5606d5ed24b8a882c1afc14919a92\versioneer.py", line 1412, in get_versions cfg = get_config_from_root(root) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wlorenz\AppData\Local\Temp\pip-install-a7uion6b\pygeos_b3b5606d5ed24b8a882c1afc14919a92\versioneer.py", line 342, in get_config_from_root parser = configparser.SafeConfigParser() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'? [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.**_
johanvdw commented 3 months ago

Can you try installing pygeos using conda? ie conda install pygeos before running pip install niche_vlaanderen.

Wardlorenz commented 3 months ago

Thanks Johan for the quick answer,

I tried to install Pygeos seperately in conda, which lead to a new error - mentioning that our python version is not-compatible with the installation of pygeos

Apparently Pygeos is (and will not) be updated to the python version of 3.12.

We can bypass this problem by running the niche environment in the python 3.9 version (apparently stated on the Github page). Installation seems to be successful after this.

Thanks for the feedback!

Sachagobeyn commented 1 month ago

@johanvdw :

I tried with pinning the version on 3.9 (and 3.11). The install succeeds, yet a (unrelated?) GDAL warning occurs when running

niche --help

Output:

Warning 3: Cannot find header.dxf (GDAL_DATA is not defined)
Cannot find header.dxf (GDAL_DATA is not defined)
Usage: niche [OPTIONS] [CONFIG]

  Command line interface to the NICHE vegetation model

Options:
  --example  prints an example configuration file
  --version  prints the version number
  --help     Show this message and exit.

The model works, so I would assume this warning has no consequence

johanvdw commented 1 month ago

@Sachagobeyn can you double check this error still occurs after reactivating the environment, cfr what is said here "

You can verify the installation was successful by running the command line interface. Note you must activate niche once more, because some changes were made during installation."

The changes are actually defining these environment variables (GDAL_DATA and PROJ_DATA°.

Sachagobeyn commented 1 month ago

@Sachagobeyn can you double check this error still occurs after reactivating the environment, cfr what is said here "

You can verify the installation was successful by running the command line interface. Note you must activate niche once more, because some changes were made during installation."

The changes are actually defining these environment variables (GDAL_DATA and PROJ_DATA°.

I retried with the new instructions, does not occur anymore: https://github.com/inbo/niche_vlaanderen/pull/385

stijnvanhoey commented 1 week ago

Handled by #385, closing this one. Feel free to reopen when installation instruction is not clear.