1 votos

Error al instalar GDAL 3.0.4 en Ubuntu 18.04

Estoy tratando de instalar GDAL a través de pip con la misma versión en el sistema. Pero estoy recibiendo este error:

(app_env) user@server:~$ pip install gdal==3.0.4
Collecting gdal==3.0.4
  Using cached GDAL-3.0.4.tar.gz (577 kB)
Building wheels for collected packages: gdal
  Building wheel for gdal (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/server/.virtualenvs/wetland_env/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g163k7vu/gdal_049a3c8408cb41aea58042c9b1cf4637/setup.py'"'"'; __file__='"'"'/tmp/pip-install-g163k7vu/gdal_049a3c8408cb41aea58042c9b1cf4637/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-fek8joed
       cwd: /tmp/pip-install-g163k7vu/gdal_049a3c8408cb41aea58042c9b1cf4637/
  Complete output (36 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  copying gdal.py -> build/lib.linux-x86_64-3.8
  copying ogr.py -> build/lib.linux-x86_64-3.8
  copying osr.py -> build/lib.linux-x86_64-3.8
  copying gdalconst.py -> build/lib.linux-x86_64-3.8
  copying gdalnumeric.py -> build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/osgeo
  copying osgeo/gnm.py -> build/lib.linux-x86_64-3.8/osgeo
  copying osgeo/gdal.py -> build/lib.linux-x86_64-3.8/osgeo
  copying osgeo/gdal_array.py -> build/lib.linux-x86_64-3.8/osgeo
  copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.8/osgeo
  copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.8/osgeo
  copying osgeo/ogr.py -> build/lib.linux-x86_64-3.8/osgeo
  copying osgeo/__init__.py -> build/lib.linux-x86_64-3.8/osgeo
  copying osgeo/osr.py -> build/lib.linux-x86_64-3.8/osgeo
  /home/server/.virtualenvs/wetland_env/lib/python3.8/site-packages/setuptools/lib2to3_ex.py:36: SetuptoolsDeprecationWarning: 2to3 support is deprecated. If the project still requires Python 2 support, please migrate to a single-codebase solution or employ an independent conversion process.
    warnings.warn(
  Fixing build/lib.linux-x86_64-3.8/gdal.py build/lib.linux-x86_64-3.8/ogr.py build/lib.linux-x86_64-3.8/osr.py build/lib.linux-x86_64-3.8/gdalconst.py build/lib.linux-x86_64-3.8/gdalnumeric.py build/lib.linux-x86_64-3.8/osgeo/gnm.py build/lib.linux-x86_64-3.8/osgeo/gdal.py build/lib.linux-x86_64-3.8/osgeo/gdal_array.py build/lib.linux-x86_64-3.8/osgeo/gdalconst.py build/lib.linux-x86_64-3.8/osgeo/gdalnumeric.py build/lib.linux-x86_64-3.8/osgeo/ogr.py build/lib.linux-x86_64-3.8/osgeo/__init__.py build/lib.linux-x86_64-3.8/osgeo/osr.py
  Skipping optional fixer: ws_comma
  Fixing build/lib.linux-x86_64-3.8/gdal.py build/lib.linux-x86_64-3.8/ogr.py build/lib.linux-x86_64-3.8/osr.py build/lib.linux-x86_64-3.8/gdalconst.py build/lib.linux-x86_64-3.8/gdalnumeric.py build/lib.linux-x86_64-3.8/osgeo/gnm.py build/lib.linux-x86_64-3.8/osgeo/gdal.py build/lib.linux-x86_64-3.8/osgeo/gdal_array.py build/lib.linux-x86_64-3.8/osgeo/gdalconst.py build/lib.linux-x86_64-3.8/osgeo/gdalnumeric.py build/lib.linux-x86_64-3.8/osgeo/ogr.py build/lib.linux-x86_64-3.8/osgeo/__init__.py build/lib.linux-x86_64-3.8/osgeo/osr.py
  Skipping optional fixer: ws_comma
  running build_ext
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/server/.virtualenvs/wetland_env/include -I/usr/include/python3.8 -I/home/server/.virtualenvs/wetland_env/lib/python3.8/site-packages/numpy/core/include -I/usr/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o
  building 'osgeo._gdal' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/extensions
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/server/.virtualenvs/wetland_env/include -I/usr/include/python3.8 -I/home/server/.virtualenvs/wetland_env/lib/python3.8/site-packages/numpy/core/include -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.8/extensions/gdal_wrap.o -I/usr/include/gdal
  extensions/gdal_wrap.cpp:173:11: fatal error: Python.h: No such file or directory
   # include <Python.h>
             ^~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for gdal
  Running setup.py clean for gdal
Failed to build gdal
Installing collected packages: gdal
    Running setup.py install for gdal ... error
    ERROR: Command errored out with exit status 1:
     command: /home/server/.virtualenvs/wetland_env/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g163k7vu/gdal_049a3c8408cb41aea58042c9b1cf4637/setup.py'"'"'; __file__='"'"'/tmp/pip-install-g163k7vu/gdal_049a3c8408cb41aea58042c9b1cf4637/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-21n68w5w/install-record.txt --single-version-externally-managed --compile --install-headers /home/server/.virtualenvs/wetland_env/include/site/python3.8/gdal
         cwd: /tmp/pip-install-g163k7vu/gdal_049a3c8408cb41aea58042c9b1cf4637/
    Complete output (36 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    copying gdal.py -> build/lib.linux-x86_64-3.8
    copying ogr.py -> build/lib.linux-x86_64-3.8
    copying osr.py -> build/lib.linux-x86_64-3.8
    copying gdalconst.py -> build/lib.linux-x86_64-3.8
    copying gdalnumeric.py -> build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/osgeo
    copying osgeo/gnm.py -> build/lib.linux-x86_64-3.8/osgeo
    copying osgeo/gdal.py -> build/lib.linux-x86_64-3.8/osgeo
    copying osgeo/gdal_array.py -> build/lib.linux-x86_64-3.8/osgeo
    copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.8/osgeo
    copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.8/osgeo
    copying osgeo/ogr.py -> build/lib.linux-x86_64-3.8/osgeo
    copying osgeo/__init__.py -> build/lib.linux-x86_64-3.8/osgeo
    copying osgeo/osr.py -> build/lib.linux-x86_64-3.8/osgeo
    /home/server/.virtualenvs/wetland_env/lib/python3.8/site-packages/setuptools/lib2to3_ex.py:36: SetuptoolsDeprecationWarning: 2to3 support is deprecated. If the project still requires Python 2 support, please migrate to a single-codebase solution or employ an independent conversion process.
      warnings.warn(
    Fixing build/lib.linux-x86_64-3.8/gdal.py build/lib.linux-x86_64-3.8/ogr.py build/lib.linux-x86_64-3.8/osr.py build/lib.linux-x86_64-3.8/gdalconst.py build/lib.linux-x86_64-3.8/gdalnumeric.py build/lib.linux-x86_64-3.8/osgeo/gnm.py build/lib.linux-x86_64-3.8/osgeo/gdal.py build/lib.linux-x86_64-3.8/osgeo/gdal_array.py build/lib.linux-x86_64-3.8/osgeo/gdalconst.py build/lib.linux-x86_64-3.8/osgeo/gdalnumeric.py build/lib.linux-x86_64-3.8/osgeo/ogr.py build/lib.linux-x86_64-3.8/osgeo/__init__.py build/lib.linux-x86_64-3.8/osgeo/osr.py
    Skipping optional fixer: ws_comma
    Fixing build/lib.linux-x86_64-3.8/gdal.py build/lib.linux-x86_64-3.8/ogr.py build/lib.linux-x86_64-3.8/osr.py build/lib.linux-x86_64-3.8/gdalconst.py build/lib.linux-x86_64-3.8/gdalnumeric.py build/lib.linux-x86_64-3.8/osgeo/gnm.py build/lib.linux-x86_64-3.8/osgeo/gdal.py build/lib.linux-x86_64-3.8/osgeo/gdal_array.py build/lib.linux-x86_64-3.8/osgeo/gdalconst.py build/lib.linux-x86_64-3.8/osgeo/gdalnumeric.py build/lib.linux-x86_64-3.8/osgeo/ogr.py build/lib.linux-x86_64-3.8/osgeo/__init__.py build/lib.linux-x86_64-3.8/osgeo/osr.py
    Skipping optional fixer: ws_comma
    running build_ext
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/server/.virtualenvs/wetland_env/include -I/usr/include/python3.8 -I/home/server/.virtualenvs/wetland_env/lib/python3.8/site-packages/numpy/core/include -I/usr/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o
    building 'osgeo._gdal' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/extensions
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/server/.virtualenvs/wetland_env/include -I/usr/include/python3.8 -I/home/server/.virtualenvs/wetland_env/lib/python3.8/site-packages/numpy/core/include -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.8/extensions/gdal_wrap.o -I/usr/include/gdal
    extensions/gdal_wrap.cpp:173:11: fatal error: Python.h: No such file or directory
     # include <Python.h>
               ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/server/.virtualenvs/wetland_env/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g163k7vu/gdal_049a3c8408cb41aea58042c9b1cf4637/setup.py'"'"'; __file__='"'"'/tmp/pip-install-g163k7vu/gdal_049a3c8408cb41aea58042c9b1cf4637/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-21n68w5w/install-record.txt --single-version-externally-managed --compile --install-headers /home/server/.virtualenvs/wetland_env/include/site/python3.8/gdal Check the logs for full command output.

1voto

Hoppe Puntos 13

Probablemente necesites instalar las herramientas de desarrollo de Python ya que te falta el archivo de cabecera python.h :

para Python2 (obsoleto): apt-get install python-dev

para Python3: apt-get install python3-dev

i-Ciencias.com

I-Ciencias es una comunidad de estudiantes y amantes de la ciencia en la que puedes resolver tus problemas y dudas.
Puedes consultar las preguntas de otros usuarios, hacer tus propias preguntas o resolver las de los demás.

Powered by:

X