I get: $ pip install -e . ... ModuleNotFoundError: No module named 'distutils' with Python 3.12, despite: $ conda install setuptools ... All requested packages already installed. $ pip install setuptools Requirement already satisfied: setuptools in c:\users\...\appdata\local\miniconda3\envs\c312\ lib\site-packages (69.0.3) My pyproject.toml file is: [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] name = "zzz" authors = [ ... ] description = "zzz" readme = "README.md" version = "36" dependencies = [ "numpy", "pandas", ] [project.optional-dependencies] test = [ "coverage", ] speed = [ "python-rapidjson", ] [project.urls] Homepage = "..." [tool.setuptools.packages.find] exclude = ["tests"] [tool.pylint.'MESSAGES CONTROL'] max-bool-expr = 10 My setup with Miniconda 3: $ conda create --name c312 python=3.12 pandas matplotlib scipy scikit-learn ... ... $ conda activate c312 $ which pip /c/Users/.../AppData/Local/miniconda3/envs/c312/Scripts/pip $ pip --version pip 23.3.2 from C:\Users\...\AppData\Local\miniconda3\envs\c312\Lib\site-packages\pip (python 3.12) $ conda --version conda 23.11.0 $ which python /c/Users/.../AppData/Local/miniconda3/envs/c312/python $ python Python 3.12.1 | packaged by conda-forge | (main, Dec 23 2023, 07:53:56) [MSC v.1937 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import setuptools Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\ssteingold\AppData\Local\miniconda3\envs\c312\Lib\site-packages\setuptools\__init__ .py", line 8, in <module> import distutils.core ModuleNotFoundError: No module named 'distutils' >>> import distutils Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'distutils' >>> $ conda list '^(python|setuptools)$' # packages in environment at C:\Users\...\AppData\Local\miniconda3\envs\c312: # # Name Version Build Channel python 3.12.1 h2628c8c_1_cpython conda-forge setuptools 69.0.3 pyhd8ed1ab_0 conda-forge What am I doing wrong? The following questions: Why did I get an error ModuleNotFoundError: No module named 'distutils'? ModuleNotFoundError: No module named 'distutils' in Python 3.12 basically say "install setuptools", but I already have it (and shouldn't it be auto-installed because I require it in pyproject?) Unable to import a module that is definitely installed has nothing to do with mine. Continue reading...