mdp0023 / SVInsight

SVInsight: A python package for calculating an exploratory social vulnerability index (SVI).
https://mdp0023.github.io/SVInsight/
Other
6 stars 1 forks source link

Installation Requirements #6

Open dataspider opened 3 weeks ago

dataspider commented 3 weeks ago

You seem to have a "hidden" dependency on gdal that can cause installation problems.
Below is the error I got when running pip install SVInsight on a MacBook Pro 2018 with macOS Ventura 13.4 in a regular virtual environment (as, e.g., PyCharm suggests based on the setup files when one opens the project locally). Using a conda environment and installing geopandas first fixed the problem without the need to install gdal via brew. Please either fix the dependency issue such that pip install SVInsight works in the "standard" virtual environments or document the dependency on gdal and suggest a workaround (e.g., the one I described above) for those who don't have gdal installed (one of gdal's dependencies is llvm, so this is not a light install). You might also want to consider distributing the package via conda-forge, which would allow you to handle the CPP dependencies already at build time.

...
Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'error'

  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [29 lines of output]
      Traceback (most recent call last):
        File "/Users/c/gits/SVInsight-JOSS-Review/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/c/gits/SVInsight-JOSS-Review/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/c/gits/SVInsight-JOSS-Review/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/gb/wn39rs4d4c78qc1gyn183wp80000gs/T/pip-build-env-3thein2u/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 376, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/private/var/folders/gb/wn39rs4d4c78qc1gyn183wp80000gs/T/pip-build-env-3thein2u/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 319, in run_setup
          exec(code, locals())
        File "<string>", line 154, in <module>
        File "<string>", line 129, in get_gdal_config
        File "<string>", line 85, in get_gdal_config
        File "<string>", line 85, in <dictcomp>
        File "<string>", line 39, in read_response
        File "/Users/c/mambaforge/lib/python3.11/subprocess.py", line 466, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/c/mambaforge/lib/python3.11/subprocess.py", line 548, in run
          with Popen(*popenargs, **kwargs) as process:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/c/mambaforge/lib/python3.11/subprocess.py", line 1026, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "/Users/c/mambaforge/lib/python3.11/subprocess.py", line 1955, in _execute_child
          raise child_exception_type(errno_num, err_msg, err_filename)
      FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

https://github.com/openjournals/joss-reviews/issues/7212

dataspider commented 3 weeks ago

Also, please add pytest to the dev dependencies in your pyproject.toml and be at least one level more specific than "*" for pinning dependencies.

mdp0023 commented 2 weeks ago

Thank you for the feedback. I had trouble recreating your issue, but I am aware that gdal can be a difficult dependency to install. I therefore added some information on the installation guide about this potential requirement (depending on the user’s coding environment). Please let me know if this is insufficient and I can work on additional documentation. I also added the most recent versions of the dependencies and added pytest as a development dependency.

dataspider commented 3 days ago

Thank you for the updates; I would probably still add the conda workaround I sketched above somewhere in the docs (I'd keep it simple in the README and point to a more elaborate Installation section in your online docs for trouble-shooting). Also, there is an "it's/its" typo in the installation instructions now that you may want to fix :)

mdp0023 commented 1 day ago

Sounds good, I will add your more specific workaround (and other possible solutions) to the docs website and keep it simple in the README. Thanks for the typo find too