1

I saw this post here:

Installing GDAL on CentOS?

And got the EPEL 7 installed, then did a sudo yum install gdal and it did its thing without errors. However when trying to do a sudo pip install gdal I get the following error:

Collecting gdal
  Using cached GDAL-2.1.0.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'
    warning: manifest_maker: standard file '-c' not found

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-xKfiOH/gdal/setup.py", line 320, in <module>
        **extra )
      File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 185, in run
        self.find_sources()
      File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 261, in find_sources
        mm.run()
      File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 327, in run
        self.add_defaults()
      File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 363, in add_defaults
        sdist.add_defaults(self)
      File "/usr/lib/python2.7/site-packages/setuptools/command/sdist.py", line 231, in add_defaults
        build_ext = self.get_finalized_command('build_ext')
      File "/usr/lib64/python2.7/distutils/cmd.py", line 312, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/usr/lib64/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/tmp/pip-build-xKfiOH/gdal/setup.py", line 195, in finalize_options
        self.gdaldir = self.get_gdal_config('prefix')
      File "/tmp/pip-build-xKfiOH/gdal/setup.py", line 175, in get_gdal_config
        return fetch_config(option)
      File "/tmp/pip-build-xKfiOH/gdal/setup.py", line 128, 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-xKfiOH/gdal/

No idea what this error is telling me (besides maybe it is a config file, btw easy_install gave me an error of this:

Searching for gdal
Reading https://pypi.python.org/simple/gdal/
Best match: GDAL 2.1.0
Downloading https://pypi.python.org/packages/d1/98/27fff31ad298f3ec50db19dc3adfd8387279e158b1c6331c531c5fc7d830/GDAL-2.1.0.tar.gz#md5=64084a5f114b4dffc53280e28d2ba4f3
Processing GDAL-2.1.0.tar.gz
Writing /tmp/easy_install-bFVEUq/GDAL-2.1.0/setup.cfg
Running GDAL-2.1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-bFVEUq/GDAL-2.1.0/egg-dist-tmp-MgCGUr
Traceback (most recent call last):
  File "/bin/easy_install", line 9, in <module>
    load_entry_point('setuptools==0.9.8', 'console_scripts', 'easy_install')()
  File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1992, in main
    with_ei_usage(lambda:
  File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1979, in with_ei_usage
    return f()
  File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1996, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 380, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 623, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 653, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 849, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1130, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1115, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.7/site-packages/setuptools/sandbox.py", line 69, in run_setup
    lambda: execfile(
  File "/usr/lib/python2.7/site-packages/setuptools/sandbox.py", line 120, in run
    return func()
  File "/usr/lib/python2.7/site-packages/setuptools/sandbox.py", line 71, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", line 320, in <module>
  File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 177, in run
    self.run_command("egg_info")
  File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 185, in run
    self.find_sources()
  File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 261, in find_sources
    mm.run()
  File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 327, in run
    self.add_defaults()
  File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 363, in add_defaults
    sdist.add_defaults(self)
  File "/usr/lib/python2.7/site-packages/setuptools/command/sdist.py", line 231, in add_defaults
    build_ext = self.get_finalized_command('build_ext')
  File "/usr/lib64/python2.7/distutils/cmd.py", line 312, in get_finalized_command
    cmd_obj.ensure_finalized()
  File "/usr/lib64/python2.7/distutils/cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File "setup.py", line 195, in finalize_options
  File "setup.py", line 175, in get_gdal_config
  File "setup.py", line 128, in fetch_config
  File "<string>", line 4, in <module>
__main__.gdal_config_error: [Errno 2] No such file or directory

I haven gdal running on my mac just fine just when I try to install it on centos do I get these errors. I am sure I am missing something no idea what. My version of python on this server I am trying to get gdal on is 2.7.5 which I know is old not sure if that is a factor or not.

2 Answers 2

2

For CentOS 7: You will need two prerequisite packages before installing the GDAL pip package.

yum install gdal-devel gcc

Then you should have the required packages to install via pip

pip install GDAL
1

I was finally successful after using these options, suggested by Arpad Horvath on stack overflow

sudo pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==1.10.0

works for centos 7 and ubuntu 16.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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