Search code examples
pythongdal

No module named '_gdal' and gdal


despite the fact that I have installed gdal, it seems that the package does not exist.

import gdal
Traceback (most recent call last):
  Input In [4] in <cell line: 1>
    import gdal
ModuleNotFoundError: No module named 'gdal'
conda list gdal
# packages in environment at ....:
#
# Name                    Version                   Build  Channel
gdal                      3.6.2            py38h2fd6ed0_1  
libgdal                   3.6.2                hc0e11bb_1**  

When I try to import osgeo i get the error: ModuleNotFoundError: No module named '_gdal'

Apart from the fact that it is not recognized, why gdal in the first case and _gdal in the second one? I was told that I should load gdal outside anaconda in the HPC of my institution, but gdal via command module load gdal/3.0.1 # the version 3.0.1. is one of the provided for gcc compilers is available only for gcc compilers, not for intel compilers.

Thanks, Dimitris


Solution

  • The first issue was solved as it is described in the comment. The second issue was caused by the absense of file libpoppler.so.126 in the dir .../conda_env/2609_385_intel/2609_385_intel/lib/libpoppler.so.126

    So just placing this file in this dir and it solved. (the file existed in other conda_env of mine so i just copied it in my working conda environment)

    Here is the link for the file if needed: https://drive.google.com/file/d/1HNGYJX8lYd1vXWclxy1Tr7D7TGsYpgTj/view?usp=drive_link