It seems like you're encountering an issue with the distutils module not being found in your Python environment. This module is part of the standard Python library, which leads me to believe that there might be some issues with your Python installation or virtual environment.
Here's how you can address this problem:
Upgrade setuptools:
The distutils module has been deprecated in favor of setuptools, and sometimes, upgrading setuptools can help resolve this issue. You can do this by running the following command:
code
pip install --upgrade setuptools
Check your Python version:
Some Python versions, like Python 3.10, have dropped support for the distutils module. Make sure you're using a Python version that still supports it, or upgrade to the latest version of Python if possible.
Create a new virtual environment:
If the above steps don't work, it might be a good idea to create a new virtual environment and reinstall the necessary packages. To do this, follow these steps:
Delete the existing virtual environment directory (in your case, /Users/valentin/PycharmProjects/CoMoSpeech-main/venv).
Create a new virtual environment using the following command (adjust the Python version if necessary):
Install the required packages using pip or your package manager of choice.
Consider using pyenv:
If you're still experiencing issues, consider using pyenv (https://github.com/pyenv/pyenv) to manage your Python installations. This tool can help you easily switch between different Python versions and create virtual environments.
After trying these steps, you should be able to resolve the distutils module not found error. If the issue persists, you may want to consider seeking help from the Python community, either through forums, issue trackers, or the official Python Discord server.
User
So I need to change my import :
from distutils.core import setup
from Cython.Build import cythonize
import numpy
Assistant
Yes, you'll published code still uses the distutils module for Cython compilation. Since distutils has been deprecated, you should migrate to the setuptools-based build system. Here's the updated version of the code using setuptools:
python
from setuptools import setup
from setuptools.extension import Extension
from Cython.Build import cythonize
import numpy
extensions = [
Extension(
"SVM_Wrapper",
sources=["SVM_Wrapper.pyx"],
include_dirs=[numpy.get_include()],
libraries=["m"], # You might want to review library names if you encounter issues
extra_compile_args=["-O3"],
)
]
setup(
name="SVM_Wrapper",
ext_modules=cythonize(extensions),
include_dirs=[numpy.get_include()],
)
Make sure you've upgraded setuptools and followed the other steps mentioned in my previous response to ensure that this works properly.