I can neither import fiona nor gdal.
I installed the following Python version:
Python 3.9.4 (tags/v3.9.4:1f2e308, Apr 6 2021, 13:40:21) [MSC v.1928 64 bit (AMD64)]
Furthermore I installed the following :numpy, shapely, gdal, and fiona and am using Spyder for coding. Also I installed Visual Studio to be able to run C++.
I used pip to install numpy and shapely. For gdal I downloaded GDAL 3.4.1, released 2021/12/27
from: https://www.gisinternals.com/archive.php
I have added some environmental variables to windows for gdal, not sure if they are correct. While trying to solve the import problem I added more and more at different places...
I have installed Fiona 1.8.21
with the Fiona-1.8.21-cp39-cp39-win_amd64.whl from here using pip install.
So now my problem.
When I try to first import fiona, then that's the output:
import fiona
Traceback (most recent call last):
File "C:\Users\AN\AppData\Local\Temp\ipykernel_4032\1102285635.py", line 1, in <cell line: 1>
import fiona
File "c:\users\an\appdata\local\programs\python\python39\lib\site-packages\fiona\__init__.py", line 89, in <module>
from fiona.collection import BytesCollection, Collection
File "c:\users\an\appdata\local\programs\python\python39\lib\site-packages\fiona\collection.py", line 11, in <module>
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: DLL load failed while importing ogrext: The specified module could not be found.
When I first try to import gdal, error no module named gdal occurs. When I then try to import fiona the following errors occur:
import gdal
File "C:\Users\AN\AppData\Local\Temp\ipykernel_4032\3648793768.py", line 1, in <cell line: 1>
import gdal
ModuleNotFoundError: No module named 'gdal'
import fiona
File "c:\users\an\appdata\local\programs\python\python39\lib\site-packages\fiona\__init__.py", line 88, in <module>
with fiona._loading.add_gdal_dll_directories():
AttributeError: partially initialized module 'fiona' has no attribute '_loading' (most likely due to a circular import)
How can I fix this?
from osgeo import gdal
. See here.ImportError: cannot import name 'gdal' from 'osgeo' (unknown location)