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 installed ArcGIS 10.1 yesterday (Windows 7 64-bit), but have a separate Python 2.7 installation. Now my gdal does not work correctly anymore. It looks like all commands without the ending "*.py" work fine -- e.g. gdal_rasterize, but all gdal commands with the ending "'.py" give me the following error:

Convert  C:\Users\max\icechart_minimum198403_201303.tif  to shapefile.
Traceback (most recent call last):
File "C:\Program Files\GDAL\gdal_polygonize.py", line 34, in <module>
 import gdal, ogr, osr
ImportError: No module named gdal

I checked all the variables, even the Registry entries as described here and the Environment path has C:\Program Files\GDAL at the first position and GDAL_DATA is C:\Program Files\GDAL\gdal-data ...

By the way, within Python I type "import gdal" and it is imported without any problem ...

This all seems right ... any advice on what could be missing / wrong, someone having run into the same problem ?

share|improve this question
    
This does not look like a duplicate but may reassure you that what you are trying to do is likely to be possible: gis.stackexchange.com/questions/44176/…. It may be worth editing your Question to record the version of ArcGIS for Desktop that you installed. –  PolyGeo May 21 at 10:44
    
I just see that my other Windows 7 computer had Python 2.7 and that I had installed ArcGIS there, somehow this was no issue there... so maybe ArcGIS has little to do here and the main question seems, why is gdal not finding import gdal in its own scripts ... –  Max May 21 at 10:49
    
How are you calling the gdal python script? Does it work if you manually call it through the proper Python installation (not the ArcGIS one)? –  Evil Genius May 21 at 10:51
    
yes -- if I call "import gdal" from Python (not via ArcGIS) , it imports without error. Only the command line gdal_polygonize.py gives the message above. That one cannot import gdal ... which seems strange ... –  Max May 21 at 10:53
    
You may have multiple python installs, ArcGis has it's own special version in C:\Python27\ArcGIS10.1 (usually). It is possible that the lib is installed in a location that it can't find. You might need to do sys.path.append(location of GDAL) before you import. This has fixed this problem for me previously, but that was in 9.3. –  Michael Miles-Stimson May 21 at 23:02

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.