Python GDAL package missing header file when installing via pipNo ogr module despite having gdal...
Weird lines in Microsoft Word
How can a new country break out from a developed country without war?
Why didn’t Eve recognize the little cockroach as a living organism?
Does convergence of polynomials imply that of its coefficients?
is this saw blade faulty?
Exposing a company lying about themselves in a tightly knit industry: Is my career at risk on the long run?
Which partition to make active?
PTIJ: Which Dr. Seuss books should one obtain?
Exit shell with shortcut (not typing exit) that closes session properly
What happens when the centripetal force is equal and opposite to the centrifugal force?
When did hardware antialiasing start being available?
Unfrosted light bulb
Hot air balloons as primitive bombers
Nested Dynamic SOQL Query
What is the tangent at a sharp point on a curve?
PTIJ: Where did Achashverosh's years wander off to?
Writing in a Christian voice
label a part of commutative diagram
How to determine the greatest d orbital splitting?
Symbolism of 18 Journeyers
What are the consequences of changing the number of hours in a day?
Why are there no stars visible in cislunar space?
Does the Shadow Magic sorcerer's Eyes of the Dark feature work on all Darkness spells or just his/her own?
Help with identifying unique aircraft over NE Pennsylvania
Python GDAL package missing header file when installing via pip
No ogr module despite having gdal installed?Installing GDAL in Python on Windows 7?Install GDAL Python binding on macGDAL install on Mac: pip doesn't see gdal.hGDAL 2.3.1 is installed but the llinux terminal is using GDAL 2.2.2Running python GDAL in repl.itBuilding FGDB support for GDAL 1.10 on UbuntuInstalling python GDAL with pip in local (user) space on RHEL6 server: failure due to missing headersPython pyModis installation give error on windows 10 using pip install pyModisError Installing GDAL python package on a MACInstalling GDAL2.1Install GDAL python package in virtualenv on macGDAL install on Mac: pip doesn't see gdal.hPyWPS installation won't see cpl_port.hRunning python GDAL in repl.itGDAL 2.3.1 is installed but the llinux terminal is using GDAL 2.2.2
I asked this question on Stack Overflow before I realised this site existed. As this site it more appropriate, I'll ask it here too.
I'm trying to install gdal from pip pip install gdal
inside a virtual environment (Ubuntu). It fails because it cannot find cpl_port.h
extensions/gdal_wrap.cpp:2853:22: fatal error: cpl_port.h: No such file or directory
compilation terminated
However GDAL is installed correctly and the header file is located at /usr/include/gdal/cpl_port.h
. Is there some environment variable for GDAL that needs to be set in order for pip to find the header files?
python gdal ubuntu installation
add a comment |
I asked this question on Stack Overflow before I realised this site existed. As this site it more appropriate, I'll ask it here too.
I'm trying to install gdal from pip pip install gdal
inside a virtual environment (Ubuntu). It fails because it cannot find cpl_port.h
extensions/gdal_wrap.cpp:2853:22: fatal error: cpl_port.h: No such file or directory
compilation terminated
However GDAL is installed correctly and the header file is located at /usr/include/gdal/cpl_port.h
. Is there some environment variable for GDAL that needs to be set in order for pip to find the header files?
python gdal ubuntu installation
I have similar issue on windows, installing gdal via pip in virtual env. ![enter image description here](i.stack.imgur.com/EVLWP.jpg)
– Hayat Khan
Aug 22 '18 at 7:39
add a comment |
I asked this question on Stack Overflow before I realised this site existed. As this site it more appropriate, I'll ask it here too.
I'm trying to install gdal from pip pip install gdal
inside a virtual environment (Ubuntu). It fails because it cannot find cpl_port.h
extensions/gdal_wrap.cpp:2853:22: fatal error: cpl_port.h: No such file or directory
compilation terminated
However GDAL is installed correctly and the header file is located at /usr/include/gdal/cpl_port.h
. Is there some environment variable for GDAL that needs to be set in order for pip to find the header files?
python gdal ubuntu installation
I asked this question on Stack Overflow before I realised this site existed. As this site it more appropriate, I'll ask it here too.
I'm trying to install gdal from pip pip install gdal
inside a virtual environment (Ubuntu). It fails because it cannot find cpl_port.h
extensions/gdal_wrap.cpp:2853:22: fatal error: cpl_port.h: No such file or directory
compilation terminated
However GDAL is installed correctly and the header file is located at /usr/include/gdal/cpl_port.h
. Is there some environment variable for GDAL that needs to be set in order for pip to find the header files?
python gdal ubuntu installation
python gdal ubuntu installation
edited May 23 '17 at 12:39
Community♦
1
1
asked Jul 5 '12 at 17:38
kevinkevin
406153
406153
I have similar issue on windows, installing gdal via pip in virtual env. ![enter image description here](i.stack.imgur.com/EVLWP.jpg)
– Hayat Khan
Aug 22 '18 at 7:39
add a comment |
I have similar issue on windows, installing gdal via pip in virtual env. ![enter image description here](i.stack.imgur.com/EVLWP.jpg)
– Hayat Khan
Aug 22 '18 at 7:39
I have similar issue on windows, installing gdal via pip in virtual env. ![enter image description here](i.stack.imgur.com/EVLWP.jpg)
– Hayat Khan
Aug 22 '18 at 7:39
I have similar issue on windows, installing gdal via pip in virtual env. ![enter image description here](i.stack.imgur.com/EVLWP.jpg)
– Hayat Khan
Aug 22 '18 at 7:39
add a comment |
22 Answers
22
active
oldest
votes
selimnairb's answer is close but you wont have the headers unless you've installed libgdal-dev:
sudo apt-get install libgdal-dev
with that done,
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
and then
pip install GDAL
The compilation ran to completion and I have GDAL in my virtual env. Phew!
(edit 2018) Note:
To be sure that you install the correct version and avoid any problem.
retrieve the version with gdal-config --version
.
and then:
pip install GDAL==version
Seems to be the only solution that worked.
– bozdoz
Mar 25 '14 at 16:46
1
Tried this on another system, and I think the combination of this plus @nickves answer is what actually does it.
– bozdoz
Mar 31 '14 at 23:33
This worked for me.
– jaranda
Nov 26 '14 at 10:55
Very good. In case, installed version of GDAL in system and python package differs, it fails. The solution is to find version of GDAL in system and instruct pip to install relevant python package version. In my case (Ubuntu 14.04) both are 10.0, so it helped$ pip install GDAL==10.0
– Jan Vlcinsky
Dec 3 '14 at 22:17
4
I can confirm that this works on Ubuntu 16.04 withpip install GDAL==1.10.0
.
– beruic
Aug 11 '16 at 15:38
|
show 1 more comment
Τhe header files cannot be found for some reason. Maybe you you are operating inside a Virtual Enviroment or they are not where they should be for some reason. In any case you can specify the include dirs when installing gdal via pip.
first download python's gdal :
pip install --no-install GDAL
in later versions of pip (>= 9.0.0) pip install --no-install
does not exist:
pip download GDAL
then specify where the headers are:
python setup.py build_ext --include-dirs=/usr/include/gdal/
then install it:
pip install --no-download GDAL
in later versions of pip (>= 9.0.0) pip install --no-download
does not exist:
sudo python setup.py install --include-dirs=/usr/include/gdal
Here's another way to install gdal python:
$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install python-gdal
after that open IDLE:
from osgeo import gdal
and you're good to go!
3
Hi thanks for you answer but I really need a way to install via pip as I will be creating isolated environments using virtualenv during CI process.
– kevin
Jul 8 '12 at 22:26
1
what is the output when you run 'gdal-config --version' and 'gdal-config --libs' ?
– nickves
Jul 9 '12 at 9:40
GDAL v1.9.1.gdal-config --libs -> -L/usr/lib -lgdal
– kevin
Jul 9 '12 at 17:35
2
@nickves I am trying to install GDAL using virtualenvwrapper in Ubuntu, and when I try your first line:pip install --no-install GDAL
, I get the error:__main__.gdal_config_error: [Errno 2] No such file or directory
Any idea?
– theJollySin
Mar 23 '13 at 18:36
3
I recently had a wonderful time installing GDAL on OSX. Currently, the latest Python bindings for GDAL depend on 2.1, but the latest available GDAL in homebrew is 1.11.3, and 1.11.4 for GDAL Complete. I installed via homebrew,brew install gdal
, and used an older version of the GDAL Python package:pip install --global-option=build_ext --global-option="-L/usr/local/include/gdal/" 'gdal==1.9.1'
– TestSubject
Jun 28 '16 at 0:02
|
show 3 more comments
After following a subset of this advice, this is how I got the Python GDAL 1.11.0 (the solution should be version-independent, see below) install to work on Ubuntu 14.04 with pip:
Install dependencies:
sudo apt-get install libgdal-dev libgdal1h
pip install by passing along the include path (prefix with sudo
for system-wide install) and instructing pip to install the version matching the system installed GDAL version:
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
The higher rated answers from selimnairb and Paul Whipp didn't work for me on Ubuntu 15.10 and this one did.
– rhunwicks
Nov 17 '15 at 10:34
1
The second line worked for me after apt-adding the unstable repositories from @nickves answer. Thanks to all!
– Patrick Williams
May 24 '16 at 19:54
1
Thank you, this ended up working for me. Though I had to modify slightly as I'm attempting to stick to the cartodb installation as strictly as possible, I ended up using this as my final working install command:sudo pip install --no-use-wheel -r python_requirements.txt --global-option=build_ext --global-option="-I/usr/include/gdal"
python_requirements.txt specifies an older version of gdal. I doubt it would matter to be honest, but the entire pip install set completes successfully. U 12.04x64
– vaxhax
Jul 25 '16 at 21:32
add a comment |
Installing Python package gdal
into virualenv on Linux
GDAL
provides nice toolkit for GEO related operations. However,
installing it to virtualenv on Linux is not trivial task.
This recipe describes, how to do that.
note
here I use lowercase
gdal
for Python package and upper caseGDAL
for
general system wide library.
Requirements
- allow using osgeo libraries (installed via
gdal
Python package) into
virtualenv - allow installing on Linux Ubuntu
Installation methods
There are multiple methods for installation. One requires compilation
and takes few minutes more.
The other is using wheel package of pygdal
package and is very quick.
Anyway, to create the wheel package one needs to create it once and the creation includes the compilation step anyway.
About GDAL
packages and versions
GDAL
is general C(++) based library for GEO related calculations.
GDAL
utilities can be installed system wide what makes shared libraries
available, but does not install Python package itself.
GDAL
comes in different versions and each Linux distribution may by
default install different version.
Python package gdal
requires compilation and is not trivial to install
on Linux based systems as it expects few environmental variables to be
set. This makes installation into virtualenv more difficult.
Each gdal
version might assume different version of GDAL
and will fail
installing if expected version is not present in the system.
Python package pygdal
is alternative to gdal
, which installs exactly the
same stuff as gdal
, but does it in much more virtualenv friendly manner.
pygdal
comes in versions reflecting related GDAL
version. So having GDAL
version 1.10.1 in the system you shall install pygdal
version 1.10.1.
Python package gdal
(as well as pygdal
) uses root python package named
osgeo
and has set of submodules, one being osgeo.gdal
.
If needed, other than default versions of GDAL
can be installed and
used. This is out of scope of this description.
Wheel packages can be cross-compiled, this is also out of scope.
Installing GDAL
into system
As pygdal
requires GDAL
shared libraries to be present, we must install
them first.
Assuming GDAL
is not yet installed, calling gdal-config
will complain
and give you a hint how to follow up:
$ gdal-config --version
The program 'gdal-config' is currently not installed. You can install it by typing:
sudo apt-get install libgdal-dev
Follow the hint and install it:
$ sudo apt-get install libgdal-dev
Each distribution may use different version of GDAL
. To find out which
we use:
$ gdal-config --version
1.10.1
Now you know, GDAL
is installed and the version is 1.10.1 (the version
can vary).
Install pygdal
from source package (requires compilation)
Currently pygdal
is provided only in tar.gz package, which contains
package sources and requires compilation.
Assuming, the version of GDAL
is 1.10.1
and that our virtualenv is
already activated:
$ pip install pygdal==1.10.1
It may take a while to complete, is it needs numpy, which may also
require some compilation. Just wait.
Check, it is installed:
$ pip freeze|grep pygdal
pygdal==1.10.1.0
From now on, you may use osgeo package in your Python code as you like
in exactly the same manner as if you would install it by gdal
Python
package.
Creating wheel package for pygdal
Note, that wheel packages must be created for exactly the same
architecture, namely must match:
- CPU architecture
- OS (Linux/Windows)
In our case, it must also match the version of GDAL
installed.
Following steps can be done in virtualenv or not, as you like.
First, make sure, wheel package is installed:
$ pip install wheel
Assuming, you have GDAL
installed and it has version 1.10.1:
$ pip wheel pygdal==1.10.1.0
and wait, until it completes.
After this, you shall find subdirectory wheelhouse and it shall contain
packages with extension `whl`:
$ ls wheelhouse
numpy-1.9.1-cp27-none-linux_x86_64.whl
pygdal-1.10.1.0-cp27-none-linux_x86_64.whl
Install pygdal
from wheel packages
Installation from wheel formatted packages is much faster (a second
compared to minutes), as it does not require compilation.
Note, that directory with wheel packages can have any name, we will use
just the name wheelhouse.
Activate virtualenv first.
Ensure, you have in wheelhouse directory both required wheel packages
(for pygdal
and numpy
).
Ensure, GDAL
is installed and the version matches version of pygdal
.
Install pygdal
from wheel package:
$ pip install pygdal==1.10.1.0 -f wheelhouse
The -f wheelhouse shall point to the directory with whl files.
There is no need to install numpy
, it gets installed automatically.
this anwser builds on other great answers here, tries to give complete instructions for the details, where I got stuck and adds steps for using wheel package format for speeding up repeated installs into virtualenv.
– Jan Vlcinsky
Dec 4 '14 at 9:52
pygdal
for the win!! pypi: "Virtualenv and setuptools friendly version of standard GDAL python bindings" <3
– gisdude
May 16 '18 at 18:13
add a comment |
Yes, doing the following before running PIP appears to work:
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
add a comment |
The problem with the pip installing gdal is that it only gets the bindings, not the entire library, so it can get tricky. One way to solve it is to use the pip command to download - but not install. Then you tweak the header location from the config file. Then you pip install that. meh.
I was having the same problem but realized that writing a fabric script to recompile gdal and generate the python bindings was going to take less time. You even get the benefit of filegdb with that. Go ahead and use tha gist I wrote or tweak it to your hearts content.
add a comment |
While a while later, this provides the include path without having to bail out of pip installation: One can set the include path using an environment variable.
Assuming the headers are in /usr/include/gdal, issue an
export CPLUS_INCLUDE_PATH=/usr/include/gdal
before running pip.
Using this, I get "extensions/gdalconst_wrap.c:2732:18: fatal error: gdal.h: No such file or directory" even though gdal.h is present in/usr/include/gdal
– anand.trex
May 26 '13 at 1:14
1
Does using C_INCLUDE_PATH instead/additionally helps=?
– Crischan
Jun 13 '13 at 11:34
add a comment |
After looking right and left for a solution, here is something that works for me on Ubuntu 14.04, even from within a virtualenv with no access to the system packages :
Install dependencies :
sudo apt-get install libgdal-dev libgdal1h libgdal1-dev
Set the compiler flags :
export CFLAGS=$(gdal-config --cflags)
Install the version corresponding to the system libraries (at the time of writing Ubuntu Trusty is using the 1.10 headers) :
pip install GDAL==1.10.0
also worked for me on ubuntu 16.04
– Luke W
May 25 '18 at 15:41
add a comment |
Now you can use virtualenv and setuptools friendly version of standard GDAL python bindings pygdal.
add a comment |
I was having similar problems on a Mac. This is how I resolved it:
Firstly, I set up a virtual Python 2.7 environment using virtualenv. The Python distribution was installed in a directory called 'env'.
I then used fink to install gdal
fink selfupdate
fink update-all
fink install gdal
I also installed gdal-dev but this may not have been required since it might have already been installed with gdal.
I checked the version installed using:
gdal-config --version
On my installation, it produced the result
1.11.1
The fink installation of gdal installed the cpl_port.h header file in /sw/include/gdal1. Check your own installation. I then entered:
export CPLUS_INCLUDE_PATH=/sw/include/gdal1
export C_INCLUDE_PATH=/sw/include/gdal1
env/bin/pip install pygdal==1.11.1
That seemed to work for me but I haven't tested installation yet.
add a comment |
On Fedora 24 which has GDAL 2.0.2 in its repositories, I had to install the Python package like this:
pip install
--global-option=build_ext
--global-option="-I/usr/include/gdal/"
GDAL==2.0.1
add a comment |
I was getting a similar error while trying to install the python GDAL bindings on a mac (OS 10.10.5). I installed the base GDAL software from http://www.kyngchaos.com/software/frameworks using the "Complete" download. I had to set three environment variables.
export C_INCLUDE_PATH=/Library/Frameworks/GDAL.framework/Headers
export CPLUS_INCLUDE_PATH=/Library/Frameworks/GDAL.framework/Headers
export LIBRARY_PATH=/Library/Frameworks/GDAL.framework/Versions/Current/unix/lib
The final piece was to add /Library/Frameworks/GDAL.framework/Programs to my PATH.
echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile
After that pip was able to install GDAL for python. Hope this helps.
add a comment |
These gdal Packages 0.10.1 work well for Ubuntu 12.04 :
https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/+sourcepub/4353415/+listing-archive-extra
gdal Packages 0.10.1 for other ubuntu version :
https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/+packages?field.name_filter=gdal&field.status_filter=published&field.series_filter=
I had trouble withgdal 1.10.1
too, and just did the followingpip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal==1.10.0
– ryanjdillon
May 28 '16 at 20:29
add a comment |
To answer the virtualenv specific aspect of the question:
pip3 search gdal
GDAL - GDAL: Geospatial Data Abstraction Library
pygdal - Virtualenv and setuptools friendly version of
standard GDAL python bindings
Beware that pygdal
may require a different version of GDAL, compared to what the GDAL
package of python bindings requires.
Below is what I used to get it on recent versions of Fedora (20 and 23).
CPPFLAGS=-I/usr/include/gdal pip install gdal
add a comment |
Installing via Pip with Single Command
Assuming the GDAL develop package is installed and the header file versions are correct, the only command needed to install GDAL from PyPI repos is as follows:
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal
This obviously assumes the location of the header files is /usr/include/gdal
.
Install Up-to-date GDAL
In order to install GDAL with the pip command above, the version of the header files need to be similar to the version that pip will do the build. GDAL has an updated binary reference at: https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries.
How to Install on OpenSUSE
Following the link above, there is a URL embedded further down point to an up-to-date set of GIS packages for OpenSUSE 42.1 http://download.opensuse.org/repositories/Application:/Geo/openSUSE_Leap_42.1/Application:Geo.repo
zypper ar -f <URL>
Replace with the appropriate package. And if not using zypper
there is more info at https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
add a comment |
I've had same problem on Windows 10.
After some experiments I came with this solution.
- Download and install Python 3.6 (if not installed)
after installation alter environment variables
PYTHONPATH=c:python36
PATH=C:python36Scripts;C:python36;%PATH%
- Download *.whl for correct python version from https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
- Download and install http://landinghub.visualstudio.com/visual-cpp-build-tools
pip install *.whl
(*.whl from step2)
thnx, i thought python have installed automatically environments, but then i removed and recreated environments as you suggested everything works like a charm.
– Florjan
Nov 15 '18 at 9:31
add a comment |
If you're using Docker we open sourced our container, that simplifies using GDAL and Python 3. The container captures the steps outlined above to allow you to quickly use GDAL with your apps.
thinkwhere/gdal-python
add a comment |
If you're running a Debian-based distro, the GDAL python libraries are available via your package manager and can be simply installed with
sudo apt install python-gdal
or sudo apt install python3-gdal
add a comment |
On Ubuntu 16.04 with conda in docker container (jupyter stack)
apt-get update
apt-get install libgdal1-dev -y
gdal-config --version
export CFLAGS=$(gdal-config --cflags)
pip install GDAL==1.11.2
add a comment |
In ubuntu, a simpler solution to install the latest gdal for python3: install library files via libgdal-dev
, and python wrapper via python-gdal
sudo apt-get install libgdal-dev
sudo apt-get install python3-gdal
for python2:
sudo apt-get install python-gdal
add a comment |
You may also encounter problem whith memory usage.
When running pip install gdal==2.2.3
gcc is launch to compile something and it raises memory usage.
If you don't have enough memory, the compiler fails, with a message like
'x86_64-linux-gnu-gcc' failed with exit status 4
To fix it, you need to add more ram or free some.
add a comment |
This approach worked for me:
sudo apt-get install libgdal-dev
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pip3 install gdal==2.2.3
Or as a part of a Dockerfile:
RUN apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get install -y
libgdal-dev
python3-pip
ARG CPLUS_INCLUDE_PATH=/usr/include/gdal
ARG C_INCLUDE_PATH=/usr/include/gdal
RUN pip3 install gdal==2.2.3
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f28966%2fpython-gdal-package-missing-header-file-when-installing-via-pip%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
22 Answers
22
active
oldest
votes
22 Answers
22
active
oldest
votes
active
oldest
votes
active
oldest
votes
selimnairb's answer is close but you wont have the headers unless you've installed libgdal-dev:
sudo apt-get install libgdal-dev
with that done,
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
and then
pip install GDAL
The compilation ran to completion and I have GDAL in my virtual env. Phew!
(edit 2018) Note:
To be sure that you install the correct version and avoid any problem.
retrieve the version with gdal-config --version
.
and then:
pip install GDAL==version
Seems to be the only solution that worked.
– bozdoz
Mar 25 '14 at 16:46
1
Tried this on another system, and I think the combination of this plus @nickves answer is what actually does it.
– bozdoz
Mar 31 '14 at 23:33
This worked for me.
– jaranda
Nov 26 '14 at 10:55
Very good. In case, installed version of GDAL in system and python package differs, it fails. The solution is to find version of GDAL in system and instruct pip to install relevant python package version. In my case (Ubuntu 14.04) both are 10.0, so it helped$ pip install GDAL==10.0
– Jan Vlcinsky
Dec 3 '14 at 22:17
4
I can confirm that this works on Ubuntu 16.04 withpip install GDAL==1.10.0
.
– beruic
Aug 11 '16 at 15:38
|
show 1 more comment
selimnairb's answer is close but you wont have the headers unless you've installed libgdal-dev:
sudo apt-get install libgdal-dev
with that done,
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
and then
pip install GDAL
The compilation ran to completion and I have GDAL in my virtual env. Phew!
(edit 2018) Note:
To be sure that you install the correct version and avoid any problem.
retrieve the version with gdal-config --version
.
and then:
pip install GDAL==version
Seems to be the only solution that worked.
– bozdoz
Mar 25 '14 at 16:46
1
Tried this on another system, and I think the combination of this plus @nickves answer is what actually does it.
– bozdoz
Mar 31 '14 at 23:33
This worked for me.
– jaranda
Nov 26 '14 at 10:55
Very good. In case, installed version of GDAL in system and python package differs, it fails. The solution is to find version of GDAL in system and instruct pip to install relevant python package version. In my case (Ubuntu 14.04) both are 10.0, so it helped$ pip install GDAL==10.0
– Jan Vlcinsky
Dec 3 '14 at 22:17
4
I can confirm that this works on Ubuntu 16.04 withpip install GDAL==1.10.0
.
– beruic
Aug 11 '16 at 15:38
|
show 1 more comment
selimnairb's answer is close but you wont have the headers unless you've installed libgdal-dev:
sudo apt-get install libgdal-dev
with that done,
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
and then
pip install GDAL
The compilation ran to completion and I have GDAL in my virtual env. Phew!
(edit 2018) Note:
To be sure that you install the correct version and avoid any problem.
retrieve the version with gdal-config --version
.
and then:
pip install GDAL==version
selimnairb's answer is close but you wont have the headers unless you've installed libgdal-dev:
sudo apt-get install libgdal-dev
with that done,
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
and then
pip install GDAL
The compilation ran to completion and I have GDAL in my virtual env. Phew!
(edit 2018) Note:
To be sure that you install the correct version and avoid any problem.
retrieve the version with gdal-config --version
.
and then:
pip install GDAL==version
edited Oct 27 '18 at 17:13
Loic L.
126
126
answered Oct 11 '13 at 6:37
Paul WhippPaul Whipp
88964
88964
Seems to be the only solution that worked.
– bozdoz
Mar 25 '14 at 16:46
1
Tried this on another system, and I think the combination of this plus @nickves answer is what actually does it.
– bozdoz
Mar 31 '14 at 23:33
This worked for me.
– jaranda
Nov 26 '14 at 10:55
Very good. In case, installed version of GDAL in system and python package differs, it fails. The solution is to find version of GDAL in system and instruct pip to install relevant python package version. In my case (Ubuntu 14.04) both are 10.0, so it helped$ pip install GDAL==10.0
– Jan Vlcinsky
Dec 3 '14 at 22:17
4
I can confirm that this works on Ubuntu 16.04 withpip install GDAL==1.10.0
.
– beruic
Aug 11 '16 at 15:38
|
show 1 more comment
Seems to be the only solution that worked.
– bozdoz
Mar 25 '14 at 16:46
1
Tried this on another system, and I think the combination of this plus @nickves answer is what actually does it.
– bozdoz
Mar 31 '14 at 23:33
This worked for me.
– jaranda
Nov 26 '14 at 10:55
Very good. In case, installed version of GDAL in system and python package differs, it fails. The solution is to find version of GDAL in system and instruct pip to install relevant python package version. In my case (Ubuntu 14.04) both are 10.0, so it helped$ pip install GDAL==10.0
– Jan Vlcinsky
Dec 3 '14 at 22:17
4
I can confirm that this works on Ubuntu 16.04 withpip install GDAL==1.10.0
.
– beruic
Aug 11 '16 at 15:38
Seems to be the only solution that worked.
– bozdoz
Mar 25 '14 at 16:46
Seems to be the only solution that worked.
– bozdoz
Mar 25 '14 at 16:46
1
1
Tried this on another system, and I think the combination of this plus @nickves answer is what actually does it.
– bozdoz
Mar 31 '14 at 23:33
Tried this on another system, and I think the combination of this plus @nickves answer is what actually does it.
– bozdoz
Mar 31 '14 at 23:33
This worked for me.
– jaranda
Nov 26 '14 at 10:55
This worked for me.
– jaranda
Nov 26 '14 at 10:55
Very good. In case, installed version of GDAL in system and python package differs, it fails. The solution is to find version of GDAL in system and instruct pip to install relevant python package version. In my case (Ubuntu 14.04) both are 10.0, so it helped
$ pip install GDAL==10.0
– Jan Vlcinsky
Dec 3 '14 at 22:17
Very good. In case, installed version of GDAL in system and python package differs, it fails. The solution is to find version of GDAL in system and instruct pip to install relevant python package version. In my case (Ubuntu 14.04) both are 10.0, so it helped
$ pip install GDAL==10.0
– Jan Vlcinsky
Dec 3 '14 at 22:17
4
4
I can confirm that this works on Ubuntu 16.04 with
pip install GDAL==1.10.0
.– beruic
Aug 11 '16 at 15:38
I can confirm that this works on Ubuntu 16.04 with
pip install GDAL==1.10.0
.– beruic
Aug 11 '16 at 15:38
|
show 1 more comment
Τhe header files cannot be found for some reason. Maybe you you are operating inside a Virtual Enviroment or they are not where they should be for some reason. In any case you can specify the include dirs when installing gdal via pip.
first download python's gdal :
pip install --no-install GDAL
in later versions of pip (>= 9.0.0) pip install --no-install
does not exist:
pip download GDAL
then specify where the headers are:
python setup.py build_ext --include-dirs=/usr/include/gdal/
then install it:
pip install --no-download GDAL
in later versions of pip (>= 9.0.0) pip install --no-download
does not exist:
sudo python setup.py install --include-dirs=/usr/include/gdal
Here's another way to install gdal python:
$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install python-gdal
after that open IDLE:
from osgeo import gdal
and you're good to go!
3
Hi thanks for you answer but I really need a way to install via pip as I will be creating isolated environments using virtualenv during CI process.
– kevin
Jul 8 '12 at 22:26
1
what is the output when you run 'gdal-config --version' and 'gdal-config --libs' ?
– nickves
Jul 9 '12 at 9:40
GDAL v1.9.1.gdal-config --libs -> -L/usr/lib -lgdal
– kevin
Jul 9 '12 at 17:35
2
@nickves I am trying to install GDAL using virtualenvwrapper in Ubuntu, and when I try your first line:pip install --no-install GDAL
, I get the error:__main__.gdal_config_error: [Errno 2] No such file or directory
Any idea?
– theJollySin
Mar 23 '13 at 18:36
3
I recently had a wonderful time installing GDAL on OSX. Currently, the latest Python bindings for GDAL depend on 2.1, but the latest available GDAL in homebrew is 1.11.3, and 1.11.4 for GDAL Complete. I installed via homebrew,brew install gdal
, and used an older version of the GDAL Python package:pip install --global-option=build_ext --global-option="-L/usr/local/include/gdal/" 'gdal==1.9.1'
– TestSubject
Jun 28 '16 at 0:02
|
show 3 more comments
Τhe header files cannot be found for some reason. Maybe you you are operating inside a Virtual Enviroment or they are not where they should be for some reason. In any case you can specify the include dirs when installing gdal via pip.
first download python's gdal :
pip install --no-install GDAL
in later versions of pip (>= 9.0.0) pip install --no-install
does not exist:
pip download GDAL
then specify where the headers are:
python setup.py build_ext --include-dirs=/usr/include/gdal/
then install it:
pip install --no-download GDAL
in later versions of pip (>= 9.0.0) pip install --no-download
does not exist:
sudo python setup.py install --include-dirs=/usr/include/gdal
Here's another way to install gdal python:
$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install python-gdal
after that open IDLE:
from osgeo import gdal
and you're good to go!
3
Hi thanks for you answer but I really need a way to install via pip as I will be creating isolated environments using virtualenv during CI process.
– kevin
Jul 8 '12 at 22:26
1
what is the output when you run 'gdal-config --version' and 'gdal-config --libs' ?
– nickves
Jul 9 '12 at 9:40
GDAL v1.9.1.gdal-config --libs -> -L/usr/lib -lgdal
– kevin
Jul 9 '12 at 17:35
2
@nickves I am trying to install GDAL using virtualenvwrapper in Ubuntu, and when I try your first line:pip install --no-install GDAL
, I get the error:__main__.gdal_config_error: [Errno 2] No such file or directory
Any idea?
– theJollySin
Mar 23 '13 at 18:36
3
I recently had a wonderful time installing GDAL on OSX. Currently, the latest Python bindings for GDAL depend on 2.1, but the latest available GDAL in homebrew is 1.11.3, and 1.11.4 for GDAL Complete. I installed via homebrew,brew install gdal
, and used an older version of the GDAL Python package:pip install --global-option=build_ext --global-option="-L/usr/local/include/gdal/" 'gdal==1.9.1'
– TestSubject
Jun 28 '16 at 0:02
|
show 3 more comments
Τhe header files cannot be found for some reason. Maybe you you are operating inside a Virtual Enviroment or they are not where they should be for some reason. In any case you can specify the include dirs when installing gdal via pip.
first download python's gdal :
pip install --no-install GDAL
in later versions of pip (>= 9.0.0) pip install --no-install
does not exist:
pip download GDAL
then specify where the headers are:
python setup.py build_ext --include-dirs=/usr/include/gdal/
then install it:
pip install --no-download GDAL
in later versions of pip (>= 9.0.0) pip install --no-download
does not exist:
sudo python setup.py install --include-dirs=/usr/include/gdal
Here's another way to install gdal python:
$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install python-gdal
after that open IDLE:
from osgeo import gdal
and you're good to go!
Τhe header files cannot be found for some reason. Maybe you you are operating inside a Virtual Enviroment or they are not where they should be for some reason. In any case you can specify the include dirs when installing gdal via pip.
first download python's gdal :
pip install --no-install GDAL
in later versions of pip (>= 9.0.0) pip install --no-install
does not exist:
pip download GDAL
then specify where the headers are:
python setup.py build_ext --include-dirs=/usr/include/gdal/
then install it:
pip install --no-download GDAL
in later versions of pip (>= 9.0.0) pip install --no-download
does not exist:
sudo python setup.py install --include-dirs=/usr/include/gdal
Here's another way to install gdal python:
$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install python-gdal
after that open IDLE:
from osgeo import gdal
and you're good to go!
edited Nov 14 '16 at 18:32
DanCat
1135
1135
answered Jul 8 '12 at 21:33
nickvesnickves
8,78123065
8,78123065
3
Hi thanks for you answer but I really need a way to install via pip as I will be creating isolated environments using virtualenv during CI process.
– kevin
Jul 8 '12 at 22:26
1
what is the output when you run 'gdal-config --version' and 'gdal-config --libs' ?
– nickves
Jul 9 '12 at 9:40
GDAL v1.9.1.gdal-config --libs -> -L/usr/lib -lgdal
– kevin
Jul 9 '12 at 17:35
2
@nickves I am trying to install GDAL using virtualenvwrapper in Ubuntu, and when I try your first line:pip install --no-install GDAL
, I get the error:__main__.gdal_config_error: [Errno 2] No such file or directory
Any idea?
– theJollySin
Mar 23 '13 at 18:36
3
I recently had a wonderful time installing GDAL on OSX. Currently, the latest Python bindings for GDAL depend on 2.1, but the latest available GDAL in homebrew is 1.11.3, and 1.11.4 for GDAL Complete. I installed via homebrew,brew install gdal
, and used an older version of the GDAL Python package:pip install --global-option=build_ext --global-option="-L/usr/local/include/gdal/" 'gdal==1.9.1'
– TestSubject
Jun 28 '16 at 0:02
|
show 3 more comments
3
Hi thanks for you answer but I really need a way to install via pip as I will be creating isolated environments using virtualenv during CI process.
– kevin
Jul 8 '12 at 22:26
1
what is the output when you run 'gdal-config --version' and 'gdal-config --libs' ?
– nickves
Jul 9 '12 at 9:40
GDAL v1.9.1.gdal-config --libs -> -L/usr/lib -lgdal
– kevin
Jul 9 '12 at 17:35
2
@nickves I am trying to install GDAL using virtualenvwrapper in Ubuntu, and when I try your first line:pip install --no-install GDAL
, I get the error:__main__.gdal_config_error: [Errno 2] No such file or directory
Any idea?
– theJollySin
Mar 23 '13 at 18:36
3
I recently had a wonderful time installing GDAL on OSX. Currently, the latest Python bindings for GDAL depend on 2.1, but the latest available GDAL in homebrew is 1.11.3, and 1.11.4 for GDAL Complete. I installed via homebrew,brew install gdal
, and used an older version of the GDAL Python package:pip install --global-option=build_ext --global-option="-L/usr/local/include/gdal/" 'gdal==1.9.1'
– TestSubject
Jun 28 '16 at 0:02
3
3
Hi thanks for you answer but I really need a way to install via pip as I will be creating isolated environments using virtualenv during CI process.
– kevin
Jul 8 '12 at 22:26
Hi thanks for you answer but I really need a way to install via pip as I will be creating isolated environments using virtualenv during CI process.
– kevin
Jul 8 '12 at 22:26
1
1
what is the output when you run 'gdal-config --version' and 'gdal-config --libs' ?
– nickves
Jul 9 '12 at 9:40
what is the output when you run 'gdal-config --version' and 'gdal-config --libs' ?
– nickves
Jul 9 '12 at 9:40
GDAL v1.9.1.
gdal-config --libs -> -L/usr/lib -lgdal
– kevin
Jul 9 '12 at 17:35
GDAL v1.9.1.
gdal-config --libs -> -L/usr/lib -lgdal
– kevin
Jul 9 '12 at 17:35
2
2
@nickves I am trying to install GDAL using virtualenvwrapper in Ubuntu, and when I try your first line:
pip install --no-install GDAL
, I get the error: __main__.gdal_config_error: [Errno 2] No such file or directory
Any idea?– theJollySin
Mar 23 '13 at 18:36
@nickves I am trying to install GDAL using virtualenvwrapper in Ubuntu, and when I try your first line:
pip install --no-install GDAL
, I get the error: __main__.gdal_config_error: [Errno 2] No such file or directory
Any idea?– theJollySin
Mar 23 '13 at 18:36
3
3
I recently had a wonderful time installing GDAL on OSX. Currently, the latest Python bindings for GDAL depend on 2.1, but the latest available GDAL in homebrew is 1.11.3, and 1.11.4 for GDAL Complete. I installed via homebrew,
brew install gdal
, and used an older version of the GDAL Python package: pip install --global-option=build_ext --global-option="-L/usr/local/include/gdal/" 'gdal==1.9.1'
– TestSubject
Jun 28 '16 at 0:02
I recently had a wonderful time installing GDAL on OSX. Currently, the latest Python bindings for GDAL depend on 2.1, but the latest available GDAL in homebrew is 1.11.3, and 1.11.4 for GDAL Complete. I installed via homebrew,
brew install gdal
, and used an older version of the GDAL Python package: pip install --global-option=build_ext --global-option="-L/usr/local/include/gdal/" 'gdal==1.9.1'
– TestSubject
Jun 28 '16 at 0:02
|
show 3 more comments
After following a subset of this advice, this is how I got the Python GDAL 1.11.0 (the solution should be version-independent, see below) install to work on Ubuntu 14.04 with pip:
Install dependencies:
sudo apt-get install libgdal-dev libgdal1h
pip install by passing along the include path (prefix with sudo
for system-wide install) and instructing pip to install the version matching the system installed GDAL version:
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
The higher rated answers from selimnairb and Paul Whipp didn't work for me on Ubuntu 15.10 and this one did.
– rhunwicks
Nov 17 '15 at 10:34
1
The second line worked for me after apt-adding the unstable repositories from @nickves answer. Thanks to all!
– Patrick Williams
May 24 '16 at 19:54
1
Thank you, this ended up working for me. Though I had to modify slightly as I'm attempting to stick to the cartodb installation as strictly as possible, I ended up using this as my final working install command:sudo pip install --no-use-wheel -r python_requirements.txt --global-option=build_ext --global-option="-I/usr/include/gdal"
python_requirements.txt specifies an older version of gdal. I doubt it would matter to be honest, but the entire pip install set completes successfully. U 12.04x64
– vaxhax
Jul 25 '16 at 21:32
add a comment |
After following a subset of this advice, this is how I got the Python GDAL 1.11.0 (the solution should be version-independent, see below) install to work on Ubuntu 14.04 with pip:
Install dependencies:
sudo apt-get install libgdal-dev libgdal1h
pip install by passing along the include path (prefix with sudo
for system-wide install) and instructing pip to install the version matching the system installed GDAL version:
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
The higher rated answers from selimnairb and Paul Whipp didn't work for me on Ubuntu 15.10 and this one did.
– rhunwicks
Nov 17 '15 at 10:34
1
The second line worked for me after apt-adding the unstable repositories from @nickves answer. Thanks to all!
– Patrick Williams
May 24 '16 at 19:54
1
Thank you, this ended up working for me. Though I had to modify slightly as I'm attempting to stick to the cartodb installation as strictly as possible, I ended up using this as my final working install command:sudo pip install --no-use-wheel -r python_requirements.txt --global-option=build_ext --global-option="-I/usr/include/gdal"
python_requirements.txt specifies an older version of gdal. I doubt it would matter to be honest, but the entire pip install set completes successfully. U 12.04x64
– vaxhax
Jul 25 '16 at 21:32
add a comment |
After following a subset of this advice, this is how I got the Python GDAL 1.11.0 (the solution should be version-independent, see below) install to work on Ubuntu 14.04 with pip:
Install dependencies:
sudo apt-get install libgdal-dev libgdal1h
pip install by passing along the include path (prefix with sudo
for system-wide install) and instructing pip to install the version matching the system installed GDAL version:
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
After following a subset of this advice, this is how I got the Python GDAL 1.11.0 (the solution should be version-independent, see below) install to work on Ubuntu 14.04 with pip:
Install dependencies:
sudo apt-get install libgdal-dev libgdal1h
pip install by passing along the include path (prefix with sudo
for system-wide install) and instructing pip to install the version matching the system installed GDAL version:
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
edited Dec 9 '16 at 16:16
mgri
13k42859
13k42859
answered Oct 24 '14 at 1:05
dennisobriendennisobrien
27122
27122
The higher rated answers from selimnairb and Paul Whipp didn't work for me on Ubuntu 15.10 and this one did.
– rhunwicks
Nov 17 '15 at 10:34
1
The second line worked for me after apt-adding the unstable repositories from @nickves answer. Thanks to all!
– Patrick Williams
May 24 '16 at 19:54
1
Thank you, this ended up working for me. Though I had to modify slightly as I'm attempting to stick to the cartodb installation as strictly as possible, I ended up using this as my final working install command:sudo pip install --no-use-wheel -r python_requirements.txt --global-option=build_ext --global-option="-I/usr/include/gdal"
python_requirements.txt specifies an older version of gdal. I doubt it would matter to be honest, but the entire pip install set completes successfully. U 12.04x64
– vaxhax
Jul 25 '16 at 21:32
add a comment |
The higher rated answers from selimnairb and Paul Whipp didn't work for me on Ubuntu 15.10 and this one did.
– rhunwicks
Nov 17 '15 at 10:34
1
The second line worked for me after apt-adding the unstable repositories from @nickves answer. Thanks to all!
– Patrick Williams
May 24 '16 at 19:54
1
Thank you, this ended up working for me. Though I had to modify slightly as I'm attempting to stick to the cartodb installation as strictly as possible, I ended up using this as my final working install command:sudo pip install --no-use-wheel -r python_requirements.txt --global-option=build_ext --global-option="-I/usr/include/gdal"
python_requirements.txt specifies an older version of gdal. I doubt it would matter to be honest, but the entire pip install set completes successfully. U 12.04x64
– vaxhax
Jul 25 '16 at 21:32
The higher rated answers from selimnairb and Paul Whipp didn't work for me on Ubuntu 15.10 and this one did.
– rhunwicks
Nov 17 '15 at 10:34
The higher rated answers from selimnairb and Paul Whipp didn't work for me on Ubuntu 15.10 and this one did.
– rhunwicks
Nov 17 '15 at 10:34
1
1
The second line worked for me after apt-adding the unstable repositories from @nickves answer. Thanks to all!
– Patrick Williams
May 24 '16 at 19:54
The second line worked for me after apt-adding the unstable repositories from @nickves answer. Thanks to all!
– Patrick Williams
May 24 '16 at 19:54
1
1
Thank you, this ended up working for me. Though I had to modify slightly as I'm attempting to stick to the cartodb installation as strictly as possible, I ended up using this as my final working install command:
sudo pip install --no-use-wheel -r python_requirements.txt --global-option=build_ext --global-option="-I/usr/include/gdal"
python_requirements.txt specifies an older version of gdal. I doubt it would matter to be honest, but the entire pip install set completes successfully. U 12.04x64– vaxhax
Jul 25 '16 at 21:32
Thank you, this ended up working for me. Though I had to modify slightly as I'm attempting to stick to the cartodb installation as strictly as possible, I ended up using this as my final working install command:
sudo pip install --no-use-wheel -r python_requirements.txt --global-option=build_ext --global-option="-I/usr/include/gdal"
python_requirements.txt specifies an older version of gdal. I doubt it would matter to be honest, but the entire pip install set completes successfully. U 12.04x64– vaxhax
Jul 25 '16 at 21:32
add a comment |
Installing Python package gdal
into virualenv on Linux
GDAL
provides nice toolkit for GEO related operations. However,
installing it to virtualenv on Linux is not trivial task.
This recipe describes, how to do that.
note
here I use lowercase
gdal
for Python package and upper caseGDAL
for
general system wide library.
Requirements
- allow using osgeo libraries (installed via
gdal
Python package) into
virtualenv - allow installing on Linux Ubuntu
Installation methods
There are multiple methods for installation. One requires compilation
and takes few minutes more.
The other is using wheel package of pygdal
package and is very quick.
Anyway, to create the wheel package one needs to create it once and the creation includes the compilation step anyway.
About GDAL
packages and versions
GDAL
is general C(++) based library for GEO related calculations.
GDAL
utilities can be installed system wide what makes shared libraries
available, but does not install Python package itself.
GDAL
comes in different versions and each Linux distribution may by
default install different version.
Python package gdal
requires compilation and is not trivial to install
on Linux based systems as it expects few environmental variables to be
set. This makes installation into virtualenv more difficult.
Each gdal
version might assume different version of GDAL
and will fail
installing if expected version is not present in the system.
Python package pygdal
is alternative to gdal
, which installs exactly the
same stuff as gdal
, but does it in much more virtualenv friendly manner.
pygdal
comes in versions reflecting related GDAL
version. So having GDAL
version 1.10.1 in the system you shall install pygdal
version 1.10.1.
Python package gdal
(as well as pygdal
) uses root python package named
osgeo
and has set of submodules, one being osgeo.gdal
.
If needed, other than default versions of GDAL
can be installed and
used. This is out of scope of this description.
Wheel packages can be cross-compiled, this is also out of scope.
Installing GDAL
into system
As pygdal
requires GDAL
shared libraries to be present, we must install
them first.
Assuming GDAL
is not yet installed, calling gdal-config
will complain
and give you a hint how to follow up:
$ gdal-config --version
The program 'gdal-config' is currently not installed. You can install it by typing:
sudo apt-get install libgdal-dev
Follow the hint and install it:
$ sudo apt-get install libgdal-dev
Each distribution may use different version of GDAL
. To find out which
we use:
$ gdal-config --version
1.10.1
Now you know, GDAL
is installed and the version is 1.10.1 (the version
can vary).
Install pygdal
from source package (requires compilation)
Currently pygdal
is provided only in tar.gz package, which contains
package sources and requires compilation.
Assuming, the version of GDAL
is 1.10.1
and that our virtualenv is
already activated:
$ pip install pygdal==1.10.1
It may take a while to complete, is it needs numpy, which may also
require some compilation. Just wait.
Check, it is installed:
$ pip freeze|grep pygdal
pygdal==1.10.1.0
From now on, you may use osgeo package in your Python code as you like
in exactly the same manner as if you would install it by gdal
Python
package.
Creating wheel package for pygdal
Note, that wheel packages must be created for exactly the same
architecture, namely must match:
- CPU architecture
- OS (Linux/Windows)
In our case, it must also match the version of GDAL
installed.
Following steps can be done in virtualenv or not, as you like.
First, make sure, wheel package is installed:
$ pip install wheel
Assuming, you have GDAL
installed and it has version 1.10.1:
$ pip wheel pygdal==1.10.1.0
and wait, until it completes.
After this, you shall find subdirectory wheelhouse and it shall contain
packages with extension `whl`:
$ ls wheelhouse
numpy-1.9.1-cp27-none-linux_x86_64.whl
pygdal-1.10.1.0-cp27-none-linux_x86_64.whl
Install pygdal
from wheel packages
Installation from wheel formatted packages is much faster (a second
compared to minutes), as it does not require compilation.
Note, that directory with wheel packages can have any name, we will use
just the name wheelhouse.
Activate virtualenv first.
Ensure, you have in wheelhouse directory both required wheel packages
(for pygdal
and numpy
).
Ensure, GDAL
is installed and the version matches version of pygdal
.
Install pygdal
from wheel package:
$ pip install pygdal==1.10.1.0 -f wheelhouse
The -f wheelhouse shall point to the directory with whl files.
There is no need to install numpy
, it gets installed automatically.
this anwser builds on other great answers here, tries to give complete instructions for the details, where I got stuck and adds steps for using wheel package format for speeding up repeated installs into virtualenv.
– Jan Vlcinsky
Dec 4 '14 at 9:52
pygdal
for the win!! pypi: "Virtualenv and setuptools friendly version of standard GDAL python bindings" <3
– gisdude
May 16 '18 at 18:13
add a comment |
Installing Python package gdal
into virualenv on Linux
GDAL
provides nice toolkit for GEO related operations. However,
installing it to virtualenv on Linux is not trivial task.
This recipe describes, how to do that.
note
here I use lowercase
gdal
for Python package and upper caseGDAL
for
general system wide library.
Requirements
- allow using osgeo libraries (installed via
gdal
Python package) into
virtualenv - allow installing on Linux Ubuntu
Installation methods
There are multiple methods for installation. One requires compilation
and takes few minutes more.
The other is using wheel package of pygdal
package and is very quick.
Anyway, to create the wheel package one needs to create it once and the creation includes the compilation step anyway.
About GDAL
packages and versions
GDAL
is general C(++) based library for GEO related calculations.
GDAL
utilities can be installed system wide what makes shared libraries
available, but does not install Python package itself.
GDAL
comes in different versions and each Linux distribution may by
default install different version.
Python package gdal
requires compilation and is not trivial to install
on Linux based systems as it expects few environmental variables to be
set. This makes installation into virtualenv more difficult.
Each gdal
version might assume different version of GDAL
and will fail
installing if expected version is not present in the system.
Python package pygdal
is alternative to gdal
, which installs exactly the
same stuff as gdal
, but does it in much more virtualenv friendly manner.
pygdal
comes in versions reflecting related GDAL
version. So having GDAL
version 1.10.1 in the system you shall install pygdal
version 1.10.1.
Python package gdal
(as well as pygdal
) uses root python package named
osgeo
and has set of submodules, one being osgeo.gdal
.
If needed, other than default versions of GDAL
can be installed and
used. This is out of scope of this description.
Wheel packages can be cross-compiled, this is also out of scope.
Installing GDAL
into system
As pygdal
requires GDAL
shared libraries to be present, we must install
them first.
Assuming GDAL
is not yet installed, calling gdal-config
will complain
and give you a hint how to follow up:
$ gdal-config --version
The program 'gdal-config' is currently not installed. You can install it by typing:
sudo apt-get install libgdal-dev
Follow the hint and install it:
$ sudo apt-get install libgdal-dev
Each distribution may use different version of GDAL
. To find out which
we use:
$ gdal-config --version
1.10.1
Now you know, GDAL
is installed and the version is 1.10.1 (the version
can vary).
Install pygdal
from source package (requires compilation)
Currently pygdal
is provided only in tar.gz package, which contains
package sources and requires compilation.
Assuming, the version of GDAL
is 1.10.1
and that our virtualenv is
already activated:
$ pip install pygdal==1.10.1
It may take a while to complete, is it needs numpy, which may also
require some compilation. Just wait.
Check, it is installed:
$ pip freeze|grep pygdal
pygdal==1.10.1.0
From now on, you may use osgeo package in your Python code as you like
in exactly the same manner as if you would install it by gdal
Python
package.
Creating wheel package for pygdal
Note, that wheel packages must be created for exactly the same
architecture, namely must match:
- CPU architecture
- OS (Linux/Windows)
In our case, it must also match the version of GDAL
installed.
Following steps can be done in virtualenv or not, as you like.
First, make sure, wheel package is installed:
$ pip install wheel
Assuming, you have GDAL
installed and it has version 1.10.1:
$ pip wheel pygdal==1.10.1.0
and wait, until it completes.
After this, you shall find subdirectory wheelhouse and it shall contain
packages with extension `whl`:
$ ls wheelhouse
numpy-1.9.1-cp27-none-linux_x86_64.whl
pygdal-1.10.1.0-cp27-none-linux_x86_64.whl
Install pygdal
from wheel packages
Installation from wheel formatted packages is much faster (a second
compared to minutes), as it does not require compilation.
Note, that directory with wheel packages can have any name, we will use
just the name wheelhouse.
Activate virtualenv first.
Ensure, you have in wheelhouse directory both required wheel packages
(for pygdal
and numpy
).
Ensure, GDAL
is installed and the version matches version of pygdal
.
Install pygdal
from wheel package:
$ pip install pygdal==1.10.1.0 -f wheelhouse
The -f wheelhouse shall point to the directory with whl files.
There is no need to install numpy
, it gets installed automatically.
this anwser builds on other great answers here, tries to give complete instructions for the details, where I got stuck and adds steps for using wheel package format for speeding up repeated installs into virtualenv.
– Jan Vlcinsky
Dec 4 '14 at 9:52
pygdal
for the win!! pypi: "Virtualenv and setuptools friendly version of standard GDAL python bindings" <3
– gisdude
May 16 '18 at 18:13
add a comment |
Installing Python package gdal
into virualenv on Linux
GDAL
provides nice toolkit for GEO related operations. However,
installing it to virtualenv on Linux is not trivial task.
This recipe describes, how to do that.
note
here I use lowercase
gdal
for Python package and upper caseGDAL
for
general system wide library.
Requirements
- allow using osgeo libraries (installed via
gdal
Python package) into
virtualenv - allow installing on Linux Ubuntu
Installation methods
There are multiple methods for installation. One requires compilation
and takes few minutes more.
The other is using wheel package of pygdal
package and is very quick.
Anyway, to create the wheel package one needs to create it once and the creation includes the compilation step anyway.
About GDAL
packages and versions
GDAL
is general C(++) based library for GEO related calculations.
GDAL
utilities can be installed system wide what makes shared libraries
available, but does not install Python package itself.
GDAL
comes in different versions and each Linux distribution may by
default install different version.
Python package gdal
requires compilation and is not trivial to install
on Linux based systems as it expects few environmental variables to be
set. This makes installation into virtualenv more difficult.
Each gdal
version might assume different version of GDAL
and will fail
installing if expected version is not present in the system.
Python package pygdal
is alternative to gdal
, which installs exactly the
same stuff as gdal
, but does it in much more virtualenv friendly manner.
pygdal
comes in versions reflecting related GDAL
version. So having GDAL
version 1.10.1 in the system you shall install pygdal
version 1.10.1.
Python package gdal
(as well as pygdal
) uses root python package named
osgeo
and has set of submodules, one being osgeo.gdal
.
If needed, other than default versions of GDAL
can be installed and
used. This is out of scope of this description.
Wheel packages can be cross-compiled, this is also out of scope.
Installing GDAL
into system
As pygdal
requires GDAL
shared libraries to be present, we must install
them first.
Assuming GDAL
is not yet installed, calling gdal-config
will complain
and give you a hint how to follow up:
$ gdal-config --version
The program 'gdal-config' is currently not installed. You can install it by typing:
sudo apt-get install libgdal-dev
Follow the hint and install it:
$ sudo apt-get install libgdal-dev
Each distribution may use different version of GDAL
. To find out which
we use:
$ gdal-config --version
1.10.1
Now you know, GDAL
is installed and the version is 1.10.1 (the version
can vary).
Install pygdal
from source package (requires compilation)
Currently pygdal
is provided only in tar.gz package, which contains
package sources and requires compilation.
Assuming, the version of GDAL
is 1.10.1
and that our virtualenv is
already activated:
$ pip install pygdal==1.10.1
It may take a while to complete, is it needs numpy, which may also
require some compilation. Just wait.
Check, it is installed:
$ pip freeze|grep pygdal
pygdal==1.10.1.0
From now on, you may use osgeo package in your Python code as you like
in exactly the same manner as if you would install it by gdal
Python
package.
Creating wheel package for pygdal
Note, that wheel packages must be created for exactly the same
architecture, namely must match:
- CPU architecture
- OS (Linux/Windows)
In our case, it must also match the version of GDAL
installed.
Following steps can be done in virtualenv or not, as you like.
First, make sure, wheel package is installed:
$ pip install wheel
Assuming, you have GDAL
installed and it has version 1.10.1:
$ pip wheel pygdal==1.10.1.0
and wait, until it completes.
After this, you shall find subdirectory wheelhouse and it shall contain
packages with extension `whl`:
$ ls wheelhouse
numpy-1.9.1-cp27-none-linux_x86_64.whl
pygdal-1.10.1.0-cp27-none-linux_x86_64.whl
Install pygdal
from wheel packages
Installation from wheel formatted packages is much faster (a second
compared to minutes), as it does not require compilation.
Note, that directory with wheel packages can have any name, we will use
just the name wheelhouse.
Activate virtualenv first.
Ensure, you have in wheelhouse directory both required wheel packages
(for pygdal
and numpy
).
Ensure, GDAL
is installed and the version matches version of pygdal
.
Install pygdal
from wheel package:
$ pip install pygdal==1.10.1.0 -f wheelhouse
The -f wheelhouse shall point to the directory with whl files.
There is no need to install numpy
, it gets installed automatically.
Installing Python package gdal
into virualenv on Linux
GDAL
provides nice toolkit for GEO related operations. However,
installing it to virtualenv on Linux is not trivial task.
This recipe describes, how to do that.
note
here I use lowercase
gdal
for Python package and upper caseGDAL
for
general system wide library.
Requirements
- allow using osgeo libraries (installed via
gdal
Python package) into
virtualenv - allow installing on Linux Ubuntu
Installation methods
There are multiple methods for installation. One requires compilation
and takes few minutes more.
The other is using wheel package of pygdal
package and is very quick.
Anyway, to create the wheel package one needs to create it once and the creation includes the compilation step anyway.
About GDAL
packages and versions
GDAL
is general C(++) based library for GEO related calculations.
GDAL
utilities can be installed system wide what makes shared libraries
available, but does not install Python package itself.
GDAL
comes in different versions and each Linux distribution may by
default install different version.
Python package gdal
requires compilation and is not trivial to install
on Linux based systems as it expects few environmental variables to be
set. This makes installation into virtualenv more difficult.
Each gdal
version might assume different version of GDAL
and will fail
installing if expected version is not present in the system.
Python package pygdal
is alternative to gdal
, which installs exactly the
same stuff as gdal
, but does it in much more virtualenv friendly manner.
pygdal
comes in versions reflecting related GDAL
version. So having GDAL
version 1.10.1 in the system you shall install pygdal
version 1.10.1.
Python package gdal
(as well as pygdal
) uses root python package named
osgeo
and has set of submodules, one being osgeo.gdal
.
If needed, other than default versions of GDAL
can be installed and
used. This is out of scope of this description.
Wheel packages can be cross-compiled, this is also out of scope.
Installing GDAL
into system
As pygdal
requires GDAL
shared libraries to be present, we must install
them first.
Assuming GDAL
is not yet installed, calling gdal-config
will complain
and give you a hint how to follow up:
$ gdal-config --version
The program 'gdal-config' is currently not installed. You can install it by typing:
sudo apt-get install libgdal-dev
Follow the hint and install it:
$ sudo apt-get install libgdal-dev
Each distribution may use different version of GDAL
. To find out which
we use:
$ gdal-config --version
1.10.1
Now you know, GDAL
is installed and the version is 1.10.1 (the version
can vary).
Install pygdal
from source package (requires compilation)
Currently pygdal
is provided only in tar.gz package, which contains
package sources and requires compilation.
Assuming, the version of GDAL
is 1.10.1
and that our virtualenv is
already activated:
$ pip install pygdal==1.10.1
It may take a while to complete, is it needs numpy, which may also
require some compilation. Just wait.
Check, it is installed:
$ pip freeze|grep pygdal
pygdal==1.10.1.0
From now on, you may use osgeo package in your Python code as you like
in exactly the same manner as if you would install it by gdal
Python
package.
Creating wheel package for pygdal
Note, that wheel packages must be created for exactly the same
architecture, namely must match:
- CPU architecture
- OS (Linux/Windows)
In our case, it must also match the version of GDAL
installed.
Following steps can be done in virtualenv or not, as you like.
First, make sure, wheel package is installed:
$ pip install wheel
Assuming, you have GDAL
installed and it has version 1.10.1:
$ pip wheel pygdal==1.10.1.0
and wait, until it completes.
After this, you shall find subdirectory wheelhouse and it shall contain
packages with extension `whl`:
$ ls wheelhouse
numpy-1.9.1-cp27-none-linux_x86_64.whl
pygdal-1.10.1.0-cp27-none-linux_x86_64.whl
Install pygdal
from wheel packages
Installation from wheel formatted packages is much faster (a second
compared to minutes), as it does not require compilation.
Note, that directory with wheel packages can have any name, we will use
just the name wheelhouse.
Activate virtualenv first.
Ensure, you have in wheelhouse directory both required wheel packages
(for pygdal
and numpy
).
Ensure, GDAL
is installed and the version matches version of pygdal
.
Install pygdal
from wheel package:
$ pip install pygdal==1.10.1.0 -f wheelhouse
The -f wheelhouse shall point to the directory with whl files.
There is no need to install numpy
, it gets installed automatically.
edited Dec 4 '14 at 9:50
answered Dec 4 '14 at 9:40
Jan VlcinskyJan Vlcinsky
21126
21126
this anwser builds on other great answers here, tries to give complete instructions for the details, where I got stuck and adds steps for using wheel package format for speeding up repeated installs into virtualenv.
– Jan Vlcinsky
Dec 4 '14 at 9:52
pygdal
for the win!! pypi: "Virtualenv and setuptools friendly version of standard GDAL python bindings" <3
– gisdude
May 16 '18 at 18:13
add a comment |
this anwser builds on other great answers here, tries to give complete instructions for the details, where I got stuck and adds steps for using wheel package format for speeding up repeated installs into virtualenv.
– Jan Vlcinsky
Dec 4 '14 at 9:52
pygdal
for the win!! pypi: "Virtualenv and setuptools friendly version of standard GDAL python bindings" <3
– gisdude
May 16 '18 at 18:13
this anwser builds on other great answers here, tries to give complete instructions for the details, where I got stuck and adds steps for using wheel package format for speeding up repeated installs into virtualenv.
– Jan Vlcinsky
Dec 4 '14 at 9:52
this anwser builds on other great answers here, tries to give complete instructions for the details, where I got stuck and adds steps for using wheel package format for speeding up repeated installs into virtualenv.
– Jan Vlcinsky
Dec 4 '14 at 9:52
pygdal
for the win!! pypi: "Virtualenv and setuptools friendly version of standard GDAL python bindings" <3– gisdude
May 16 '18 at 18:13
pygdal
for the win!! pypi: "Virtualenv and setuptools friendly version of standard GDAL python bindings" <3– gisdude
May 16 '18 at 18:13
add a comment |
Yes, doing the following before running PIP appears to work:
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
add a comment |
Yes, doing the following before running PIP appears to work:
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
add a comment |
Yes, doing the following before running PIP appears to work:
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
Yes, doing the following before running PIP appears to work:
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
answered Jun 24 '13 at 2:54
selimnairbselimnairb
8111
8111
add a comment |
add a comment |
The problem with the pip installing gdal is that it only gets the bindings, not the entire library, so it can get tricky. One way to solve it is to use the pip command to download - but not install. Then you tweak the header location from the config file. Then you pip install that. meh.
I was having the same problem but realized that writing a fabric script to recompile gdal and generate the python bindings was going to take less time. You even get the benefit of filegdb with that. Go ahead and use tha gist I wrote or tweak it to your hearts content.
add a comment |
The problem with the pip installing gdal is that it only gets the bindings, not the entire library, so it can get tricky. One way to solve it is to use the pip command to download - but not install. Then you tweak the header location from the config file. Then you pip install that. meh.
I was having the same problem but realized that writing a fabric script to recompile gdal and generate the python bindings was going to take less time. You even get the benefit of filegdb with that. Go ahead and use tha gist I wrote or tweak it to your hearts content.
add a comment |
The problem with the pip installing gdal is that it only gets the bindings, not the entire library, so it can get tricky. One way to solve it is to use the pip command to download - but not install. Then you tweak the header location from the config file. Then you pip install that. meh.
I was having the same problem but realized that writing a fabric script to recompile gdal and generate the python bindings was going to take less time. You even get the benefit of filegdb with that. Go ahead and use tha gist I wrote or tweak it to your hearts content.
The problem with the pip installing gdal is that it only gets the bindings, not the entire library, so it can get tricky. One way to solve it is to use the pip command to download - but not install. Then you tweak the header location from the config file. Then you pip install that. meh.
I was having the same problem but realized that writing a fabric script to recompile gdal and generate the python bindings was going to take less time. You even get the benefit of filegdb with that. Go ahead and use tha gist I wrote or tweak it to your hearts content.
answered Jul 6 '12 at 14:57
Ragi Yaser BurhumRagi Yaser Burhum
14.3k25476
14.3k25476
add a comment |
add a comment |
While a while later, this provides the include path without having to bail out of pip installation: One can set the include path using an environment variable.
Assuming the headers are in /usr/include/gdal, issue an
export CPLUS_INCLUDE_PATH=/usr/include/gdal
before running pip.
Using this, I get "extensions/gdalconst_wrap.c:2732:18: fatal error: gdal.h: No such file or directory" even though gdal.h is present in/usr/include/gdal
– anand.trex
May 26 '13 at 1:14
1
Does using C_INCLUDE_PATH instead/additionally helps=?
– Crischan
Jun 13 '13 at 11:34
add a comment |
While a while later, this provides the include path without having to bail out of pip installation: One can set the include path using an environment variable.
Assuming the headers are in /usr/include/gdal, issue an
export CPLUS_INCLUDE_PATH=/usr/include/gdal
before running pip.
Using this, I get "extensions/gdalconst_wrap.c:2732:18: fatal error: gdal.h: No such file or directory" even though gdal.h is present in/usr/include/gdal
– anand.trex
May 26 '13 at 1:14
1
Does using C_INCLUDE_PATH instead/additionally helps=?
– Crischan
Jun 13 '13 at 11:34
add a comment |
While a while later, this provides the include path without having to bail out of pip installation: One can set the include path using an environment variable.
Assuming the headers are in /usr/include/gdal, issue an
export CPLUS_INCLUDE_PATH=/usr/include/gdal
before running pip.
While a while later, this provides the include path without having to bail out of pip installation: One can set the include path using an environment variable.
Assuming the headers are in /usr/include/gdal, issue an
export CPLUS_INCLUDE_PATH=/usr/include/gdal
before running pip.
answered Nov 17 '12 at 10:59
CrischanCrischan
59626
59626
Using this, I get "extensions/gdalconst_wrap.c:2732:18: fatal error: gdal.h: No such file or directory" even though gdal.h is present in/usr/include/gdal
– anand.trex
May 26 '13 at 1:14
1
Does using C_INCLUDE_PATH instead/additionally helps=?
– Crischan
Jun 13 '13 at 11:34
add a comment |
Using this, I get "extensions/gdalconst_wrap.c:2732:18: fatal error: gdal.h: No such file or directory" even though gdal.h is present in/usr/include/gdal
– anand.trex
May 26 '13 at 1:14
1
Does using C_INCLUDE_PATH instead/additionally helps=?
– Crischan
Jun 13 '13 at 11:34
Using this, I get "extensions/gdalconst_wrap.c:2732:18: fatal error: gdal.h: No such file or directory" even though gdal.h is present in
/usr/include/gdal
– anand.trex
May 26 '13 at 1:14
Using this, I get "extensions/gdalconst_wrap.c:2732:18: fatal error: gdal.h: No such file or directory" even though gdal.h is present in
/usr/include/gdal
– anand.trex
May 26 '13 at 1:14
1
1
Does using C_INCLUDE_PATH instead/additionally helps=?
– Crischan
Jun 13 '13 at 11:34
Does using C_INCLUDE_PATH instead/additionally helps=?
– Crischan
Jun 13 '13 at 11:34
add a comment |
After looking right and left for a solution, here is something that works for me on Ubuntu 14.04, even from within a virtualenv with no access to the system packages :
Install dependencies :
sudo apt-get install libgdal-dev libgdal1h libgdal1-dev
Set the compiler flags :
export CFLAGS=$(gdal-config --cflags)
Install the version corresponding to the system libraries (at the time of writing Ubuntu Trusty is using the 1.10 headers) :
pip install GDAL==1.10.0
also worked for me on ubuntu 16.04
– Luke W
May 25 '18 at 15:41
add a comment |
After looking right and left for a solution, here is something that works for me on Ubuntu 14.04, even from within a virtualenv with no access to the system packages :
Install dependencies :
sudo apt-get install libgdal-dev libgdal1h libgdal1-dev
Set the compiler flags :
export CFLAGS=$(gdal-config --cflags)
Install the version corresponding to the system libraries (at the time of writing Ubuntu Trusty is using the 1.10 headers) :
pip install GDAL==1.10.0
also worked for me on ubuntu 16.04
– Luke W
May 25 '18 at 15:41
add a comment |
After looking right and left for a solution, here is something that works for me on Ubuntu 14.04, even from within a virtualenv with no access to the system packages :
Install dependencies :
sudo apt-get install libgdal-dev libgdal1h libgdal1-dev
Set the compiler flags :
export CFLAGS=$(gdal-config --cflags)
Install the version corresponding to the system libraries (at the time of writing Ubuntu Trusty is using the 1.10 headers) :
pip install GDAL==1.10.0
After looking right and left for a solution, here is something that works for me on Ubuntu 14.04, even from within a virtualenv with no access to the system packages :
Install dependencies :
sudo apt-get install libgdal-dev libgdal1h libgdal1-dev
Set the compiler flags :
export CFLAGS=$(gdal-config --cflags)
Install the version corresponding to the system libraries (at the time of writing Ubuntu Trusty is using the 1.10 headers) :
pip install GDAL==1.10.0
answered Sep 29 '14 at 12:40
F.X.F.X.
20516
20516
also worked for me on ubuntu 16.04
– Luke W
May 25 '18 at 15:41
add a comment |
also worked for me on ubuntu 16.04
– Luke W
May 25 '18 at 15:41
also worked for me on ubuntu 16.04
– Luke W
May 25 '18 at 15:41
also worked for me on ubuntu 16.04
– Luke W
May 25 '18 at 15:41
add a comment |
Now you can use virtualenv and setuptools friendly version of standard GDAL python bindings pygdal.
add a comment |
Now you can use virtualenv and setuptools friendly version of standard GDAL python bindings pygdal.
add a comment |
Now you can use virtualenv and setuptools friendly version of standard GDAL python bindings pygdal.
Now you can use virtualenv and setuptools friendly version of standard GDAL python bindings pygdal.
answered Oct 29 '14 at 7:35
drnextgisdrnextgis
5,20712246
5,20712246
add a comment |
add a comment |
I was having similar problems on a Mac. This is how I resolved it:
Firstly, I set up a virtual Python 2.7 environment using virtualenv. The Python distribution was installed in a directory called 'env'.
I then used fink to install gdal
fink selfupdate
fink update-all
fink install gdal
I also installed gdal-dev but this may not have been required since it might have already been installed with gdal.
I checked the version installed using:
gdal-config --version
On my installation, it produced the result
1.11.1
The fink installation of gdal installed the cpl_port.h header file in /sw/include/gdal1. Check your own installation. I then entered:
export CPLUS_INCLUDE_PATH=/sw/include/gdal1
export C_INCLUDE_PATH=/sw/include/gdal1
env/bin/pip install pygdal==1.11.1
That seemed to work for me but I haven't tested installation yet.
add a comment |
I was having similar problems on a Mac. This is how I resolved it:
Firstly, I set up a virtual Python 2.7 environment using virtualenv. The Python distribution was installed in a directory called 'env'.
I then used fink to install gdal
fink selfupdate
fink update-all
fink install gdal
I also installed gdal-dev but this may not have been required since it might have already been installed with gdal.
I checked the version installed using:
gdal-config --version
On my installation, it produced the result
1.11.1
The fink installation of gdal installed the cpl_port.h header file in /sw/include/gdal1. Check your own installation. I then entered:
export CPLUS_INCLUDE_PATH=/sw/include/gdal1
export C_INCLUDE_PATH=/sw/include/gdal1
env/bin/pip install pygdal==1.11.1
That seemed to work for me but I haven't tested installation yet.
add a comment |
I was having similar problems on a Mac. This is how I resolved it:
Firstly, I set up a virtual Python 2.7 environment using virtualenv. The Python distribution was installed in a directory called 'env'.
I then used fink to install gdal
fink selfupdate
fink update-all
fink install gdal
I also installed gdal-dev but this may not have been required since it might have already been installed with gdal.
I checked the version installed using:
gdal-config --version
On my installation, it produced the result
1.11.1
The fink installation of gdal installed the cpl_port.h header file in /sw/include/gdal1. Check your own installation. I then entered:
export CPLUS_INCLUDE_PATH=/sw/include/gdal1
export C_INCLUDE_PATH=/sw/include/gdal1
env/bin/pip install pygdal==1.11.1
That seemed to work for me but I haven't tested installation yet.
I was having similar problems on a Mac. This is how I resolved it:
Firstly, I set up a virtual Python 2.7 environment using virtualenv. The Python distribution was installed in a directory called 'env'.
I then used fink to install gdal
fink selfupdate
fink update-all
fink install gdal
I also installed gdal-dev but this may not have been required since it might have already been installed with gdal.
I checked the version installed using:
gdal-config --version
On my installation, it produced the result
1.11.1
The fink installation of gdal installed the cpl_port.h header file in /sw/include/gdal1. Check your own installation. I then entered:
export CPLUS_INCLUDE_PATH=/sw/include/gdal1
export C_INCLUDE_PATH=/sw/include/gdal1
env/bin/pip install pygdal==1.11.1
That seemed to work for me but I haven't tested installation yet.
answered Dec 28 '14 at 10:12
user1718097user1718097
1415
1415
add a comment |
add a comment |
On Fedora 24 which has GDAL 2.0.2 in its repositories, I had to install the Python package like this:
pip install
--global-option=build_ext
--global-option="-I/usr/include/gdal/"
GDAL==2.0.1
add a comment |
On Fedora 24 which has GDAL 2.0.2 in its repositories, I had to install the Python package like this:
pip install
--global-option=build_ext
--global-option="-I/usr/include/gdal/"
GDAL==2.0.1
add a comment |
On Fedora 24 which has GDAL 2.0.2 in its repositories, I had to install the Python package like this:
pip install
--global-option=build_ext
--global-option="-I/usr/include/gdal/"
GDAL==2.0.1
On Fedora 24 which has GDAL 2.0.2 in its repositories, I had to install the Python package like this:
pip install
--global-option=build_ext
--global-option="-I/usr/include/gdal/"
GDAL==2.0.1
answered Nov 10 '16 at 21:00
akaiholaakaihola
1213
1213
add a comment |
add a comment |
I was getting a similar error while trying to install the python GDAL bindings on a mac (OS 10.10.5). I installed the base GDAL software from http://www.kyngchaos.com/software/frameworks using the "Complete" download. I had to set three environment variables.
export C_INCLUDE_PATH=/Library/Frameworks/GDAL.framework/Headers
export CPLUS_INCLUDE_PATH=/Library/Frameworks/GDAL.framework/Headers
export LIBRARY_PATH=/Library/Frameworks/GDAL.framework/Versions/Current/unix/lib
The final piece was to add /Library/Frameworks/GDAL.framework/Programs to my PATH.
echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile
After that pip was able to install GDAL for python. Hope this helps.
add a comment |
I was getting a similar error while trying to install the python GDAL bindings on a mac (OS 10.10.5). I installed the base GDAL software from http://www.kyngchaos.com/software/frameworks using the "Complete" download. I had to set three environment variables.
export C_INCLUDE_PATH=/Library/Frameworks/GDAL.framework/Headers
export CPLUS_INCLUDE_PATH=/Library/Frameworks/GDAL.framework/Headers
export LIBRARY_PATH=/Library/Frameworks/GDAL.framework/Versions/Current/unix/lib
The final piece was to add /Library/Frameworks/GDAL.framework/Programs to my PATH.
echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile
After that pip was able to install GDAL for python. Hope this helps.
add a comment |
I was getting a similar error while trying to install the python GDAL bindings on a mac (OS 10.10.5). I installed the base GDAL software from http://www.kyngchaos.com/software/frameworks using the "Complete" download. I had to set three environment variables.
export C_INCLUDE_PATH=/Library/Frameworks/GDAL.framework/Headers
export CPLUS_INCLUDE_PATH=/Library/Frameworks/GDAL.framework/Headers
export LIBRARY_PATH=/Library/Frameworks/GDAL.framework/Versions/Current/unix/lib
The final piece was to add /Library/Frameworks/GDAL.framework/Programs to my PATH.
echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile
After that pip was able to install GDAL for python. Hope this helps.
I was getting a similar error while trying to install the python GDAL bindings on a mac (OS 10.10.5). I installed the base GDAL software from http://www.kyngchaos.com/software/frameworks using the "Complete" download. I had to set three environment variables.
export C_INCLUDE_PATH=/Library/Frameworks/GDAL.framework/Headers
export CPLUS_INCLUDE_PATH=/Library/Frameworks/GDAL.framework/Headers
export LIBRARY_PATH=/Library/Frameworks/GDAL.framework/Versions/Current/unix/lib
The final piece was to add /Library/Frameworks/GDAL.framework/Programs to my PATH.
echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile
After that pip was able to install GDAL for python. Hope this helps.
answered Mar 15 '17 at 15:02
Gary KahnGary Kahn
212
212
add a comment |
add a comment |
These gdal Packages 0.10.1 work well for Ubuntu 12.04 :
https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/+sourcepub/4353415/+listing-archive-extra
gdal Packages 0.10.1 for other ubuntu version :
https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/+packages?field.name_filter=gdal&field.status_filter=published&field.series_filter=
I had trouble withgdal 1.10.1
too, and just did the followingpip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal==1.10.0
– ryanjdillon
May 28 '16 at 20:29
add a comment |
These gdal Packages 0.10.1 work well for Ubuntu 12.04 :
https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/+sourcepub/4353415/+listing-archive-extra
gdal Packages 0.10.1 for other ubuntu version :
https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/+packages?field.name_filter=gdal&field.status_filter=published&field.series_filter=
I had trouble withgdal 1.10.1
too, and just did the followingpip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal==1.10.0
– ryanjdillon
May 28 '16 at 20:29
add a comment |
These gdal Packages 0.10.1 work well for Ubuntu 12.04 :
https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/+sourcepub/4353415/+listing-archive-extra
gdal Packages 0.10.1 for other ubuntu version :
https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/+packages?field.name_filter=gdal&field.status_filter=published&field.series_filter=
These gdal Packages 0.10.1 work well for Ubuntu 12.04 :
https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/+sourcepub/4353415/+listing-archive-extra
gdal Packages 0.10.1 for other ubuntu version :
https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/+packages?field.name_filter=gdal&field.status_filter=published&field.series_filter=
answered Nov 8 '15 at 21:33
signosigno
111
111
I had trouble withgdal 1.10.1
too, and just did the followingpip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal==1.10.0
– ryanjdillon
May 28 '16 at 20:29
add a comment |
I had trouble withgdal 1.10.1
too, and just did the followingpip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal==1.10.0
– ryanjdillon
May 28 '16 at 20:29
I had trouble with
gdal 1.10.1
too, and just did the following pip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal==1.10.0
– ryanjdillon
May 28 '16 at 20:29
I had trouble with
gdal 1.10.1
too, and just did the following pip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal==1.10.0
– ryanjdillon
May 28 '16 at 20:29
add a comment |
To answer the virtualenv specific aspect of the question:
pip3 search gdal
GDAL - GDAL: Geospatial Data Abstraction Library
pygdal - Virtualenv and setuptools friendly version of
standard GDAL python bindings
Beware that pygdal
may require a different version of GDAL, compared to what the GDAL
package of python bindings requires.
Below is what I used to get it on recent versions of Fedora (20 and 23).
CPPFLAGS=-I/usr/include/gdal pip install gdal
add a comment |
To answer the virtualenv specific aspect of the question:
pip3 search gdal
GDAL - GDAL: Geospatial Data Abstraction Library
pygdal - Virtualenv and setuptools friendly version of
standard GDAL python bindings
Beware that pygdal
may require a different version of GDAL, compared to what the GDAL
package of python bindings requires.
Below is what I used to get it on recent versions of Fedora (20 and 23).
CPPFLAGS=-I/usr/include/gdal pip install gdal
add a comment |
To answer the virtualenv specific aspect of the question:
pip3 search gdal
GDAL - GDAL: Geospatial Data Abstraction Library
pygdal - Virtualenv and setuptools friendly version of
standard GDAL python bindings
Beware that pygdal
may require a different version of GDAL, compared to what the GDAL
package of python bindings requires.
Below is what I used to get it on recent versions of Fedora (20 and 23).
CPPFLAGS=-I/usr/include/gdal pip install gdal
To answer the virtualenv specific aspect of the question:
pip3 search gdal
GDAL - GDAL: Geospatial Data Abstraction Library
pygdal - Virtualenv and setuptools friendly version of
standard GDAL python bindings
Beware that pygdal
may require a different version of GDAL, compared to what the GDAL
package of python bindings requires.
Below is what I used to get it on recent versions of Fedora (20 and 23).
CPPFLAGS=-I/usr/include/gdal pip install gdal
edited Jan 17 '16 at 4:29
answered Sep 30 '14 at 0:03
KevinKevin
1737
1737
add a comment |
add a comment |
Installing via Pip with Single Command
Assuming the GDAL develop package is installed and the header file versions are correct, the only command needed to install GDAL from PyPI repos is as follows:
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal
This obviously assumes the location of the header files is /usr/include/gdal
.
Install Up-to-date GDAL
In order to install GDAL with the pip command above, the version of the header files need to be similar to the version that pip will do the build. GDAL has an updated binary reference at: https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries.
How to Install on OpenSUSE
Following the link above, there is a URL embedded further down point to an up-to-date set of GIS packages for OpenSUSE 42.1 http://download.opensuse.org/repositories/Application:/Geo/openSUSE_Leap_42.1/Application:Geo.repo
zypper ar -f <URL>
Replace with the appropriate package. And if not using zypper
there is more info at https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
add a comment |
Installing via Pip with Single Command
Assuming the GDAL develop package is installed and the header file versions are correct, the only command needed to install GDAL from PyPI repos is as follows:
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal
This obviously assumes the location of the header files is /usr/include/gdal
.
Install Up-to-date GDAL
In order to install GDAL with the pip command above, the version of the header files need to be similar to the version that pip will do the build. GDAL has an updated binary reference at: https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries.
How to Install on OpenSUSE
Following the link above, there is a URL embedded further down point to an up-to-date set of GIS packages for OpenSUSE 42.1 http://download.opensuse.org/repositories/Application:/Geo/openSUSE_Leap_42.1/Application:Geo.repo
zypper ar -f <URL>
Replace with the appropriate package. And if not using zypper
there is more info at https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
add a comment |
Installing via Pip with Single Command
Assuming the GDAL develop package is installed and the header file versions are correct, the only command needed to install GDAL from PyPI repos is as follows:
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal
This obviously assumes the location of the header files is /usr/include/gdal
.
Install Up-to-date GDAL
In order to install GDAL with the pip command above, the version of the header files need to be similar to the version that pip will do the build. GDAL has an updated binary reference at: https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries.
How to Install on OpenSUSE
Following the link above, there is a URL embedded further down point to an up-to-date set of GIS packages for OpenSUSE 42.1 http://download.opensuse.org/repositories/Application:/Geo/openSUSE_Leap_42.1/Application:Geo.repo
zypper ar -f <URL>
Replace with the appropriate package. And if not using zypper
there is more info at https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
Installing via Pip with Single Command
Assuming the GDAL develop package is installed and the header file versions are correct, the only command needed to install GDAL from PyPI repos is as follows:
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal
This obviously assumes the location of the header files is /usr/include/gdal
.
Install Up-to-date GDAL
In order to install GDAL with the pip command above, the version of the header files need to be similar to the version that pip will do the build. GDAL has an updated binary reference at: https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries.
How to Install on OpenSUSE
Following the link above, there is a URL embedded further down point to an up-to-date set of GIS packages for OpenSUSE 42.1 http://download.opensuse.org/repositories/Application:/Geo/openSUSE_Leap_42.1/Application:Geo.repo
zypper ar -f <URL>
Replace with the appropriate package. And if not using zypper
there is more info at https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
answered Nov 14 '16 at 18:21
DanCatDanCat
1135
1135
add a comment |
add a comment |
I've had same problem on Windows 10.
After some experiments I came with this solution.
- Download and install Python 3.6 (if not installed)
after installation alter environment variables
PYTHONPATH=c:python36
PATH=C:python36Scripts;C:python36;%PATH%
- Download *.whl for correct python version from https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
- Download and install http://landinghub.visualstudio.com/visual-cpp-build-tools
pip install *.whl
(*.whl from step2)
thnx, i thought python have installed automatically environments, but then i removed and recreated environments as you suggested everything works like a charm.
– Florjan
Nov 15 '18 at 9:31
add a comment |
I've had same problem on Windows 10.
After some experiments I came with this solution.
- Download and install Python 3.6 (if not installed)
after installation alter environment variables
PYTHONPATH=c:python36
PATH=C:python36Scripts;C:python36;%PATH%
- Download *.whl for correct python version from https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
- Download and install http://landinghub.visualstudio.com/visual-cpp-build-tools
pip install *.whl
(*.whl from step2)
thnx, i thought python have installed automatically environments, but then i removed and recreated environments as you suggested everything works like a charm.
– Florjan
Nov 15 '18 at 9:31
add a comment |
I've had same problem on Windows 10.
After some experiments I came with this solution.
- Download and install Python 3.6 (if not installed)
after installation alter environment variables
PYTHONPATH=c:python36
PATH=C:python36Scripts;C:python36;%PATH%
- Download *.whl for correct python version from https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
- Download and install http://landinghub.visualstudio.com/visual-cpp-build-tools
pip install *.whl
(*.whl from step2)
I've had same problem on Windows 10.
After some experiments I came with this solution.
- Download and install Python 3.6 (if not installed)
after installation alter environment variables
PYTHONPATH=c:python36
PATH=C:python36Scripts;C:python36;%PATH%
- Download *.whl for correct python version from https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
- Download and install http://landinghub.visualstudio.com/visual-cpp-build-tools
pip install *.whl
(*.whl from step2)
answered Dec 22 '17 at 16:31
zimirrrzimirrr
111
111
thnx, i thought python have installed automatically environments, but then i removed and recreated environments as you suggested everything works like a charm.
– Florjan
Nov 15 '18 at 9:31
add a comment |
thnx, i thought python have installed automatically environments, but then i removed and recreated environments as you suggested everything works like a charm.
– Florjan
Nov 15 '18 at 9:31
thnx, i thought python have installed automatically environments, but then i removed and recreated environments as you suggested everything works like a charm.
– Florjan
Nov 15 '18 at 9:31
thnx, i thought python have installed automatically environments, but then i removed and recreated environments as you suggested everything works like a charm.
– Florjan
Nov 15 '18 at 9:31
add a comment |
If you're using Docker we open sourced our container, that simplifies using GDAL and Python 3. The container captures the steps outlined above to allow you to quickly use GDAL with your apps.
thinkwhere/gdal-python
add a comment |
If you're using Docker we open sourced our container, that simplifies using GDAL and Python 3. The container captures the steps outlined above to allow you to quickly use GDAL with your apps.
thinkwhere/gdal-python
add a comment |
If you're using Docker we open sourced our container, that simplifies using GDAL and Python 3. The container captures the steps outlined above to allow you to quickly use GDAL with your apps.
thinkwhere/gdal-python
If you're using Docker we open sourced our container, that simplifies using GDAL and Python 3. The container captures the steps outlined above to allow you to quickly use GDAL with your apps.
thinkwhere/gdal-python
answered Apr 18 '18 at 9:50
Iain HunterIain Hunter
1112
1112
add a comment |
add a comment |
If you're running a Debian-based distro, the GDAL python libraries are available via your package manager and can be simply installed with
sudo apt install python-gdal
or sudo apt install python3-gdal
add a comment |
If you're running a Debian-based distro, the GDAL python libraries are available via your package manager and can be simply installed with
sudo apt install python-gdal
or sudo apt install python3-gdal
add a comment |
If you're running a Debian-based distro, the GDAL python libraries are available via your package manager and can be simply installed with
sudo apt install python-gdal
or sudo apt install python3-gdal
If you're running a Debian-based distro, the GDAL python libraries are available via your package manager and can be simply installed with
sudo apt install python-gdal
or sudo apt install python3-gdal
edited Dec 11 '17 at 3:29
answered Dec 10 '17 at 22:54
Alex McVittieAlex McVittie
509313
509313
add a comment |
add a comment |
On Ubuntu 16.04 with conda in docker container (jupyter stack)
apt-get update
apt-get install libgdal1-dev -y
gdal-config --version
export CFLAGS=$(gdal-config --cflags)
pip install GDAL==1.11.2
add a comment |
On Ubuntu 16.04 with conda in docker container (jupyter stack)
apt-get update
apt-get install libgdal1-dev -y
gdal-config --version
export CFLAGS=$(gdal-config --cflags)
pip install GDAL==1.11.2
add a comment |
On Ubuntu 16.04 with conda in docker container (jupyter stack)
apt-get update
apt-get install libgdal1-dev -y
gdal-config --version
export CFLAGS=$(gdal-config --cflags)
pip install GDAL==1.11.2
On Ubuntu 16.04 with conda in docker container (jupyter stack)
apt-get update
apt-get install libgdal1-dev -y
gdal-config --version
export CFLAGS=$(gdal-config --cflags)
pip install GDAL==1.11.2
edited May 25 '18 at 19:42
answered May 25 '18 at 15:49
Luke WLuke W
1012
1012
add a comment |
add a comment |
In ubuntu, a simpler solution to install the latest gdal for python3: install library files via libgdal-dev
, and python wrapper via python-gdal
sudo apt-get install libgdal-dev
sudo apt-get install python3-gdal
for python2:
sudo apt-get install python-gdal
add a comment |
In ubuntu, a simpler solution to install the latest gdal for python3: install library files via libgdal-dev
, and python wrapper via python-gdal
sudo apt-get install libgdal-dev
sudo apt-get install python3-gdal
for python2:
sudo apt-get install python-gdal
add a comment |
In ubuntu, a simpler solution to install the latest gdal for python3: install library files via libgdal-dev
, and python wrapper via python-gdal
sudo apt-get install libgdal-dev
sudo apt-get install python3-gdal
for python2:
sudo apt-get install python-gdal
In ubuntu, a simpler solution to install the latest gdal for python3: install library files via libgdal-dev
, and python wrapper via python-gdal
sudo apt-get install libgdal-dev
sudo apt-get install python3-gdal
for python2:
sudo apt-get install python-gdal
edited Nov 16 '18 at 7:44
Jochen Schwarze
6,57041958
6,57041958
answered Nov 16 '18 at 7:16
beahackerbeahacker
11
11
add a comment |
add a comment |
You may also encounter problem whith memory usage.
When running pip install gdal==2.2.3
gcc is launch to compile something and it raises memory usage.
If you don't have enough memory, the compiler fails, with a message like
'x86_64-linux-gnu-gcc' failed with exit status 4
To fix it, you need to add more ram or free some.
add a comment |
You may also encounter problem whith memory usage.
When running pip install gdal==2.2.3
gcc is launch to compile something and it raises memory usage.
If you don't have enough memory, the compiler fails, with a message like
'x86_64-linux-gnu-gcc' failed with exit status 4
To fix it, you need to add more ram or free some.
add a comment |
You may also encounter problem whith memory usage.
When running pip install gdal==2.2.3
gcc is launch to compile something and it raises memory usage.
If you don't have enough memory, the compiler fails, with a message like
'x86_64-linux-gnu-gcc' failed with exit status 4
To fix it, you need to add more ram or free some.
You may also encounter problem whith memory usage.
When running pip install gdal==2.2.3
gcc is launch to compile something and it raises memory usage.
If you don't have enough memory, the compiler fails, with a message like
'x86_64-linux-gnu-gcc' failed with exit status 4
To fix it, you need to add more ram or free some.
answered Nov 29 '18 at 14:12
YvainYvain
1
1
add a comment |
add a comment |
This approach worked for me:
sudo apt-get install libgdal-dev
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pip3 install gdal==2.2.3
Or as a part of a Dockerfile:
RUN apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get install -y
libgdal-dev
python3-pip
ARG CPLUS_INCLUDE_PATH=/usr/include/gdal
ARG C_INCLUDE_PATH=/usr/include/gdal
RUN pip3 install gdal==2.2.3
New contributor
add a comment |
This approach worked for me:
sudo apt-get install libgdal-dev
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pip3 install gdal==2.2.3
Or as a part of a Dockerfile:
RUN apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get install -y
libgdal-dev
python3-pip
ARG CPLUS_INCLUDE_PATH=/usr/include/gdal
ARG C_INCLUDE_PATH=/usr/include/gdal
RUN pip3 install gdal==2.2.3
New contributor
add a comment |
This approach worked for me:
sudo apt-get install libgdal-dev
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pip3 install gdal==2.2.3
Or as a part of a Dockerfile:
RUN apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get install -y
libgdal-dev
python3-pip
ARG CPLUS_INCLUDE_PATH=/usr/include/gdal
ARG C_INCLUDE_PATH=/usr/include/gdal
RUN pip3 install gdal==2.2.3
New contributor
This approach worked for me:
sudo apt-get install libgdal-dev
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pip3 install gdal==2.2.3
Or as a part of a Dockerfile:
RUN apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get install -y
libgdal-dev
python3-pip
ARG CPLUS_INCLUDE_PATH=/usr/include/gdal
ARG C_INCLUDE_PATH=/usr/include/gdal
RUN pip3 install gdal==2.2.3
New contributor
New contributor
answered 13 mins ago
Ivan KovtunIvan Kovtun
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f28966%2fpython-gdal-package-missing-header-file-when-installing-via-pip%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I have similar issue on windows, installing gdal via pip in virtual env. ![enter image description here](i.stack.imgur.com/EVLWP.jpg)
– Hayat Khan
Aug 22 '18 at 7:39