Repository: PythonOT/POT (language: python)

Issue:
Deprecate distutils in favor of setuptools
## 🚀 Feature
<!-- A clear and concise description of the feature proposal -->

In [CPython 3.10 distutils was formally marked as deprecated and it will be removed from CPython in 3.12](https://peps.python.org/pep-0632/). To avoid complications, deprecate use of distutils moving forward in favor of using setuptools as recommended.

For Python 3.7+ (which should by default have `pip` `v22.0.0+` and `setuptools` `v57.5.0+`) use:
* `setuptools._distutils` over `distutils`

Additional supporting advice given in:
* https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html
* https://peps.python.org/pep-0632/#migration-advice

Relevant for (nicely only!)

https://github.com/PythonOT/POT/blob/1f7d5476c48e04de32b6ec2a4ac94a72ba0ac2de/ot/helpers/openmp_helpers.py#L12

### Motivation
<!-- Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too -->

Use of 

https://github.com/PythonOT/POT/blob/1f7d5476c48e04de32b6ec2a4ac94a72ba0ac2de/ot/helpers/openmp_helpers.py#L12

fails in Python 3.12 given `distutils` is gone.

### Pitch
<!-- A clear and concise description of what you want to happen. -->

Remove all use of `distutils`.

### Alternatives
<!-- A clear and concise description of any alternative solutions or features you've considered, if any. -->

### Additional context
<!-- Add any other context or screenshots about the feature request here. -->



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml
index c60babff6..ca3824975 100644
--- a/.github/workflows/build_wheels.yml
+++ b/.github/workflows/build_wheels.yml
@@ -26,7 +26,7 @@ jobs:
 
     - name: Install dependencies
       run: |
-        python -m pip install --upgrade pip
+        python -m pip install --upgrade pip setuptools
 
     - name: Install cibuildwheel
       run: |
@@ -61,7 +61,7 @@ jobs:
 
     - name: Install dependencies
       run: |
-        python -m pip install --upgrade pip
+        python -m pip install --upgrade pip setuptools
 
     - name: Install cibuildwheel
       run: |
diff --git a/.github/workflows/build_wheels_weekly.yml b/.github/workflows/build_wheels_weekly.yml
index 4746a3676..f528c2dce 100644
--- a/.github/workflows/build_wheels_weekly.yml
+++ b/.github/workflows/build_wheels_weekly.yml
@@ -25,7 +25,7 @@ jobs:
 
     - name: Install dependencies
       run: |
-        python -m pip install --upgrade pip
+        python -m pip install --upgrade pip setuptools
 
     - name: Install cibuildwheel
       run: |
diff --git a/ot/helpers/openmp_helpers.py b/ot/helpers/openmp_helpers.py
index a6ad38b06..90a2918da 100644
--- a/ot/helpers/openmp_helpers.py
+++ b/ot/helpers/openmp_helpers.py
@@ -9,7 +9,7 @@
 import textwrap
 import subprocess
 
-from distutils.errors import CompileError, LinkError
+from setuptools.errors import CompileError, LinkError
 
 from pre_build_helpers import compile_test_program
 


Test patch:
diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml
index b42dd2b0f..cd45633de 100644
--- a/.github/workflows/build_tests.yml
+++ b/.github/workflows/build_tests.yml
@@ -35,7 +35,7 @@ jobs:
         pip install -e .
     - name: Install dependencies
       run: |
-        python -m pip install --upgrade pip
+        python -m pip install --upgrade pip setuptools
         pip install -r requirements_all.txt
         pip install pytest pytest-cov
     - name: Run tests
@@ -55,7 +55,7 @@ jobs:
         python-version: "3.10"
     - name: Install dependencies
       run: |
-        python -m pip install --upgrade pip
+        python -m pip install --upgrade pip setuptools
         pip install flake8 
     - name: Lint with flake8
       run: |
@@ -76,7 +76,7 @@ jobs:
         python-version: "3.10"
     - name: Install dependencies
       run: |
-        python -m pip install --upgrade pip
+        python -m pip install --upgrade pip setuptools
         pip install pytest pytest-cov
     - name: Install POT
       run: |
@@ -107,7 +107,7 @@ jobs:
          pip install -e .
      - name: Install dependencies
        run: |
-         python -m pip install --upgrade pip
+         python -m pip install --upgrade pip setuptools
          pip install -r requirements_all.txt
          pip install pytest 
      - name: Run tests
diff --git a/.github/workflows/build_tests_cuda.yml b/.github/workflows/build_tests_cuda.yml
index be8e47c8b..2d4e452c5 100644
--- a/.github/workflows/build_tests_cuda.yml
+++ b/.github/workflows/build_tests_cuda.yml
@@ -15,7 +15,8 @@ jobs:
     - uses: actions/checkout@v4
     - name: Install POT
       run: |
-        python3.10 -m pip install  --ignore-installed -e .
+        python3.10 -m pip install --upgrade pip setuptools
+        python3.10 -m pip install --ignore-installed -e .
     - name: Run tests
       run: |
         python3.10 -m pytest --durations=20 -v test/ ot/ --doctest-modules --color=yes --ignore=test/test_dr.py --ignore=ot.dr --ignore=ot.plot