I know that this has been asked multiple times, but I still arrive at the ModuleNotFoundError: No module named '_gdal'
error in my Ubuntu 20.04 workstation and with Python 3.8 under Anaconda. The following are suggestions that I have tried:
- Install GDAL with
conda install -c conda-forge gdal
- it seemed to successfully install at first, but upon importingosgeo
into Python, I get theModuleNotFoundError
; - Install GDAL through
pip
- this does not succeed in installing GDAL. I receive an error indicating that the wheel file cannot be built; - Install
pygdal
either throughpip
orconda
(https://gis.stackexchange.com/a/356609/208986) - this has the same result as (1). I even downgraded my Python to 3.6 to install it throughconda
, but to no success; - https://stackoverflow.com/a/72413306/14081094 - I cannot successfully complete these steps due to GDAL not installing through
pip
(see 2); - https://stackoverflow.com/a/72887401/14081094, https://stackoverflow.com/a/41613466/14081094 - it was able to successfully install GDAL in Ubuntu 20.04, but unable to install GDAL in Python, again, through
pip
orconda
(see 1 and 2);
Weirdly enough, I can import GDAL through the base environment of Anaconda with no errors (using any of the steps), however when I try to import it through a virtual environment, the error occurs.
import gdal
instead offrom osgeo import gdal
?from osgeo import gdal
.