I am using Python 3.6 and still having this problem,, although I have tried to uninstall both numpy and GDAL and installed them again in the order numpy then GDAL
I am using Windows 10.
This was my code:
import numpy
import PIL
import osgeo
from osgeo import gdal
import raster2xyz
from raster2xyz import Raster2xyz
from PIL import Image
and this is the error?
Traceback (most recent call last): File "C:/Users/user/PycharmProjects/Tutorials/19august.py", line 3, in import osgeo File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\osgeo_init_.py", line 32, in gdal = swig_import_helper() File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\osgeo_init.py", line 31, in swig_import_helper return importlib.import_module('gdal') File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\importlib_init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_gdal'
Process finished with exit code 1
Best Answer
As Arash Madadi pointed out in his answer, you need Python 3.5 for this to work. As far as I know, there is no way around this, but please correct me, if you find a way.
After you installed Python 3.5 64bit (didn't test it for 32bit), follow these steps to run your snippet from above:
pip install raster2xyz
pip install raster2points==0.1.8
(latest version usesnumba 0.49.1
which is not available for python 3.5)Note, that you'll have to change your import of Raster2xyz to
from raster2xyz.raster2xyz import Raster2xyz