0

I tried to install GDAL on my local machine (Mac OS 10.15.7) using pip (pip3 install gdal), but pip gave me this really long error message that I cannot quite interpret. I sort of get the idea that it expects a file called gdal-config, but I have no idea what this file could be, and running pip3 install gdal-config just tells me that "gdal-config" isn't the name of anything that's available to be installed.

The full error message is listed below, in case anyone can get a better interpretation than I can:

Walt@WaltsMac gdal % pip install gdal -t . 
Collecting gdal
  Using cached GDAL-3.2.0.tar.gz (602 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py'"'"'; __file__='"'"'/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-pip-egg-info-m7leal34
         cwd: /private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/
    Complete output (118 lines):
    running egg_info
    creating /private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-pip-egg-info-m7leal34/GDAL.egg-info
    writing /private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-pip-egg-info-m7leal34/GDAL.egg-info/PKG-INFO
    writing dependency_links to /private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-pip-egg-info-m7leal34/GDAL.egg-info/dependency_links.txt
    writing requirements to /private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-pip-egg-info-m7leal34/GDAL.egg-info/requires.txt
    writing top-level names to /private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-pip-egg-info-m7leal34/GDAL.egg-info/top_level.txt
    writing manifest file '/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-pip-egg-info-m7leal34/GDAL.egg-info/SOURCES.txt'
    Traceback (most recent call last):
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in __init__
        restore_signals, start_new_session)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config': '../../apps/gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 250, in get_gdal_config
        return fetch_config(option, gdal_config=self.gdal_config)
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    __main__.gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config': '../../apps/gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in __init__
        restore_signals, start_new_session)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config': 'gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 257, in get_gdal_config
        return fetch_config(option)
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    __main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config': 'gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 471, in <module>
        setup(**setup_kwargs)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 296, in run
        self.find_sources()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 303, in find_sources
        mm.run()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 534, in run
        self.add_defaults()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 570, in add_defaults
        sdist.add_defaults(self)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/distutils/command/sdist.py", line 228, in add_defaults
        self._add_defaults_ext()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/distutils/command/sdist.py", line 311, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 320, in finalize_options
        self.gdaldir = self.get_gdal_config('prefix')
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 263, in get_gdal_config
        raise gdal_config_error(traceback_string + '\n' + msg)
    __main__.gdal_config_error: Traceback (most recent call last):
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in __init__
        restore_signals, start_new_session)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config': '../../apps/gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 250, in get_gdal_config
        return fetch_config(option, gdal_config=self.gdal_config)
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config': '../../apps/gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in __init__
        restore_signals, start_new_session)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config': 'gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 257, in get_gdal_config
        return fetch_config(option)
      File "/private/var/folders/h7/qdytckhj3sg7f60jg3_xf_lm0000gn/T/pip-install-3ers_bjs/gdal/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    gdal_config_error: [Errno 2] No such file or directory: 'gdal-config': 'gdal-config'
    
    Could not find gdal-config. Make sure you have installed the GDAL native library and development headers.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  • https://stackoverflow.com/search?q=%5Bgdal%5D+%5Bpip%5D++No+such+file+or+directory+gdal-config – phd Nov 20 '20 at 23:20
  • `pip install gdal` installs a [Python wrapper for GDAL](https://pypi.org/project/GDAL/) but the wrapper requires [the very GDAL](https://gdal.org/download.html) which is a library written in C++. – phd Nov 20 '20 at 23:21

0 Answers0