[英]fiona ImportError: ... Library not loaded: @rpath/libpoppler.91.dylib
I reinstalled Anaconda (Anaconda 3, Python 3.9) on my Mac (MacOs Monterey 12.2) today.我今天在我的 Mac (MacOs Monterey 12.2) 上重新安装了 Anaconda (Anaconda 3, Python 3.9)。 I installed
geopandas
through conda-forge and imported it successfully in Python of my base environment (3.9.12).我通过 conda - forge 安装了
geopandas
,并在我的基础环境(3.9.12)的 Python 中成功导入了它。 I then installed salem
through conda-forge too and its import in Python failed, returning:然后我也通过conda-forge安装了
salem
,它在 Python 中的导入失败,返回:
>>> import salem
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/felixlangot/opt/anaconda3/lib/python3.9/site-packages/salem/__init__.py", line 60, in <module>
from salem.datasets import *
File "/Users/felixlangot/opt/anaconda3/lib/python3.9/site-packages/salem/datasets.py", line 32, in <module>
from salem import utils, gis, wrftools, sio, check_crs
File "/Users/felixlangot/opt/anaconda3/lib/python3.9/site-packages/salem/utils.py", line 88, in <module>
hash_cache_dir = _hash_cache_dir()
File "/Users/felixlangot/opt/anaconda3/lib/python3.9/site-packages/salem/utils.py", line 55, in _hash_cache_dir
import geopandas
File "/Users/felixlangot/opt/anaconda3/lib/python3.9/site-packages/geopandas/__init__.py", line 7, in <module>
from geopandas.io.file import _read_file as read_file # noqa
File "/Users/felixlangot/opt/anaconda3/lib/python3.9/site-packages/geopandas/io/file.py", line 14, in <module>
import fiona
File "/Users/felixlangot/opt/anaconda3/lib/python3.9/site-packages/fiona/__init__.py", line 85, 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)
Reading this, I tried to import fiona
by itself in a new console and it gave me this error message:阅读本文后,我尝试在新控制台中自行导入
fiona
,它给了我以下错误消息:
>>> import fiona
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/felixlangot/opt/anaconda3/lib/python3.9/site-packages/fiona/__init__.py", line 86, in <module>
from fiona.collection import BytesCollection, Collection
File "/Users/felixlangot/opt/anaconda3/lib/python3.9/site-packages/fiona/collection.py", line 11, in <module>
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: dlopen(/Users/felixlangot/opt/anaconda3/lib/python3.9/site-packages/fiona/ogrext.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/libpoppler.91.dylib
Referenced from: /Users/felixlangot/opt/anaconda3/lib/libgdal.30.dylib
Reason: tried: '/Users/felixlangot/opt/anaconda3/lib/libpoppler.91.dylib' (no such file), '/Users/felixlangot/opt/anaconda3/lib/python3.9/site-packages/fiona/../../../libpoppler.91.dylib' (no such file), '/Users/felixlangot/opt/anaconda3/lib/python3.9/site-packages/fiona/../../../libpoppler.91.dylib' (no such file), '/Users/felixlangot/opt/anaconda3/lib/libpoppler.91.dylib' (no such file), '/Users/felixlangot/opt/anaconda3/bin/../lib/libpoppler.91.dylib' (no such file), '/Users/felixlangot/opt/anaconda3/lib/libpoppler.91.dylib' (no such file), '/Users/felixlangot/opt/anaconda3/bin/../lib/libpoppler.91.dylib' (no such file), '/usr/local/lib/libpoppler.91.dylib' (no such file), '/usr/lib/libpoppler.91.dylib' (no such file)
I don't have much experience with management of Conda packages.我在管理 Conda 包方面没有太多经验。 When I run
conda list
I get the following (abridged):当我运行
conda list
时,我得到以下信息(删节):
conda list
# packages in environment at /Users/felixlangot/opt/anaconda3:
#
# Name Version Build Channel
boost-cpp 1.70.0 hd59e818_1 conda-forge
branca 0.5.0 pyhd8ed1ab_0 conda-forge
cairo 1.16.0 h0ab9d94_1001 conda-forge
cftime 1.6.0 py39h86b5767_1 conda-forge
click-plugins 1.1.1 py_0 conda-forge
cligj 0.7.2 pyhd8ed1ab_1 conda-forge
conda 4.12.0 py39h6e9494a_0 conda-forge
expat 2.4.4 he49afe7_0 conda-forge
fiona 1.8.21 py39haa9df5e_0 conda-forge
folium 0.12.1.post1 pyhd8ed1ab_1 conda-forge
fontconfig 2.13.94 h10f422b_0 conda-forge
freexl 1.0.6 h0d85af4_0 conda-forge
geopandas 0.10.2 pyhd8ed1ab_1 conda-forge
geopandas-base 0.10.2 pyha770c72_1 conda-forge
geos 3.8.0 h4a8c4bd_1 conda-forge
gettext 0.19.8.1 h7937167_1005 conda-forge
glib 2.68.4 he49afe7_0 conda-forge
glib-tools 2.68.4 he49afe7_0 conda-forge
hdf4 4.2.13 hefd3b78_1005 conda-forge
json-c 0.13.1 h575e443_1002 conda-forge
kealib 1.4.14 h31dd65d_2 conda-forge
libdap4 3.19.1 hae55d67_1000 conda-forge
libglib 2.68.4 hd556434_0 conda-forge
libkml 1.3.0 hed7d534_1010 conda-forge
libspatialite 4.3.0a h9691d84_1033 conda-forge
libzip 1.8.0 h8b0c345_1 conda-forge
mapclassify 2.4.3 pyhd8ed1ab_0 conda-forge
munch 2.5.0 py_0 conda-forge
pcre 8.45 he49afe7_0 conda-forge
pixman 0.38.0 h01d97ff_1003 conda-forge
poppler 0.89.0 hd735947_5 conda-forge
poppler-data 0.4.11 hd8ed1ab_0 conda-forge
proj 6.2.1 h773a61f_0 conda-forge
python_abi 3.9 2_cp39 conda-forge
salem 0.3.7 pyhd8ed1ab_0 conda-forge
tiledb 2.2.9 he9a4fb4_0 conda-forge
xyzservices 2022.4.0 pyhd8ed1ab_0 conda-forge
I only included conda-forge packages because my post was too long to be accpeted otherwise.我只包含conda- forge 包,因为我的帖子太长而无法接受。 I can provide the full output of
conda list
if needed.如果需要,我可以提供
conda list
的完整输出。 Nevertheless, the packages seem to be all there.尽管如此,包裹似乎都在那里。
Any ideas how to fix this?任何想法如何解决这一问题? Thank you for your help.
谢谢您的帮助。
I also tried我也试过
conda create -n test
conda activate test
conda install -c conda-forge fiona
and the installation was again successful.并且安装再次成功。 However,
import fiona
in Python of test environment still gives the same error message.但是,在测试环境的 Python 中
import fiona
仍然会给出相同的错误消息。
This post on GitHub seems to treat a very similar issue: https://github.com/conda-forge/geopandas-feedstock/issues/64 . GitHub 上的这篇文章似乎处理了一个非常相似的问题: https ://github.com/conda-forge/geopandas-feedstock/issues/64。 However, it is from 2019 and was closed before the problem was fixed, so it did not help me.
但是,它是从 2019 年开始的,并且在问题解决之前就关闭了,所以它对我没有帮助。
I'm going to give the same advice as on the GitHub issue and which Conda Forge has in their documentation : don't mix channels .我将给出与 GitHub 问题以及 Conda Forge 在其文档中相同的建议:不要混合频道。 Channel mixing is the most common cause of all dynamic library issues.
通道混合是所有动态库问题的最常见原因。
Creating an environment from scratch with the YAML使用 YAML 从头开始创建环境
so-fiona.yaml so-fiona.yaml
name: so-fiona
channels:
- conda-forge
dependencies:
- python=3.9
- fiona
- salem
and conda env create -f so-fiona.yaml
, works fine on all major platforms.和
conda env create -f so-fiona.yaml
,在所有主要平台上都可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.