pythoncondaspydergdalminiconda

Spyder does not find gdal package even though it is installed


I have installed gdal with miniconda in the working environment for spyder. After restarting the PC, the conda list shows me that gdal is installed. However, I can not import the package.

"""Error: No module named 'gdal'"""

The PythonPath Manager did not solve the problem either. I have also manually installed georasters, which was recommended elsewhere. Does anyone have an idea what the problem is? The problem is only with gdal. I have installed geopandas as a test and it works as it should.

Miniconda Terminal


Solution

  • You need to use

    from osgeo import gdal
    

    See documentation: https://gdal.org/api/python_bindings.html