Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to optimize my python code using pypy. While I am able to import most libraries and run succesfully, I am not able to import GDAL libraries. The same libraries when imported in Python 2.7 run fine.

I have tried adding GDAL location to PYTHONPATH, and even tried downloading GDAL Python bindings to PyPy directory, somehow pypy does not want to recognize GDAL, and comes with the following error.

Traceback (most recent call last):

  File "", line 51, in run_toplevel

  File "", line 50, in <module>

    from osgeo import gdal, ogr, osr

  File "B:\PYPY\site-packages\osgeo\", line 21, in <module>

    _gdal = swig_import_helper()

  File "B:\PYPY\site-packages\osgeo\", line 13, in swig_import_helper

    import _gdal

ImportError: No module named _gdal
share|improve this question
up vote 13 down vote accepted

Pypy is not compatible with SWIG (see also this answer in StackOverflow), which is what the C bindings of GDAL use to talk to the Python compiler. Afraid it's a no dice unless you can spend the time to re-write the GDAL Python bindings with C-Types (which I suspect is pretty unlikely)...

share|improve this answer

Your Answer


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.