Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install Fiona on Windows

Tags:

I've done a software on Ubuntu, and I'm having several problems running this software on Windows.

My biggest issue point now is that I'm trying to install "fiona" - I have it already installed on my PIP packages - but for some reason it's not working.

So I've tried to install it via setup download from the original repository.

By following the rules: using python setup.py install

I've already added some environment variables as:

GDAL_DATA GDAL_DRIVER_PATH 

and beyond that I've added on variable PATH the path of GDAL

There's another way to do it, by using another command but I don't how would it be

gdal include files

gdal library

python setup.py build_ext -I<path to gdal include files> -lgdal_i -L<path to gdal library> install --gdalversion 2.1

My current version of GDAL is GDAL 1.11.4, released 2016/01/25

I'd already tried with 2.3 etc. and it didn't work.

I've tried using only this command:

python setup.py install --gdalversion 1.11

fiona/_geometry.c(578) : fatal error C1083: Cannot open include file: 'ogr_api.h ': No such file or directory

Which results when I try to use a software that has fiona, I receive the following error:

    import fiona
  File "C:\Python27\fiona\__init__.py", line 81, in <module>
    from fiona.collection import Collection, BytesCollection
  File "C:\Python27\fiona\collection.py", line 9, in <module>
    from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: No module named ogrext
like image 951
Guilherme Lima Avatar asked Jun 15 '18 13:06

Guilherme Lima


People also ask

How do I download Fiona?

Windows. Binary installers are available at https://www.lfd.uci.edu/~gohlke/pythonlibs/#fiona and coming eventually to PyPI. You can download a binary distribution of GDAL from here. You will also need to download the compiled libraries and headers (include files).

What is Fiona in Python?

Fiona lets Python developers to interface geographic information systems with other computer systems by reading and writing geographic data files. Fiona includes extension modules that connect the Geospatial Data Abstraction Library to other applications (GDAL). Fiona is made to be easy to use and dependable.


2 Answers

When building from source on Windows, it is important to know that setup.py cannot rely on gdal-config, which is only present on UNIX systems. On Windows, these paths need to be provided by the user. You will need to find the include files and the library files for gdal and use setup.py

The GDAL DLL files and gdal-data directory need to be in your Windows PATH otherwise building Fiona will fail to work.

Follow below steps to install Fiona and geopandas on windows

Step 1: Download the Fiona wheel from this website. please pick the .whl package that correlates with your python interpreter as well system build (i.e. 32 bit or 64 bit)

Step 2: Install fiona by using pip install path/to/fiona.whl

Step 3: Install geopandas by using 'pip install geopandas'

like image 125
Sarang Avatar answered Sep 18 '22 14:09

Sarang


To install Fiona on windows, you need to follow the below-mentioned steps: -

  1. You need to install GDAL wheel file using the link . After visiting this link, download this file named GDAL‑3.0.4‑cp37‑cp37m‑win32.whl since it worked for me and then use the command
pip install c:\Users\........\GDAL‑3.0.4‑cp37‑cp37m‑win32.whl

to successfully install GDAL which is the requirement of Geopandas.

  1. After installing the GDAL, you need to install a Fiona wheel file using the link. Upon visiting this link, download the file named Fiona‑1.8.13‑cp37‑cp37m‑win32.whl since it is the supported wheel file for most of the windows users. After downloading this file, use the command
pip install c:\Users\........\Fiona‑1.8.13‑cp37‑cp37m‑win32.whl

NOTE: If the above-mentioned wheel file doesn't work for you, then try using alternate wheel files.

like image 20
PIYUSH AGGARWAL Avatar answered Sep 19 '22 14:09

PIYUSH AGGARWAL