Skip to content

Issue with Installing Torch-TensorRT via uv add Command with External Repository Links #7735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ChenMoFeiJin opened this issue Sep 27, 2024 · 6 comments · Fixed by #10276
Closed
Assignees
Labels
bug Something isn't working

Comments

@ChenMoFeiJin
Copy link


Platform: Ubuntu 20.04
Version: uv 0.4.16

Description:

When attempting to install Torch-TensorRT using the uv add command, I encountered an error. The command I ran was:

uv add torch-tensorrt

The following error was returned:

###########################################################################################
The package you are trying to install is only a placeholder project on PyPI.org repository.
To install Torch-TensorRT please run the following command:

$ pip install torch-tensorrt -f https://github.com/NVIDIA/Torch-TensorRT/releases
###########################################################################################

Installing the package manually with pip works perfectly fine:

pip install torch-tensorrt -f https://github.com/NVIDIA/Torch-TensorRT/releases

However, when trying to use uv add with the same link, the following error occurs:

$ uv add torch-tensorrt -f https://github.com/pytorch/TensorRT/releases --verbose
DEBUG uv 0.4.16
DEBUG Found project root: `/path/to/project`
DEBUG Found workspace root: `/path/to/project`
DEBUG Adding current workspace member: `/path/to/project`
DEBUG Reading requests from `/path/to/project/.python-version`
DEBUG The virtual environment's Python version satisfies `Python 3.12`
DEBUG Using request timeout of 30s
DEBUG No cache entry for: https://github.com/pytorch/TensorRT/releases
error: Failed to read `--find-links` URL: https://github.com/pytorch/TensorRT/releases
  Caused by: Received some unexpected HTML from https://github.com/pytorch/TensorRT/releases
  Caused by: Unexpected fragment (expected `#sha256=...` or similar) on URL: start-of-content

It seems that uv is unable to properly handle external --find-links URLs when installing from sources like GitHub, as it encounters an unexpected HTML response.

@konstin
Copy link
Member

konstin commented Sep 27, 2024

It seems that torch-tensorrt doesn't publish wheels for Python 3.12 (only up to 3.11), so we fall back to the 0.0.0.post1 dummy package. On the github releases page there's a Python 3.12 wheel then (https://github.com/pytorch/TensorRT/releases/download/v2.4.0/torch_tensorrt-2.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_34_x86_64.whl).

While I'm open to extending uv's find links parser to work more like pip, i'm hesitant to specifically support github releases: The page at https://github.com/pytorch/TensorRT/releases only has a few recent releases, which means that uv lock could break in the future when the released you had lock is moved to the second releases page. Ideally, the would be a single flat html page with all torch-tensorrt github releases that we could use.

@ChenMoFeiJin
Copy link
Author

Thank you for your feedback. You raise a good point about the limitations of GitHub releases. Indeed, since uv.lock records the exact .whl or .tar.gz download URL, we can rebuild the environment even if the release has moved beyond GitHub's first page. The file link stays active unless removed by GitHub. (I admit I may not fully grasp the workings of uv.lock.)

Hence, it would be wise to consider a more robust approach to managing GitHub releases. This could prove particularly useful for those dependent on specific versions not available on PyPI or other simple HTML pages. Although there's a slight risk of file removal, it's unlikely for widely used libraries such as Torch-TensorRT.

I understand if you find additional processing unnecessary. Thank you for explaining that Torch-TensorRT does not have a build for version 3.12 on PyPI, and it's not just a general placeholder. With this in mind, I'm thinking of downgrading to version 3.11 as a temporary workaround. If you think this issue warrants further discussion, please feel free to leave it open. Otherwise, we can consider it resolved.

@matteo-bruni
Copy link

torch-tensorrt is available on index https://download.pytorch.org/whl/cu124 so you can install it using --extra-index-url
(you can also use https://download.pytorch.org/whl/cu118/ or https://download.pytorch.org/whl/cu121 for other cuda version)

you also need to use --index-strategy unsafe-best-match because it needs packaging>23 and in the pytorch index only packaging==22.0 is available (why they release 3rd party wheels?? same problem with pillow which is not up to date with upstream)

@goldyfruit
Copy link

Kind of having the same issue with https://whl.smartgic.io/.

uv pip install -f https://whl.smartgic.io/ ggwave
Using Python 3.11.11 environment at: /home/goldyfruit/Virtualenvs/hivemind
error: Failed to read `--find-links` URL: https://whl.smartgic.io/
  Caused by: Received some unexpected HTML from https://whl.smartgic.io/
  Caused by: Missing href attribute on anchor link: `/`

Not sure how to fix this.

@moreati
Copy link
Contributor

moreati commented Jan 2, 2025

In the source of https://whl.smartgic.io/, it appears the anchor that uv is complaining about does have an href, but the value is empty string.

<body onload="initPage()">
	<header>
		<div class="wrapper">
			<div class="breadcrumbs">Folder Path</div>
				<h1>
					<a href="">/</a>
				</h1>

If I'm reading the source of Python pip correctly, then it ignores empty or missing href attributes - skipping over them

So if it was desired uv pip could be made more pip like by ignoring missing or empty <a href>, rather than treating it as an error.

@charliermarsh
Copy link
Member

Ok thanks. I can fix it.

@charliermarsh charliermarsh self-assigned this Jan 2, 2025
@charliermarsh charliermarsh added the bug Something isn't working label Jan 2, 2025
charliermarsh added a commit that referenced this issue Jan 2, 2025
## Summary

Closes #7735.

## Test Plan

`cargo run pip install -f https://whl.smartgic.io/ ggwave
--python-platform linux` (fails prior to this PR; passes after)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants