mortii / anki-morphs

A MorphMan fork rebuilt from the ground up with a focus on simplicity, performance, and a codebase with minimal technical debt.
https://mortii.github.io/anki-morphs/
GNU Affero General Public License v3.0
64 stars 10 forks source link

Anki error trying to import numpy #287

Closed Palerath closed 2 months ago

Palerath commented 2 months ago

Describe the bug

After following the instructions here to install SpaCy, Anki detects an error with importing numpy.

Steps to reproduce the behavior

I followed the windows instructions to install SpaCy, removing the"-3.9" mention because I have the 3.12.5 version installed.

Expected behavior

No Anki error relatiing anki-morphs and SpaCy.

Screenshots

Anki error: anki_7Y2QpkozeM anki-morphs error: anki_lf7XEyHzT0

My AnkiMorphs settings

ankimorphs_config.json

My system

Additional context

Here is the error log:

Anki 24.06.3 (d678e393) (ao) Python 3.9.18 Qt 6.6.2 PyQt 6.6.1 Platform: Windows-10-10.0.19045

Traceback (most recent call last): File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\spacyenv\Lib\site-packages\numpy\core__init__.py", line 24, in from . import multiarray File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\spacyenv\Lib\site-packages\numpy\core\multiarray.py", line 10, in from . import overrides File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\spacyenv\Lib\site-packages\numpy\core\overrides.py", line 8, in 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 "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\spacyenv\Lib\site-packages\numpy__init.py", line 144, in from numpy.config__ import show as show_config File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\spacyenv\Lib\site-packages\numpy__config.py", line 4, in from numpy.core._multiarray_umath import ( File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\spacyenv\Lib\site-packages\numpy\core\init__.py", line 50, in 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:

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'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "aqt.webview", line 50, in cmd File "aqt.webview", line 160, in _onCmd File "aqt.webview", line 695, in _onBridgeCmd File "aqt.toolbar", line 413, in _linkHandler File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\472573498\recalc\recalc_main.py", line 65, in recalc settings_error: Exception | None = _check_selected_settings_for_errors( File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\472573498\recalc\recalc_main.py", line 130, in _check_selected_settings_for_errors morphemizer_found = morphemizer_module.get_morphemizer_by_description( File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\472573498\morphemizers\morphemizer.py", line 80, in get_morphemizer_by_description get_all_morphemizers() File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\472573498\morphemizers\morphemizer.py", line 69, in get_all_morphemizers for spacy_model in spacy_wrapper.get_installed_models(): File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\472573498\morphemizers\spacy_wrapper.py", line 354, in get_installed_models import spacy.util # pylint:disable=import-outside-toplevel File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\spacyenv\Lib\site-packages\spacy__init__.py", line 6, in from .errors import setup_default_warnings File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\spacyenv\Lib\site-packages\spacy\errors.py", line 3, in from .compat import Literal File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\spacyenv\Lib\site-packages\spacy\compat.py", line 4, in from thinc.util import copy_array File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\spacyenv\Lib\site-packages\thinc__init.py", line 2, in import numpy File "C:\Users\perihelie\AppData\Roaming\Anki2\addons21\spacyenv\Lib\site-packages\numpy\init__.py", line 149, in raise ImportError(msg) from e ImportError: Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python interpreter from there.

===Add-ons (active)=== (add-on provided name [Add-on folder, installed at, version, is config changed]) AJT Browser Play Button ['182970692', 2023-11-03T03:39, 'None', ''] AJT Card Management ['1021636467', 2024-03-16T02:51, 'None', ''] AJT Flexible Grading ['1715096333', 2024-06-08T19:08, 'None', mod] AJT Japanese ['1344485230', 2024-08-22T20:21, 'None', mod] AJT Media Converter ['1151815987', 2024-06-29T13:15, 'None', ''] AJT Merge Notes Merge and Duplicate notes ['1425504015', 2024-08-29T16:32, 'None', ''] Add Hyperlink ['318752047', 2023-06-18T13:39, 'None', ''] Advanced Browser ['874215009', 2023-10-21T16:34, 'None', ''] Advanced Copy Fields ['1898445115', 2024-01-08T18:01, 'v0.4.01', ''] AnkiConnect ['2055492159', 2024-07-26T06:55, 'None', ''] AnkiMorphs ['472573498', 2024-08-31T11:05, 'None', mod] Card Info During Review ['2179254157', 2023-11-14T06:56, 'None', ''] Cross Profile Search and Import 20 ['1772763629', 2024-08-16T22:11, 'None', ''] Edit Field During Review Cloze ['385888438', 2024-01-03T08:19, '6.18', mod] Fix invalid card IDs ['196231552', 2021-11-26T02:33, 'None', ''] Image Occlusion Enhanced ['1374772155', 2022-04-09T09:15, 'None', ''] Japanese Readings and Pitch Accent ['1845503807', 2023-01-02T01:38, 'None', ''] Kanji Grid ['909972618', 2019-01-09T23:40, 'None', ''] MecabUnidic ['MecabUnidic', 0, 'None', ''] Mini Format Pack ['295889520', 2023-11-02T19:00, 'None', ''] Quick Colour Changing ['2491935955', 2023-10-19T05:15, 'None', ''] RefoldEase ['819023663', 2023-11-03T04:01, 'None', ''] Reset Card Scheduling ['300884351', 2018-09-18T18:17, 'None', ''] Review Heatmap ['1771074083', 2022-06-30T03:43, 'None', ''] Speed Focus Mode auto-alert auto-reveal auto-answer ['1046608507', 2022-12-16T12:24, 'None', ''] Syntax Highlighting for Code ['1463041493', 2018-10-07T03:31, 'None', ''] True Retention ['613684242', 2017-11-19T21:43, 'None', ''] True Retention by Card Maturity Simplified ['1779060522', 2020-06-28T15:45, 'None', ''] Yomichan Forvo Server ['580654285', 2024-07-16T00:36, 'None', ''] ankimorphs-japanese-mecab ['1974309724', 2024-03-21T12:40, 'None', '']

===IDs of active AnkiWeb add-ons=== 1021636467 1046608507 1151815987 1344485230 1374772155 1425504015 1463041493 1715096333 1771074083 1772763629 1779060522 182970692 1845503807 1898445115 196231552 1974309724 2055492159 2179254157 2491935955 295889520 300884351 318752047 385888438 472573498 580654285 613684242 819023663 874215009 909972618

===Add-ons (inactive)=== (add-on provided name [Add-on folder, installed at, version, is config changed])

mortii commented 2 months ago

I followed the windows instructions to install SpaCy, removing the"-3.9" mention because I have the 3.12.5 version installed.

The error message says that your Anki is using 3.9:

Please note and check the following:

  • The Python version is: Python3.9 from "D:\Applications\Anki\anki.exe"
  • The NumPy version is: "1.26.4"

Try deleting the %HOMEPATH%\AppData\Roaming\Anki2\addons21\spacyenv folder then redo the installation procedure with the default steps provided, including installing python 3.9.

Palerath commented 2 months ago

It worked thank you. I didn't see the link to python 3.9 in the guide my bad.

mortii commented 2 months ago

No problem, installing spacy is complicated and unintuative, so I don't blame anyone for getting it wrong.

I'm glad you got it to work🙂

github-actions[bot] commented 2 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.