fiona Importerror:...库未加载: @rpath/libpoppler.91.dylib
今天,我在Mac(Macos Monterey 12.2)上重新安装了Anaconda(Anaconda 3,Python 3.9)。我通过 conda-forge 安装了geopandas
,并在我的 base 环境的python中成功进口了它(3.9.12)。然后,我也安装了salem
通过 conda-forge ,在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)
阅读此书,我尝试在一个新的控制台,它给了我此错误消息:
>>> 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)
我在Conda软件包管理方面没有太多经验。当我运行conda列表
时,我会得到以下内容(删节):
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
我只包括 conda-forge packages,因为我的帖子太长了,以至于否则会被添加。如果需要,我可以提供conda列表
的完整输出。尽管如此,这些包装似乎就在那里。
有什么想法要解决这个问题吗?感谢您的帮助。
其他信息
我还尝试了
conda create -n test
conda activate test
conda install -c conda-forge fiona
,安装再次成功。但是,导入fiona
在测试环境的Python中仍然提供相同的错误消息。
有关GitHub上这篇文章的相关问题
似乎对待一个非常相似的问题: https:// https:// https:// github.com/conda-forge/geopandas-feedstock/issues/64 。但是,它是从2019年开始,并且在问题解决之前就已经关闭,因此对我没有帮助。
I reinstalled Anaconda (Anaconda 3, Python 3.9) on my Mac (MacOs Monterey 12.2) today. I installed geopandas
through conda-forge and imported it successfully in Python of my base environment (3.9.12). I then installed salem
through conda-forge too and its import in Python failed, returning:
>>> 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:
>>> 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. When I run conda list
I get the following (abridged):
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. I can provide the full output of conda list
if needed. Nevertheless, the packages seem to be all there.
Any ideas how to fix this? Thank you for your help.
Additional Info
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.
Related Issue
This post on GitHub seems to treat a very similar issue: 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将提供与GitHub问题相同的建议,哪个Conda Forge具有在其文档中:不要混合通道。频道混合是所有动态库问题的最常见原因。
Conda Forge仅
使用YAML
“>
so-fiona.yaml
和
conda env create -f so-fiona.yaml
,在所有主要平台上都可以正常工作。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. Channel mixing is the most common cause of all dynamic library issues.
No issue with Conda Forge only
Creating an environment from scratch with the YAML
so-fiona.yaml
and
conda env create -f so-fiona.yaml
, works fine on all major platforms.