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 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 "app_main.py", line 51, in run_toplevel

  File "ImportENC-P.py", line 50, in <module>

    from osgeo import gdal, ogr, osr

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

    _gdal = swig_import_helper()

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

    import _gdal

ImportError: No module named _gdal
share|improve this question
add comment

1 Answer

up vote 11 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
add comment

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.