I have installed python 2.5.1 and FWTools2.4.7 in my laptop(Windows 7) when i run my pythonscript in FWTools i get following error Import error:No module named _gdal can any one suggest how to solve this problem?

  • 1
    gdal is a separate module from fwtools and python. your script must try to use it. you can build your own or use the osgeo4w. you don't state what your os is. – Brad Nesom Aug 26 '14 at 16:22
  • Dear BradMy os is windows 7 professional,service pack 1,x86-based pc.How to use osgeo4w – Devendra Tamrakar Aug 26 '14 at 17:29
  • 1
    Please add requested info to edited question. Osge4w is complete installation of open gis tools with all dependencies. Otherwise you should become proficient in all dependencies. – Brad Nesom Aug 26 '14 at 17:53
  • I cant solve my problem yet. Python version in FWTools is 2.3.4 but my installed python is 2.5.1 . May be due to this I am getting this problem. It would be better if somebody provides me step by step procedure because I am very new to this – user36358 Aug 28 '14 at 9:32
  • 1
    Please edit your original question instead of sending a comment as an answer. – user30184 Aug 28 '14 at 9:54

Generally speaking FWTools is pretty old and it should be used with care. However, FWTools is very easy to install and therefore I keep FWTools 2.0.6 and a few more versions always with me on USB stick.

FWTools includes its own python and at least those python scripts which are included in the \bin directory of FWTools should work without troubles.

  • Open the Windows command window
  • Set environment by running setfw.bat
  • Test if python is found and which version it is with python -V. FWTools 2.0.6 has python v. 2.3.4.
  • Test with some of the included scripts, for example

python bin\gdal2tiles.py

You should see some messages from the script.

For some reason you must launch the script as python script.py or otherwise I get exactly the same error than you:

Traceback (most recent call last):
  File "C:\FWTOOL~1.6\bin\gdal2tiles.py", line 38, in <module>
    import gdal
  File "c:\FWTOOL~1.6\pymod\gdal.py", line 191, in <module>
    import _gdal
ImportError: No module named _gdal

Please do not use FWTools anymore. It is outdated.

Current GDAL for Windows with python support is available via OSGEO4W (which works with Python 2.7), or from http://www.gisinternals.com/sdk/

  • FWTools is old but it works still as it worked when it was young. It contains bugs which have been found and corrected later and new GDAL is for sure better. However, if used with care FWTools can still be a good set of tools with no trouble with installation. – user30184 Aug 26 '14 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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