1

I am having trouble installing GDAL on Google Cloud Datalab. When I run:

!pip install gdal

I get the following error

Collecting gdal
Using cached GDAL-2.2.4.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/GDAL.egg-info
writing pip-egg-info/GDAL.egg-info/PKG-INFO
writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
writing dependency_links to pip-egg-info/GDAL.egg- 
info/dependency_links.txt
writing manifest file 'pip-egg-info/GDAL.egg-info/SOURCES.txt'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-umhRKK/gdal/setup.py", line 342, in <module>
    **extra )
  File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", 
  line 129, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in 
  run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 278, in run
    self.find_sources()
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 293, in find_sources
    mm.run()
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 524, in run
    self.add_defaults()
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 560, in add_defaults
    sdist.add_defaults(self)
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/py36compat.py", line 36, in add_defaults
    self._add_defaults_ext()
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/py36compat.py", line 119, in _add_defaults_ext
    build_ext = self.get_finalized_command('build_ext')
  File "/usr/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
    cmd_obj.ensure_finalized()
  File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File "/tmp/pip-build-umhRKK/gdal/setup.py", line 217, in finalize_options
    self.gdaldir = self.get_gdal_config('prefix')
  File "/tmp/pip-build-umhRKK/gdal/setup.py", line 191, in get_gdal_config
    return fetch_config(option)
  File "/tmp/pip-build-umhRKK/gdal/setup.py", line 144, in fetch_config
    raise gdal_config_error, e""")
  File "<string>", line 4, in <module>
__main__.gdal_config_error: [Errno 2] No such file or directory

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-umhRKK/gdal/

Same thing goes for :

!pip install gdal==2.2

or :

!pip install python-gdal

and a few other similar commands I have tried. The fix I discovered which was to update the setup-tools still gives me this problem after updating it. What is the problem?

1

Check the following tutorial. It guides you to installation with apt-get : http://www.acgeospatial.co.uk/colaboratory-notebooks-and-gdal/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.