Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm writing this as an utter Ubuntu newbie. I want to run the script found on Save points to a shapefile with GDAL. But I get the following error, yes this error is similar to the question posted here. Stick with me.

Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import point_store
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "point_store.py", line 3, in <module>
import osgeo.ogr
File "/usr/lib/python2.7/dist-packages/osgeo/__init__.py", line 21, in      
<module>
_gdal = swig_import_helper()
File "/usr/lib/python2.7/dist-packages/osgeo/__init__.py", line 17, in     
swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: /usr/lib/python2.7/dist-packages/osgeo/_gdal.so: symbol  
VSIFTruncateL, version GDAL_1.8 not defined in file libgdal.so.1 with link 
time reference

After reading the question I reference above I tried this:

sudo pip install GDAL==1.8.1

And then I got the following error:

cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for   
Ada/C/ObjC but not for C++ [enabled by default]
extensions/gdal_wrap.cpp:149:20: fatal error: Python.h: No such file or 
directory

compilation terminated.

error: command 'gcc' failed with exit status 1

Does anyone have an idea how I can get my gcc to happy fun times? There are lots of forum posts around about this error but I'm still looking for that "aha" moment.

share|improve this question
    
As a guess, try sudo apt-get install build-essential python-all-dev –  Mike T Apr 20 '12 at 6:25
    
I am now able to run the script I mentioned above sans any gcc error - I downloaded Ubuntu and all the other necessary programs onto my other computer. This is not really a solution but I'm glad to have an option for utilizing gcc and python now. –  Patty Jula May 4 '12 at 2:32

1 Answer 1

On Ubuntu the safest way is always to rely on the package manager, then everything just works. I strongly recommend to install the GDAL Python bindings using apt-get instead of pip, try:

sudo apt-get install python-gdal
share|improve this answer
    
Thank you for the responses webrian and @Mike Toews. I tried your suggestions, restarted my computer, and am still getting the same error. I also wanted to mention that when I ran the script I referenced the first time, it worked just fine! I ran it several times using different coordinates even. I am open to other ideas on how to get everything set up properly, should there be other thoughts. –  Patty Jula Apr 21 '12 at 2:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.