pip install succeeds, ImportError on import


gavinswanson@...
 

Trying to work out some issues importing fiona.

Python 3.8.2
GDAL: http://download.gisinternals.com/sdk/downloads/release-1911-x64-gdal-3-0-4-mapserver-7-4-3.zip and associated libs
Everything installed via pip
Doing the `add_ddl_directory` call (already a pending PR for python 3.8) manually gets past the failure to find the module.
Now it fails to find a procedure, and I'm at a complete loss for how to hunt down the issue further.
Dependency walker run against `ogrext.cp38-win_amd64.pyd` shows issues, but I'm at a loss for how to solve them.

Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.add_dll_directory('c:\program files\gdal')
<AddedDllDirectory('c:\\program files\\gdal')>
>>> import fiona
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\gavin\covid_env\lib\site-packages\fiona\__init__.py", line 84, in <module>
    from fiona.collection import BytesCollection, Collection
  File "C:\Users\gavin\covid_env\lib\site-packages\fiona\collection.py", line 9, in <module>
    from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: DLL load failed while importing ogrext: The specified procedure could not be found.




René Buffat
 

I'm not really familiar with installing Fiona on Windows.  I could imagine that potential issues could be the wrong settings of environment variables, missing Visual C++ installations, wrong location of files or the Python 3.8 dll loading issue.  
I would recommend you to try to stay as close as to our appveyor setup as possible: https://github.com/Toblerity/Fiona/blob/master/appveyor.yml
as this is proven to work. 

As long as you don't intend to modify Fiona itself, there is no need to take the "hard" route. The easy route would be to use binary packages provided by either conda or https://www.lfd.uci.edu/~gohlke/pythonlibs/


gavinswanson@...
 

I went through a long process of doing that yesterday. Same result.
I also noticed while doing it that appveyor is pulling the latest dev build of gdal, rather than the latest release, but not for the libs. Is this intentional?

Link to latest dev:

https://github.com/Toblerity/Fiona/blob/71f34cfa914d4ca218c395657366042823b8969b/appveyor.yml#L77

As in here: http://www.gisinternals.com/query.html?content=filelist&file=release-1911-x64-gdal-mapserver.zip

Link to stable daily libs:

https://github.com/Toblerity/Fiona/blob/71f34cfa914d4ca218c395657366042823b8969b/appveyor.yml#L78

as in here: http://www.gisinternals.com/query.html?content=filelist&file=release-1911-x64-gdal-3-0-mapserver-7-4.zip

In the interest of getting the actual project moving I did break down and start from scratch on an Anaconda env, which ended up working for me. I was having issues initially, that's why I went down the path of pip install/build for everything.


Understood that currently pre-built binaries are the way to go... But shouldn't the goal be at least pre-built wheels?

I've got some time to kick this around a little if I can get some assistance.