我去年曾在樹莓派上順利安裝 SpaCy, 最近開始測試學習 SpaCy, 所以更新到最新版 (3.2.3), 但使用 import spacy 匯入套件時卻出現如下錯誤 :
pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import spacy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.local/lib/python3.7/site-packages/spacy/__init__.py", line 11, in <module>
from thinc.api import prefer_gpu, require_gpu, require_cpu # noqa: F401
File "/home/pi/.local/lib/python3.7/site-packages/thinc/api.py", line 2, in <module>
from .initializers import normal_init, uniform_init, glorot_uniform_init, zero_init
File "/home/pi/.local/lib/python3.7/site-packages/thinc/initializers.py", line 4, in <module>
from .backends import Ops
File "/home/pi/.local/lib/python3.7/site-packages/thinc/backends/__init__.py", line 8, in <module>
from .cupy_ops import CupyOps, has_cupy
File "/home/pi/.local/lib/python3.7/site-packages/thinc/backends/cupy_ops.py", line 19, in <module>
from .numpy_ops import NumpyOps
File "thinc/backends/numpy_ops.pyx", line 1, in init thinc.backends.numpy_ops
File "/home/pi/.local/lib/python3.7/site-packages/blis/__init__.py", line 3, in <module>
from .cy import init
ImportError: /home/pi/.local/lib/python3.7/site-packages/blis/cy.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_load_8
看起來似乎跟 Numpy 有關, 所以我用下列指令將 Numpy 更新到最新版 :
pi@raspberrypi:~ $ pip3 install -U numpy
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting numpy
Downloading https://files.pythonhosted.org/packages/c2/a8/a924a09492bdfee8c2ec3094d0a13f2799800b4fdc9c890738aeeb12c72e/numpy-1.21.5.zip (10.7MB)
Installing build dependencies ... done
Building wheels for collected packages: numpy
Running setup.py bdist_wheel for numpy ... done
Stored in directory: /home/pi/.cache/pip/wheels/76/e6/d5/2d8fa5fe6d63eaf4716dae5eaf819685b316cb3b4935d3ca09
Successfully built numpy
Installing collected packages: numpy
Found existing installation: numpy 1.21.1
Uninstalling numpy-1.21.1:
Successfully uninstalled numpy-1.21.1
Successfully installed numpy-1.21.5
但是無效, 仍然無法匯入 spacy. 搜尋谷歌找到下面這兩篇 :
裡面有人建議把 Numpy 退回 1.18.1 版即可 :
pi@raspberrypi:~ $ pip3 install numpy==1.18.1
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting numpy==1.18.1
Downloading https://www.piwheels.org/simple/numpy/numpy-1.18.1-cp37-cp37m-linux_armv7l.whl (10.4MB)
Installing collected packages: numpy
Found existing installation: numpy 1.21.5
Uninstalling numpy-1.21.5:
Successfully uninstalled numpy-1.21.5
Successfully installed numpy-1.18.1
但是退回 1.18.1 還是無效. 我覺得應該還是版本問題, 但沒時間研究, 先記下來擱著吧.
沒有留言:
張貼留言