Closed drkthomp closed 1 month ago
Weird, it looks correct...
Could you add some debugging print statements here: https://github.com/mortii/anki-morphs/blob/f04cd88a7122f57460ec4e1190c7d3ad009ed2ca/ankimorphs/spacy_wrapper.py#L334
e.g.:
spacy_path = os.path.join(mw.pm.addonFolder(), "spacyenv")
print(f"spacy_path: {spacy_path}")
When you run anki from the terminal and try to change morphemizer you should see the output.
EDIT:
Could you add some debugging print statements here:
make these change in the local file found in ~/.local/share/Anki2/addons21/472573498/spacy_wrapper.py
spacy_path: /home/dranion/.local/share/Anki2/addons21/spacyenv
It is hitting an exception at some point
spacy_path: /home/dranion/.local/share/Anki2/addons21/spacyenv
win is not true
Exception module not found
spacy_path = os.path.join(mw.pm.addonFolder(), "spacyenv")
print(f"spacy_path: {spacy_path}")
if is_win is True:
print("win is true")
spacy_bin_path = os.path.join(spacy_path, "Scripts")
spacy_site_packages_path = os.path.join(
spacy_path, "Lib", "site-packages"
)
else:
print("win is not true")
spacy_bin_path = os.path.join(spacy_path, "bin")
spacy_site_packages_path = os.path.join(
spacy_path, "lib", "python3.9", "site-packages"
)
sys.path.append(spacy_bin_path)
sys.path.append(spacy_site_packages_path)
updated_python_path = True
import spacy.util # pylint:disable=import-outside-toplevel
print(f"models: {spacy.util.get_installed_models()}")
print([f"{model_name}" for model_name in spacy.util.get_installed_models()])
return [f"{model_name}" for model_name in spacy.util.get_installed_models()]
except ModuleNotFoundError:
print("Exception module not found")
# spacy not installed
return []
I had the same issue and was able to fix it. I am using anki-bin 24.04.1-1
(with python 3.12) and had to change
to use python3.12
instead of python3.9
. Maybe there's a way to fetch anki's running version of python and use that directly instead of hardcoding a version?
Edit: there is! using f'python{sys.version_info.major}.{sys.version_info.minor}'
should work
Yes, I just attempted that and it also fixed it for me. Seems like it is the hardcoding.
@Tartee My goodness, you're a hero! I'll patch it and push a hotfix asap, thanks!
Released in 2.2.5. Let me know if it didn't work or is bugged in any way :)
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.
Describe the bug
I installed spaCy morphimizers as per the instructions in the guide but they do not show up in Anki after restarting. Notable is that the Mecab morphimizer does.
Steps to reproduce the behavior
Restarting Anki and looked at morphimizers, but it is not shown.
Expected behavior
The spaCy morphimizers should be shown in ankimorphs upon restart.
Screenshots
My setup
Additional Info
spAcy info: