uv run --with ...
leaves _uv_ephemeral_overlay.pth
in ephemeral environment
#11117
Labels
bug
Something isn't working
cache
Caching of packages and metadata
great writeup
A wonderful example of a quality contribution 💜
Summary
Inside a project, running
uv run --with jupyter jupyter lab
correctly adds_uv_ephemeral_overlay.pth
to the ephemeral environment created forjupyter
. However, the_uv_ephemeral_overlay.pth
file is never cleaned up, so subsequent uses of that cached ephemeral environment will see it too. In most cases this doesn't matter because it will be overwritten, butuv tool run
(uvx
) will not overwrite it. In this example, runninguvx jupyter lab
elsewhere on the system matches the same cached environment and therefore incorrectly includes the original project virtual env insys.path
.Example
This happens with both
uvx
anduv tool run
, and appears to be becauseuv run --with x
anduv tool run x
match the same cached ephemeral environment, even thoughuv run
leaves behind the.pth
file.N.B. This problem is not caused by the PR that added
_uv_ephemeral_overlay.pth
- the previous implemention usingsitecustomize.py
had the same problem.I think the solution may be as simple as cleaning up
_uv_ephemeral_overlay.pth
before using the chosen environment foruv tool run
, but I'm unfamiliar with Rust in general and this codebase in particular, so would be hesitant to open a PR directly.Platform
macOS 14 arm64 and Windows 11 x86_64
Version
uv 0.5.25 (9c07c3f 2025-01-28)
Python version
Python 3.12.0
The text was updated successfully, but these errors were encountered: