14

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

1 Answer 1

14

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)...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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