fiona ImportError: ... Library not loaded: @rpath/libpoppler.91.dylib
fiona ImportError: ... Library not loaded: @rpath/libpoppler.91.dylib
我今天在 Mac (MacOs Monterey 12.2) 上重新安装了 Anaconda (Anaconda 3, Python 3.9)。我通过 conda-forge 安装了 geopandas
并在我的 base 环境 (3.9.12) 的 Python 中成功导入了它.然后我也通过 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)
阅读此文后,我尝试在新控制台中自行导入 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)
我没有太多管理 Conda 包的经验。当我 运行 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
我只包含了 conda-forge 包,因为我的 post 太长了,否则无法接受。如果需要,我可以提供 conda list
的完整输出。尽管如此,包裹似乎都在那里。
有什么解决办法吗?感谢您的帮助。
附加信息
我也试过了
conda create -n test
conda activate test
conda install -c conda-forge fiona
再次安装成功。但是,import fiona
in Python of test 环境还是报同样的错误信息。
相关问题
GitHub 上的 post 似乎处理了一个非常相似的问题:https://github.com/conda-forge/geopandas-feedstock/issues/64。但是,它是从 2019 年开始的,在问题修复之前就关闭了,所以它对我没有帮助。
我将给出与 GitHub 问题以及 Conda Forge in their documentation 问题相同的建议:不要混用频道。通道混合是所有动态库问题的最常见原因。
仅 Conda Forge 没有问题
使用 YAML 从头开始创建环境
so-fiona.yaml
name: so-fiona
channels:
- conda-forge
dependencies:
- python=3.9
- fiona
- salem
和conda env create -f so-fiona.yaml
,在所有主要平台上运行良好。
我今天在 Mac (MacOs Monterey 12.2) 上重新安装了 Anaconda (Anaconda 3, Python 3.9)。我通过 conda-forge 安装了 geopandas
并在我的 base 环境 (3.9.12) 的 Python 中成功导入了它.然后我也通过 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)
阅读此文后,我尝试在新控制台中自行导入 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)
我没有太多管理 Conda 包的经验。当我 运行 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
我只包含了 conda-forge 包,因为我的 post 太长了,否则无法接受。如果需要,我可以提供 conda list
的完整输出。尽管如此,包裹似乎都在那里。
有什么解决办法吗?感谢您的帮助。
附加信息
我也试过了
conda create -n test
conda activate test
conda install -c conda-forge fiona
再次安装成功。但是,import fiona
in Python of test 环境还是报同样的错误信息。
相关问题
GitHub 上的 post 似乎处理了一个非常相似的问题:https://github.com/conda-forge/geopandas-feedstock/issues/64。但是,它是从 2019 年开始的,在问题修复之前就关闭了,所以它对我没有帮助。
我将给出与 GitHub 问题以及 Conda Forge in their documentation 问题相同的建议:不要混用频道。通道混合是所有动态库问题的最常见原因。
仅 Conda Forge 没有问题
使用 YAML 从头开始创建环境
so-fiona.yaml
name: so-fiona
channels:
- conda-forge
dependencies:
- python=3.9
- fiona
- salem
和conda env create -f so-fiona.yaml
,在所有主要平台上运行良好。