1

I need the osgeo and GDAL libraries in python code. So, I imported them and I compiled to check whether they are installed or not (I'm not a python expert), and as expected the libraries do not exist. So, I tried to install it using the pycharm setting tools.

For the osgeo, I found two possibilities.

  • Django-osgeo-importer.
  • Django-osgeo-importer-client.

and the installation was successful. But for the GDAL I've got an error (see figure). pycharm error window

And I tried also to install the GDAL from the terminal and also I got this error:

anoir@anoir-Lenovo-IdeaPad-Y510P:~$ sudo -H pip install GDAL
Collecting GDAL
  Using cached GDAL-2.2.1.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-5IPiZv/GDAL/setup.py", line 339, in <module>
    **extra )
    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 280, in run
    self.find_sources()
    File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 295, in find_sources
    mm.run()
    File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 526, in run
    self.add_defaults()
    File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 562, 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-5IPiZv/GDAL/setup.py", line 214, in finalize_options
    self.gdaldir = self.get_gdal_config('prefix')
    File "/tmp/pip-build-5IPiZv/GDAL/setup.py", line 188, in get_gdal_config
    return fetch_config(option)
    File "/tmp/pip-build-5IPiZv/GDAL/setup.py", line 141, 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.by egg_info" failed with error code 1 in /tmp/pip-build-5IPiZv/GDAL/

So I tried to follow this tutorial Installing GDAL/OGR on Ubuntu and it worked but when I compile the scripts the same problem persists.

Any ideas please?

A.nechi
  • 197
  • 3
  • 17

1 Answers1

0

'Unofficial Windows Binaries for Python Extension Packages'as webpage suggests for modules required.You must discuss a test as 'from osgeo import gdal,osr,ogr' after installation with pip install.By the way,I experienced a module error after shorttime of this type modules.So,you must install again same fileEkrem Erkuş,Geophysicist