Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named osgeo.ogr

I need to import osgeo.ogr module to virtualenv python program.

Global python has this module:

user@ubuntu:~/$ python
Python 2.7.8 (default, Oct 20 2014, 15:05:19)
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import osgeo
>>>

But into virtualenv (without --no-site-packages):

user@ubuntu:~$ temp/bin/python
Python 2.7.8 (default, Oct 20 2014, 15:05:19) 
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import osgeo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named osgeo

What is the reason for this behavior?

like image 425
karavanjo Avatar asked Apr 24 '15 16:04

karavanjo


1 Answers

Able to solve with this one

pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`    
like image 186
Saroj Rai Avatar answered Sep 24 '22 15:09

Saroj Rai