Problem installing my uv tools...

[SOLVED, see end of post]

I try to use uv tool install . to install as cli commands a couple of scripts which live in a very legacy project, needing to run with python3.8, and it doesn't work and I can't find why T___T

my pyproject.toml looks like that, for the relevant bits:

``` [project] name = "foo" version = "x.x.x" description = "" readme = "README.md" requires-python = ">=3.8,<3.9"

dependencies = [...]

[build-system] requires = ["uv_build>=0.9.17,<0.10.0"] build-backend = "uv_build"

[project.scripts] item = "foo.item:main" set = "foo.set:main"

```

From the project directory, if I run:

```

uv run item uv run set ```

It works, they are launched and run.

Then if I install them as tools, the installation works:

```

uv tool install . Resolved 62 packages in 686ms Audited 62 packages in 1ms Installed 2 executables: item, set ```

But after that if I try to run them, it fails:

```

item Traceback (most recent call last): File "/home/marc/.local/bin/learning_item", line 4, in <module> [...] ModuleNotFoundError: No module named 'boto.vendored.six.moves' ```

I know boto is deprecated, that's one of the reason I stick to Python3.8. But I think this failure is caused by the fact that my script are run with a newer python and not the one defined in the project.

from the project:

$ uv run python --version Python 3.8.18

but if I get the shebang from ~/.local/bin/item and run it with --version, I get:

```

/home/corpsmoderne/.local/share/uv/tools/foo/bin/python3 --version Python 3.13.2 ```

Did I missed something here? Do I have to specify something in my pyproject to force python 3.8, or is it a bug in uv tool installation process?

Edit: it works when forcing the python version when installing:

```

uv tool install . --python 3.8 ```

5 comments · 86% upvoted · other discussions

comments

sakuhazumonai

I'm not convinced that the dependencies list is not a relevant part of your file when the error is ModuleNotFound...

But it could be this?

https://docs.astral.sh/uv/concepts/tools/#python-versions

"Each tool environment is linked to a specific Python version. This uses the same Python version discovery logic as other virtual environments created by uv, but will ignore non-global Python version requests like .python-version files and the requires-python value from a pyproject.toml."

corpsmoderne [OP]

Thanks, you pointed me in the right direction.

I managed to make the scripts work using this command for installation:

```

uv tool install . --python 3.8 ```

mr_frpdo

Yup that or a .python-versions file

gabriel_jav

I did some tests and the .python-version file didn't work. Are you sure ?

PhilShackleford

Cd <project path>
Uv venv --python 3.8
Source .venv/bin/activate
Uv add <package name>