Skip to content

ModuleNotFoundError: No module named 'distutils' #6509

@kdheepak

Description

@kdheepak

When I run uv add numpy (after adding some other dependencies successfully), I get an "No module named 'distutils'" error. I've just installed uv and ran uv install python 3.12 and tried to create a new project with it.

I'm using the following platform:

Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 12 × Apple M3 Pro
  WORD_SIZE: 64

Here's my uv --version:

$ uv --version
uv 0.3.2 (c5440001c 2024-08-23)

Here's the error I'm getting:

Traceback (most recent call last):
  File "<string>", line 8, in <module>
  File "/Users/USERNAME/.cache/uv/builds-v0/.tmpvWutaJ/lib/python3.12/site-packages/setuptools/__init__.py", line 10, in <module>
    import distutils.core
ModuleNotFoundError: No module named 'distutils'

Here's the detailed log output with uv add numpy --verbose:

https://gist.github.com/kdheepak/88fd62563e7457c0d9d17180ad907c42

Weirdly, numpy gets added to pyproject.toml:

[project]
name = "test-uv-prototype"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
    "jupyter>=1.0.0",
    "geopandas>=1.0.1",
    "hplot",
    "hvplot>=0.10.0",
    "numpy>=1.25.0",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

Metadata

Metadata

Assignees

No one assigned

    Labels

    great writeupA wonderful example of a quality contribution 💜questionAsking for clarification or support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions