Skip to content

Unable to run codeanalyzer cli #2

@rahlk

Description

@rahlk

Describe the bug
Installing a package using uv pip install . works correctly and reports successful installation, but the installed CLI script ([project.scripts] entry point) fails at runtime with ModuleNotFoundError: No module named 'codeanalyzer'.

To Reproduce
Steps to reproduce the behavior:

  1. Use a pyproject.toml with [project.scripts] codeanalyzer = "codeanalyzer.__main__:app" and a valid codeanalyzer/ package in a flat layout (no src/).
  2. Install using uv pip install .
  3. Run codeanalyzer --help
  4. Observe the failure:
    Traceback (most recent call last):
      File "/home/<user>/.pyenv/versions/3.12.11/bin/codeanalyzer", line 5, in <module>
        from codeanalyzer.__main__ import app
    ModuleNotFoundError: No module named 'codeanalyzer'
    

Expected behavior
codeanalyzer CLI script should be installed into the same environment where the codeanalyzer package is installed, and should be able to resolve its import.

Logs

$ uv pip install .
...
Installed 1 package in 0.7ms
+ codeanalyzer-python==0.1.1

$ which codeanalyzer
/home/<user>/.pyenv/versions/3.12.11/bin/codeanalyzer

$ cat $(which codeanalyzer)
#!/usr/bin/env bash
exec "/home/<user>/.pyenv/libexec/pyenv" exec "$program" "$@"

Additional context

  • uv is being used in a system where pyenv is managing the global Python version.
  • uv installs into an isolated environment, but CLI scripts are being executed via the pyenv-managed global Python — leading to broken dispatch and missing modules.
  • This results in a mismatch between the environment where the package is installed and the environment from which the CLI script is run.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions