Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ModuleNotFoundError: No module named 'distutils' #2723

Merged
merged 1 commit into from
Oct 11, 2023
Merged

Fix ModuleNotFoundError: No module named 'distutils' #2723

merged 1 commit into from
Oct 11, 2023

Conversation

virinci
Copy link
Contributor

@virinci virinci commented Oct 11, 2023

distutils was deprecated in Python 3.10 and it was removed in Python 3.12.

The module was used for finding the executable path of mpv using the distutils.spawn.find_executable function. This task can also be handled by shutil.which.

The error log on Anki version 2.1.15_6 (packaged by my distribution Void Linux) was:

$ anki
Traceback (most recent call last):
  File "/usr/bin/anki", line 6, in <module>
    import aqt
  File "/usr/share/anki/aqt/__init__.py", line 4, in <module>
    from anki import version as _version
  File "/usr/share/anki/anki/__init__.py", line 14, in <module>
    from anki.storage import Collection
  File "/usr/share/anki/anki/storage.py", line 13, in <module>
    from anki.collection import _Collection
  File "/usr/share/anki/anki/collection.py", line 26, in <module>
    from anki.sound import stripSounds
  File "/usr/share/anki/anki/sound.py", line 89, in <module>
    from anki.mpv import MPV, MPVBase
  File "/usr/share/anki/anki/mpv.py", line 39, in <module>
    from distutils.spawn import find_executable # pylint: disable=import-error,no-name-in-module
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'distutils'

@dae
Copy link
Member

dae commented Oct 11, 2023

Thank you!

@dae dae merged commit d261d1e into ankitects:main Oct 11, 2023
@virinci virinci deleted the distutils-fix branch October 11, 2023 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants