pythondllpackagecondadllimport

ImportError: DLL load failed while importing _gdal: The specified module could not be found


I have a python script that previously worked but that now throws the error:ImportError: DLL load failed while importing _gdal: The specified module could not be found. I am trying to upload a shapefile using fiona and originally the message read: ImportError: DLL load failed while importing _fiona: The specified module could not be found. I am using anaconda navigator as my IDE on windows 11.

I am aware that this is a question that has been asked before and I have read the answers to those questions. The solutions, however, hove not worked either due to my circumstance or my misinterpretation and action in following through with it. So my question is either how do I fix this, or, if it is not that simple, to better understand the problem.

I have looked inside the DLLs folder within the environment folder that I am using and there is nothing in there with name fiona, gdal or geopandas.

My attempts so far:

1. uninstall and re-install fiona gdal and geopandas (as I believe they are dependent).

2. update all libraries and anaconda to latest verions.

3. download Visual C++ Redistributable for Visual Studio 2015. Ran into issue during download as it was already installed on my computer, likely because it is a windows computer. Is it possible that this would help if i moved it to a different path/folder?

4. Uninstall and re-install anaconda navigator on cumputer. Re-create virtual environemt and import necessary libraries. result: error in line: import geopandas as gpd: ImportError: DLL load failed while importing _datadir: The specified module could not be found.

If there is a fix that I have not mentioned or if you suspect that I attempted one of the above fixed incorrectly because of my limited understanding of how python libraries are stored please make a suggestion!

Thank you


Solution

  • I was struggling badly with the same problem for the last couple of days. Using conda, I've tried everything I found on the internet such as:

    conda update gdal

    conda update -n base -c defaults conda

    Creating new environments (over and over again).

    Despite it's not recommended I even tried it with pip install... but no results.

    At the end what worked for me was to create a new environment with Python version 3.6

    conda create -n env python=3.6 gdal spyder

    Let me know if it worked.