i have this structure using the uv package manager but when i run uv run evaluate, I get…
- User
i have this structure using the uv package manager but when i run uv run evaluate, I get ModuleNotFoundError: No module named 'my_module'. What's the issue?
[build-system] requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta"
[project] name = "XXX" version = "0.1.0" description = "YYY" readme = "README.md" requires-python = ">=3.12" dependencies = [ "matplotlib>=3.10.1", "pywin32 >= 301 ; sys_platform == 'win32'", "pyyaml>=6.0.2", "pandas>=2.2.3", "tensorboard>=2.19.0", "lightning==2.4", "numpy>2", "hydra-core>=1.3.2", "scipy>=1.15.2", ]
[project.optional-dependencies] cpu = ["torch>=2.6.0"] gpu = ["torch>=2.6.0"]
[project.scripts] evaluate = "my_module.evaluate:main"
[dependency-groups] dev = ["black>=25.1.0"]
[tool.setuptools.packages.find] where = ["my_module"]
[tool.uv] conflicts = [[{ extra = "cpu" }, { extra = "gpu" }]]
[tool.uv.sources] torch = [ { index = "pytorch-cpu", extra = "cpu" }, { index = "pytorch-cu128", extra = "gpu" }, ]
[[tool.uv.index]] name = "pytorch-cpu" url = "https://download.pytorch.org/whl/cpu" explicit = true
[[tool.uv.index]] name = "pytorch-cu128" url = "https://download.pytorch.org/whl/cu128" explicit = true
- Assistant
The issue is with your
setuptoolspackage discovery configuration. You have:[tool.setuptools.packages.find] where = ["my_module"]This tells setuptools to look inside a directory called
my_modulefor packages, but based on your script entry pointmy_module.evaluate:main, it appears thatmy_moduleitself is the package you want to include.Here are two ways to fix this:
Option 1: Fix the package discovery (recommended) Change your configuration to:
[tool.setuptools.packages.find] where = ["."] include = ["my_module*"]This tells setuptools to look in the current directory and include the
my_modulepackage.Option 2: Use explicit package listing Replace the
[tool.setuptools.packages.find]section with:[tool.setuptools] packages = ["my_module"]Make sure your directory structure looks like this:
your-project/ ├── pyproject.toml ├── my_module/ │ ├── __init__.py │ └── evaluate.py └── README.mdAfter making this change, you may need to reinstall the package in development mode:
uv pip install -e .Then
uv run evaluateshould work correctly.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.