I'd like to use numpy for my plugin(for nltk to find named entity) by append 'site-packages' folder to sys.path but I get this error:
Code:
Traceback (most recent call last):
File "/Users/x/Library/Preferences/calibre/plugins/WordDumb.zip/.venv/lib/python3.9/site-packages/numpy/core/__init__.py", line 22, in <module>
from . import multiarray
File "zipimport.py", line 259, in load_module
File "/Users/x/Library/Preferences/calibre/plugins/WordDumb.zip/.venv/lib/python3.9/site-packages/numpy/core/multiarray.py", line 12, in <module>
from . import overrides
File "zipimport.py", line 259, in load_module
File "/Users/x/Library/Preferences/calibre/plugins/WordDumb.zip/.venv/lib/python3.9/site-packages/numpy/core/overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "calibre/gui2/threaded_jobs.py", line 83, in start_work
File "calibre_plugins.worddumb.parse_job", line 42, in do_job
for node in ne_chunk(pos_tag(word_tokenize(text.decode('utf-8')))):
File "/Users/x/Library/Preferences/calibre/plugins/WordDumb.zip/.venv/lib/python3.9/site-packages/nltk/chunk/__init__.py", line 185, in ne_chunk
chunker = load(chunker_pickle)
File "/Users/x/Library/Preferences/calibre/plugins/WordDumb.zip/.venv/lib/python3.9/site-packages/nltk/data.py", line 757, in load
resource_val = pickle.load(opened_resource)
File "zipimport.py", line 259, in load_module
File "/Users/x/Library/Preferences/calibre/plugins/WordDumb.zip/.venv/lib/python3.9/site-packages/numpy/__init__.py", line 145, in <module>
from . import core
File "zipimport.py", line 259, in load_module
File "/Users/x/Library/Preferences/calibre/plugins/WordDumb.zip/.venv/lib/python3.9/site-packages/numpy/core/__init__.py", line 48, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "/Applications/calibre.app/Contents/MacOS/calibre-debug"
* The NumPy version is: "1.20.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
then I look up this file, it's called '_multiarray_umath.cpython-39-darwin.so'. How can I import numpy properly for calibre? I guess even if it's possible I also need to install different versions of numpy for different platform.