Distutils is deprecated

distutils has not been included in the Python distribution since version 3.10. However, setup.py still requires distutils to install version 6.0.1. I’m not a Python installation geek, so it’s difficult for me to work around the problem with distutils. I considered installing in a virtual environment. But this type of installation seems like a cop-out to me. Why not make the Gramps installation method PEP 517/518 compliant?

In the meantime, I’ll stick with version 6.0.0 as provided by Kubuntu.

Can you provide more information what errors did you see, guessing regression related to PR 2027?

Work in progress by the way: 0012369: Migrate from distutils to setuptools until Gramps drops support for older Pythons

Gramps 6.0.x support Python 3.9+ only 6.1.x will support Python 3.10+ only.

1 Like
ven avr 18 20:21 $ python3 setup.py build
/usr/lib/python3/dist-packages/_distutils_hack/__init__.py:54: UserWarning: Reliance on distutils from stdlib is deprecated. Users must rely on setuptools to provide the distutils module. Avoid importing distutils or import setuptools first, and avoid setting SETUPTOOLS_USE_DISTUTILS=stdlib. Register concerns at https://github.com/pypa/setuptools/issues/new?template=distutils-deprecation.yml
  warnings.warn(
Traceback (most recent call last):
  File "/home/pierre/opt/Gramps/gramps-6.0.1/setup.py", line 35, in <module>
    from setuptools import setup, Command
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 24, in <module>
    from . import logging, monkey
  File "/usr/lib/python3/dist-packages/setuptools/logging.py", line 5, in <module>
    from . import monkey
  File "/usr/lib/python3/dist-packages/setuptools/monkey.py", line 13, in <module>
    import distutils.filelist
ModuleNotFoundError: No module named 'distutils'

I understand that everything is in everything! Once the switch to pip installation is complete, Gramps will be able to “upgrade” to Python 3.10+ and this should happen with version 6.1. But until then, installing via a local build no longer works on Kubuntu 24.10 which uses Python 3.12.7

See pull request #2053 which converts the build to a pyproject.toml based solution using the Hatchling backend.

It removes the need for distutils/setuptools completely.

1 Like

Pip works for installing Gramps 6.0.1 instead of distutils. The flatpak manifest has had to use a pip command for flathub to compile Gramps instead of distutils for a while now because of distutils being dropped from Gnome runtimes several versions ago. I installed Gramps from source on a Fedora 42 VM with pip yesterday while troubleshooting the flatpak, and it worked fine that way. After installing prerequisites like python3-orjson and others, try the commands below from the directory containing setup.py
sudo dnf install python3-pip (edit-I just remembered you were using Kubuntu. Use apt instead of dnf, and check the package name with apt-cache search pip3 IIRC)

pip3 install . <---- (don’t forget the dot at the end of the command)

(Actually I did the bad thing of using sudo pip3 install . because it was a virtual machine for testing and I was frustrated by that time. Sudo pip like I used yesterday is not recommended if you want to keep a system stable.)

1 Like

Three days ago (maybe!), the Kubuntu application manager (“Discover”) notified me that version 6.0.1 was available on FlatPack. I was therefore able to update Gramps without having to compile from source.

Thank you for your support.

Pierre

1 Like