Closed junaidq1 closed 2 years ago
My guess is that you compiled Fiona by yourself and afterward you updated proj / gdal using homebrew. If this is the case, it is necessary to rebuild Fiona against the updated libraries (Afaik rebuilding Fiona is necessary if any component Fiona is linked against was updated).
Does uninstalling Fiona and reinstalling it with pip install --no-binary fiona
solve your issue?
Probably unrelated, but still a bit strange is that Python 3.9 was released in 2020 and pip 9.0.1 is from November 2016. Could it be that you have multiple Python versions installed?
reinstalling it with pip install --no-binary fiona
does not solve the issue. I get the same error
Could you provide me with directions on how to rebuild Fiona against the updated libaries?
The error trace is referening proj@7 Reason: tried: '/opt/homebrew/opt/proj@7/lib/libproj.19.dylib'
I initially installed proj@7 via homebrew but then removed it via homebrew an installed proj v8 via homebrew. Not sure how I can get fiona to reference the right version of PROJ. Also, when I go to the proj/lib folder, there is no file there called libproj.19.dylib but there is a file called libgdal.dylib.
@junaidq1 Sorry, I think I gave the wrong statement, Could you post the output of pip install --no-binary fiona fiona
. Also please make sure that beforehand Fiona is uninstalled correctly and the directory /Users/junaid/Desktop/Udemy_projects/multiple/lib/python3.9/site-packages/fiona
does not exist anymore after uninstalling.
Also, could you post the output of pip --version
?
Output of pip install --no-binary fiona fiona
after uninstalling the previous version
(multiple) $ pip install --no-binary fiona fiona
Collecting fiona
Using cached Fiona-1.8.21.tar.gz (1.0 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: attrs>=17 in ./lib/python3.9/site-packages (from fiona) (21.4.0)
Requirement already satisfied: certifi in ./lib/python3.9/site-packages (from fiona) (2021.10.8)
Requirement already satisfied: click>=4.0 in ./lib/python3.9/site-packages (from fiona) (7.1.2)
Requirement already satisfied: cligj>=0.5 in ./lib/python3.9/site-packages (from fiona) (0.7.2)
Requirement already satisfied: click-plugins>=1.0 in ./lib/python3.9/site-packages (from fiona) (1.1.1)
Requirement already satisfied: six>=1.7 in ./lib/python3.9/site-packages (from fiona) (1.16.0)
Requirement already satisfied: munch in ./lib/python3.9/site-packages (from fiona) (2.5.0)
Requirement already satisfied: setuptools in ./lib/python3.9/site-packages (from fiona) (60.5.0)
Skipping wheel build for fiona, due to binaries being disabled for it.
Installing collected packages: fiona
Running setup.py install for fiona ... done
Successfully installed fiona-1.8.21
Output of pip --version:
pip 22.0.3 from /Users/junaid/Desktop/Udemy_projects/multiple/lib/python3.9/site-packages/pip (python 3.9)
Error on import fiona
In [1]: import fiona
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Input In [1], in <module>
----> 1 import fiona
File ~/Desktop/Udemy_projects/multiple/lib/python3.9/site-packages/fiona/__init__.py:86, in <module>
84 import fiona._loading
85 with fiona._loading.add_gdal_dll_directories():
---> 86 from fiona.collection import BytesCollection, Collection
87 from fiona.drvsupport import supported_drivers
88 from fiona.env import ensure_env_with_credentials, Env
File ~/Desktop/Udemy_projects/multiple/lib/python3.9/site-packages/fiona/collection.py:11, in <module>
9 with fiona._loading.add_gdal_dll_directories():
10 from fiona import compat, vfs
---> 11 from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
12 from fiona.ogrext import Session, WritingSession
13 from fiona.ogrext import buffer_to_virtual_file, remove_virtual_file, GEOMETRY_TYPES
ImportError: dlopen(/Users/junaid/Desktop/Udemy_projects/multiple/lib/python3.9/site-packages/fiona/ogrext.cpython-39-darwin.so, 0x0002): Library not loaded: /opt/homebrew/opt/proj@7/lib/libproj.19.dylib
Referenced from: /opt/homebrew/Cellar/gdal/3.4.1_1/lib/libgdal.30.dylib
Reason: tried: '/opt/homebrew/opt/proj@7/lib/libproj.19.dylib' (no such file), '/usr/local/lib/libproj.19.dylib' (no such file), '/usr/lib/libproj.19.dylib' (no such file)
@junaidq1 Thanks. I'm not experienced with macs, but what looks strange for me is that the pip output sees packages in ./lib/python3.9/site-packages
and there seems to be another python installation in /Desktop/Udemy_projects/multiple/lib/python3.9/site-packages
.
Could you try to execute pip with the python version of the python installation you want to use Fiona with: /path/to/python -m pip install --no-binary fiona --force-reinstall fiona
I would expect that /path/to/python
should be something like /Users/junaid/Desktop/Udemy_projects/multiple/bin/python3.9
this didn't work but i ended up removing and reinstalling homebrew and all the dependencies again and it ended up working for me
Expected behavior and actual behavior.
I currently have fiona version 1.8.21 installed via pip. (I have also tried older versions 1.8.19 based on a stackoverflow recommendation)
When I try and import fiona into my jupyter notebook, I get the following error
Steps to reproduce the problem.
import fiona
Operating system
For example: Mac m1 pro 2022
Fiona and GDAL version and provenance
Fiona: 1.8.21 installed from PyPI using pip version 9.0.1.
GDAL: 3.4.1 installed via homebrew PROJ: 8.2.1 installed via homebrew