Fixed: You tried to install "pytorch". The package named for PyTorch is "torch"
I asked uv for PyTorch by its name, uv add pytorch, and got a long build failure that ended in Exception: You tried to install "pytorch". The package named for PyTorch is "torch". The message is the whole answer: PyTorch's package is called torch. uv add torch installed it.
What I Was Doing
I made a new project with uv 0.13.10 on Python 3.15.2 and added PyTorch to it, using the project's name:
uv init --python 3.15 tensor-app
cd tensor-app
uv add pytorch
What I Expected
uv downloading PyTorch and adding it to the project, as uv add does for any package.
What I Got
A build error. This is the complete output:
Using CPython 3.15.2 interpreter at: /Library/Frameworks/Python.framework/Versions/3.15/bin/python3.15
Creating virtual environment at: .venv
Resolved 2 packages in 24ms
Built tensor-app @ file:///Users/you/source/tensor-app
error: Failed to add dependencies
cause: Failed to build `pytorch==1.0.2`
cause: The build backend returned an error
cause: Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)
[stderr]
Traceback (most recent call last):
File "<string>", line 11, in <module>
wheel_filename = backend.build_wheel(__import__("os").fsdecode(b"/Users/you/.cache/uv/builds-v0/.tmpnfAz9m"), {}, None)
File "/Users/you/.cache/uv/builds-v0/.tmpXS5qWh/lib/python3.15/site-packages/setuptools/build_meta.py", line 438, in build_wheel
return _build(['bdist_wheel'])
File "/Users/you/.cache/uv/builds-v0/.tmpXS5qWh/lib/python3.15/site-packages/setuptools/build_meta.py", line 429, in _build
return self._build_with_temp_dir(
~~~~~~~~~~~~~~~~~~~~~~~~~^
cmd,
^^^^
...<3 lines>...
self._arbitrary_args(config_settings),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/you/.cache/uv/builds-v0/.tmpXS5qWh/lib/python3.15/site-packages/setuptools/build_meta.py", line 410, in _build_with_temp_dir
self.run_setup()
~~~~~~~~~~~~~~^^
File "/Users/you/.cache/uv/builds-v0/.tmpXS5qWh/lib/python3.15/site-packages/setuptools/build_meta.py", line 520, in run_setup
super().run_setup(setup_script=setup_script)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/you/.cache/uv/builds-v0/.tmpXS5qWh/lib/python3.15/site-packages/setuptools/build_meta.py", line 317, in run_setup
exec(code, locals()) # noqa: S102 # exec is intentional here
~~~~^^^^^^^^^^^^^^^^
File "<string>", line 15, in <module>
Exception: You tried to install "pytorch". The package named for PyTorch is "torch"
hint: `pytorch` (v1.0.2) was included because `tensor-app` (v0.1.0) depends on `pytorch`
hint: Build failures usually indicate a problem with the package or the build environment
hint: If you want to add the package regardless of the failed resolution, provide the `--frozen` flag to skip locking and syncing

uv found a package called pytorch, version 1.0.2, and tried to build it. Its build script stopped on purpose with the message near the end.
What I Checked
First, whether the failed command had changed the project:
uv tree --depth 1
Resolved 1 package in 12ms
tensor-app v0.1.0

uv tree lists the project's packages; there were none, so uv had added nothing. Then the package itself: PyPI's pytorch project holds one file, the source archive pytorch-1.0.2.tar.gz from April 2019, and no description. It isn't PyTorch. PyTorch's install page installs it as pip3 install torch torchvision: the package's name is torch.
Why It Happens
The project is called PyTorch, but its package on PyPI is named torch, the same name you import. The pytorch name on PyPI holds a placeholder whose only job is to stop the install and say which name to use. uv has to build it from source, so the message arrives inside a build error.
The Fix
Add the package by its real name:
uv add torch
+ setuptools==84.2.1
+ sympy==1.14.0
+ tensor-app==0.1.0 (from file:///Users/you/source/tensor-app)
+ torch==2.15.0
+ typing-extensions==4.16.0

After the Fix
uv tree --depth 1
Resolved 28 packages in 5ms
tensor-app v0.1.0
└── torch v2.15.0

The project now depends on torch v2.15.0. The commands work unchanged in PowerShell. pip hits the same placeholder: in a plain virtual environment, pip install pytorch stopped with the same Exception, so use pip install torch there too.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
uv add pytorch or pip install pytorch | The build fails with this message | uv add torch |
import pytorch in code | ModuleNotFoundError: No module named 'pytorch'. Did you mean: 'torch'? | import torch |
Adding --frozen, as the last hint suggests | uv writes pytorch into pyproject.toml without installing it, and the next sync fails the same way | Use the right name instead |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Failed to build `pytorch==1.0.2` ending in The package named for PyTorch is "torch" | The package name pytorch | uv add torch |
uv add torch installs a build without GPU support on Windows | PyPI's Windows build has no CUDA | How to Install PyTorch with CUDA Using uv |
FAQ
Is the pytorch package harmful?
The version uv tried only stopped with this message. Still, it's not PyTorch, so leave it out of your projects.
What about torchvision?
Its package name is the same as the project's: uv add torchvision.
Conclusion
uv add pytorch failed because PyTorch's package on PyPI is named torch; the pytorch name is a placeholder that stops with You tried to install "pytorch". The package named for PyTorch is "torch". uv add torch installed PyTorch 2.15.0.
Additional Resources
- How to Install PyTorch with uv — the install, what each system gets, and the first check.
- torch on PyPI — PyTorch's real package.
- PyTorch: Get Started — PyTorch's install selector.
