Hola a todos y todas, cuando quiero instalar la libreria Gdal me tira el siguiente error
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for gdal
Failed to build gdal
ERROR: Could not build wheels for gdal, which is required to install pyproject.toml-based projects
intente resolverlo instalándolo con el siguiente comando:
pip install gdal --no-binary :all:
pero me dice lo mismo.
Si alguien puede ayudarme se lo agradezco
Tengo la versión Python 3.12.2 y según leí en internet ¿no funciona con esta versión ?
Hola,
No es un problema de la versión, probablemente sea que te falta instalar
dependencias para que pip pueda compilar el wheel.
Para ayudarte, necesitaríamos saber como y donde instalaste python,
estas usando Windows, Linux, Macos, FreeBSD, etc? lo instalaste
descargandolo de python.org o desde algun manejador de paquetes (deb,
rpm, etc.)? Instalaste librerias de desarrollo (como por ejemplo glibc o
el runtime de c de visual studio)?
Además podes usar la opcion -v de pip para que te de mas detalles de lo
que pasa (poniendo hasta 3 v para incrementar el nivel de detalle.). Por
eso te aconsejaria que postees el resultado de pip install -vvv gdal
Saludos,
Javier.
Gracias por la respuesta. Yo trabajo con Windows y directamente uso la IDLE Shell que viene con el programa, también uso visual studio (no probé si funciona desde aca). No soy un usuario frecuente asi que no tengo instalado nada de las librerías que mencionas
EL resultado de correr el codigo es
error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: Microsoft C++ Build Tools - Visual Studio
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: ‘C:\Users\Usuario\AppData\Local\Programs\Python\Python312\python.exe’ -u -c ’
exec(compile(‘"’“‘’”‘"’‘"’"’
This is – a caller that pip uses to run setup.py
- It imports setuptools before invoking setup.py, to enable projects that directly
import from distutils.core
to work with newer packaging standards.
- It provides a clear error message when setuptools is not installed.
- It sets sys.argv[0]
to the underlying setup.py
, when invoking setup.py
so
setuptools doesn’“'”'t think the script is -c
. This avoids the following warning:
manifest_maker: standard file ‘"’“‘-c’”‘"’ not found".
- It generates a shim setup.py, for handling setup.cfg-only projects.
import os, sys, tokenize
try:
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute setup.py
since setuptools is not available in "
“the build environment.”,
file=sys.stderr,
)
sys.exit(1)
file = %r
sys.argv[0] = file
if os.path.exists(file):
filename = file
with tokenize.open(file) as f:
setup_py_code = f.read()
else:
filename = “”
setup_py_code = “from setuptools import setup; setup()”
exec(compile(setup_py_code, filename, “exec”))
‘"’“‘’”‘"’‘"’“’ % ('”‘“‘C:\Users\Usuario\AppData\Local\Temp\pip-install-osy3yuob\gdal_0a63436913624e27b44d97d8095e08de\setup.py’”’"‘,), “”, “exec”))’ bdist_wheel -d ‘C:\Users\Usuario\AppData\Local\Temp\pip-wheel-ebrd40hh’
cwd: C:\Users\Usuario\AppData\Local\Temp\pip-install-osy3yuob\gdal_0a63436913624e27b44d97d8095e08de
error
ERROR: Failed building wheel for gdal
Running setup.py clean for gdal
Running command python setup.py clean
running clean
removing ‘build\lib.win-amd64-cpython-312’ (and everything under it)
‘build\bdist.win-amd64’ does not exist – can’t clean it
‘build\scripts-3.12’ does not exist – can’t clean it
removing ‘build’
Failed to build gdal
ERROR: Could not build wheels for gdal, which is required to install pyproject.toml-based projects
Exception information:
Traceback (most recent call last):
File “C:\Users\Usuario\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_internal\cli\base_command.py”, line 180, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File “C:\Users\Usuario\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_internal\cli\req_command.py”, line 245, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\Usuario\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_internal\commands\install.py”, line 429, in run
raise InstallationError(
pip._internal.exceptions.InstallationError: Could not build wheels for gdal, which is required to install pyproject.toml-based projects
Remote version of pip: 24.0
Local version of pip: 24.0
Was pip installed by pip? True
Removed build tracker: ‘C:\Users\Usuario\AppData\Local\Temp\pip-build-tracker-vf20q3gj’
Saludos
La primer linea del error te dice que es lo que te falta instalar y
donde conseguirlo: “error: Microsoft Visual C++ 14.0 or greater is
required. Get it with “Microsoft C++ Build Tools”: Microsoft C++ Build
Tools - Visual Studio
https://visualstudio.microsoft.com/visual-cpp-build-tools/”
Para poder compilar te falta instalar los build tools de C de Visual
studio. Instalando eso te deberia funcionar.
Saludos,
Javier.
Hola Javier, muchas gracias por tu ayuda. descargue e instale Microsoft C++ Build Tools y volvi a correr el comando pip install -vvv gdal y si bien hace mas cosas que antes me sigue apareciendo un error
error: command ‘C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\bin\HostX86\x64\cl.exe’ failed with exit code 2
error: subprocess-exited-with-error
× Building wheel for gdal (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: ‘C:\Users\Usuario\AppData\Local\Programs\Python\Python312\python.exe’ ‘C:\Users\Usuario\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py’ build_wheel ‘C:\Users\Usuario\AppData\Local\Temp\tmpzlkvwnp7’
cwd: C:\Users\Usuario\AppData\Local\Temp\pip-install-2yfabt9_\gdal_ff086a7c527d43e2a4dd43df46c68eec
Building wheel for gdal (pyproject.toml) … error
ERROR: Failed building wheel for gdal
Failed to build gdal
ERROR: Could not build wheels for gdal, which is required to install pyproject.toml-based projects
Exception information:
Traceback (most recent call last):
File “C:\Users\Usuario\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_internal\cli\base_command.py”, line 180, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File “C:\Users\Usuario\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_internal\cli\req_command.py”, line 245, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\Usuario\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_internal\commands\install.py”, line 429, in run
raise InstallationError(
pip._internal.exceptions.InstallationError: Could not build wheels for gdal, which is required to install pyproject.toml-based projects
Remote version of pip: 24.0
Local version of pip: 24.0
Was pip installed by pip? True
Removed build tracker: ‘C:\Users\Usuario\AppData\Local\Temp\pip-build-tracker-5nfe3fyc’
La verdad no se como seguir
Saludos
Ka verdad es que no veo la causa de tu error, yo desde hace mas de 10
años que no uso windows, asi que no podria reproducirlo, pero probaria
ejecutar lo que dice en “full command” a ver que te dice, y googlear
instalacion de gdal en windows. Lo mejor seria fijarte su conseguis el
wheel e instalar directamente el wheel.