I tried to install gdal (pip install gdal)in virtualenvwrapper environment but I got this error :
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for gdal
Failed to build gdal
I tried also "pip install --no-install GDAL" but there is nooption --no-install
what should I do !?
On MacOS, first do brew install:
Then do pip install:
Yes, installing GDAL in a venv is a doozy. Conveniently, I just wrote up the documentation on how to do so for my advisor's lab! While I am not savvy enough to pinpoint the exact cause of your error, I can give you a bunch of things to try to fix it.
First, ensure you have gdal installed on the host (i.e. not in a venv). I just run the following:
Now run
gdal-config --version
to get the version thatapt-get
provided you with. For example I get1.11.3
Now, the easiest way in my experience to get the python bindings in a venv is using
pygdal
. The trick is to get the right version! To do so, activate your virtual environment and runbut replace the version with whatever you got from
gdal-config --version
. Note: you may get an error that saysIf that happens, run the
pip install
again but with the highest version that still matches. e.g. in this case you would runpip install pygdal==1.11.3.3
Once
pygdal
has been successfully installed, you should be able to callPlease let me know if anything fails and I'll do what I can to adjust my instructions. Also, if you need help with Proj.4, GEOS, or Cartopy, I have some experience there too.
use pygdal