Unable to install deepforestr because libgdal is out of date
priyapatel1 opened this issue · comments
I'm trying to install deepforestr on my computer. I was able to run the following with no issue:
conda create -n deepforest python=3 pytorch torchvision -c pytorch
conda activate deepforest
conda install deepforest -c conda-forge
However, when moving on to the R portion of the installation, I came across an error related to libgdal when trying to install the spatial dependencies:
This is what I ran in my R session:
install.packages('reticulate') # Install R package for interacting with Python
reticulate::install_miniconda() # Install Python
These previous two lines ran fine. THEN, I ran the following:
reticulate::py_install(c('gdal', 'rasterio', 'fiona')) # Install spatial dependencies via conda
This is the error I get:
Using virtual environment '/Users/priyapatel/.virtualenvs/r-reticulate' ...
+ /Users/priyapatel/.virtualenvs/r-reticulate/bin/python -m pip install --upgrade --no-user gdal rasterio fiona
Collecting gdal
Using cached GDAL-3.9.0.tar.gz (839 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [53 lines of output]
Using numpy 2.0.0
running egg_info
writing gdal-utils/GDAL.egg-info/PKG-INFO
writing dependency_links to gdal-utils/GDAL.egg-info/dependency_links.txt
writing entry points to gdal-utils/GDAL.egg-info/entry_points.txt
writing requirements to gdal-utils/GDAL.egg-info/requires.txt
writing top-level names to gdal-utils/GDAL.egg-info/top_level.txt
Traceback (most recent call last):
File "/Users/priyapatel/.virtualenvs/r-reticulate/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Users/priyapatel/.virtualenvs/r-reticulate/lib/python3.9/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/priyapatel/.virtualenvs/r-reticulate/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
self.run_setup()
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "<string>", line 421, in <module>
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 103, in setup
return distutils.core.setup(**attrs)
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 184, in setup
return run_commands(dist)
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
dist.run_commands()
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 976, in run_command
super().run_command(command)
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 321, in run
self.find_sources()
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 329, in find_sources
mm.run()
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 550, in run
self.add_defaults()
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 588, in add_defaults
sdist.add_defaults(self)
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/command/sdist.py", line 102, in add_defaults
super().add_defaults()
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 250, in add_defaults
self._add_defaults_ext()
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 334, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 303, in get_finalized_command
cmd_obj.ensure_finalized()
File "/private/var/folders/rl/sgxmp5k545q93m0wrgmjlssr0000gn/T/pip-build-env-o98cq5q5/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
self.finalize_options()
File "<string>", line 276, in finalize_options
Exception: Python bindings of GDAL 3.9.0 require at least libgdal 3.9.0, but 3.8.4 was found
[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.
Error: Error installing package(s): 'gdal', 'rasterio', 'fiona'
How do I go about resolving this?
Environment (please complete the following information):
- OS: MacOS
- Python version and environment : Python 3.12.2
User Story
I want to create tree canopy datasets across Canada - I'm a research at the University of Toronto School of Public Health.
hi @priyapatel1 , DeepForestR is definitely more experimental, but let's try to get you where you need to be. I assume you are more comfortable in R than python, the python pip install is usually pretty painless. Its all the conda that makes the challenge. Calling in @henrykironde who knows more about R install than I do. Can we move this convo to the correct repo. Just copy and paste the issue there.
Thanks @bw4sz - definitely more of an R user. Will move the issue over.