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

ModuleNotFoundError: No module named 'distutils' #84

Closed
ricpelo opened this issue Oct 3, 2024 · 7 comments · Fixed by #85
Closed

ModuleNotFoundError: No module named 'distutils' #84

ricpelo opened this issue Oct 3, 2024 · 7 comments · Fixed by #85
Assignees

Comments

@ricpelo
Copy link

ricpelo commented Oct 3, 2024

Installing amc2moodle using pipx on Debian GNU/Linux "trixie" I get the following error:

$ pipx install amc2moodle
  installed package amc2moodle 2.10.3, installed using Python 3.12.6
  These apps are now globally available
    - amc2moodle
    - moodle2amc
done! ✨ 🌟 ✨
$ amc2moodle
Traceback (most recent call last):
  File "/home/ricardo/.local/bin/amc2moodle", line 23, in <module>
    from amc2moodle.amc2moodle import amc2moodle_class as a2m
  File "/home/ricardo/.local/pipx/venvs/amc2moodle/lib/python3.12/site-packages/amc2moodle/amc2moodle/amc2moodle_class.py", line 30, in <module>
    from distutils.dir_util import copy_tree
ModuleNotFoundError: No module named 'distutils'
@luclaurent
Copy link
Collaborator

Same behaviour on macos. Probably due to depreciation of distutils

@nennigb
Copy link
Owner

nennigb commented Oct 3, 2024

What is your version of python ?

@luclaurent
Copy link
Collaborator

Two solutions could be considered:

  • add setuptools as requirement: it includes distutils
  • remove the use to distutils and replace it by shutil as we only need to use copytree: this change leads to remove python 3.7 compatibility

@luclaurent
Copy link
Collaborator

luclaurent commented Oct 3, 2024

@nennigb see branch for the second solution of my previous post

@nennigb
Copy link
Owner

nennigb commented Oct 3, 2024

Python 3.7 is now unsupported (EOL june 2023), so it is not a big deal. The oldest still supported version is now 3.8.
I will have a look on your branch.
I didn't succeed to reproduce the original problem with pip, neither on my linux machine, neither on the CI.

@luclaurent
Copy link
Collaborator

With pip no issue probably due to the fact that setuptools is installed when you create a new environment.
With pipx (pip install pipx) it does not work.

@nennigb
Copy link
Owner

nennigb commented Oct 5, 2024

OK, probably, I will check. In my python 3.12 install I can still import disutils, and I have setuptools installed...

Your modifications looks fine (see the comment in the code)
You can create a PR with a clean rebase on the master ;-)
In the CIs you can remove python 3.7

@luclaurent luclaurent linked a pull request Oct 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants