Skip to content

How to reinstall a broken package? (--reinstall and similar have no effect) #14479

@turbotimon

Description

@turbotimon

Question

I'm stuck refreshing a broken package. What do I not understand?

How to reproduce:

  1. Create a working project (with pip as an example package)
$ uv init
$ uv add pip
# confirm is not broken
$ uv run -m pip --version
pip 25.1.1 from /home/uv_reinstall/.venv/lib/python3.12/site-packages/pip (python 3.12)
  1. Break the package
$ echo "i'm broken" >> /home/uv_reinstall/.venv/lib/python3.12/site-packages/pip/__main__.py
$ uv run -m pip --version
...
File "/home/uv_reinstall/.venv/lib/python3.12/site-packages/pip/__main__.py", line 25
    i'm broken
     ^
SyntaxError: unterminated string literal (detected at line 25)
  1. How do completely reinstall it? None of my attempts work, e.g.
$ uv run --reinstall-package pip --refresh-package pip -m pip --version
...
File "/home/uv_reinstall/.venv/lib/python3.12/site-packages/pip/__main__.py", line 25
    i'm broken
     ^
SyntaxError: unterminated string literal (detected at line 25)
$ uv pip uninstall pip
$ uv sync --reinstall
$ uv run -m pip --version
...
File "/home/uv_reinstall/.venv/lib/python3.12/site-packages/pip/__main__.py", line 25
    i'm broken
     ^
SyntaxError: unterminated string literal (detected at line 25)

It seems even the cache is broken ..

$ rm -r .venv/
$ uv sync
Creating virtual environment at: .venv
Resolved 2 packages in 0.68ms
Installed 1 package in 7ms
 + pip==25.1.1
$ uv run -m pip --version
...
File "/home/uv_reinstall/.venv/lib/python3.12/site-packages/pip/__main__.py", line 25
    i'm broken
     ^
SyntaxError: unterminated string literal (detected at line 25)

Platform

Linux 6.12.35 x86_64 GNU/Linux
(NixOS 25.05)

Version

uv 0.7.16 / uv 0.7.19

Metadata

Metadata

Assignees

Labels

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