# No module named 'torch'？

**URL:** <https://discuss.huggingface.co/t/no-module-named-torch/162651>\
**Category:** Beginners\
**Created:** [July 11, 2025, 2:16pm UTC](https://discuss.huggingface.co/t/no-module-named-torch/162651 "2025-07-11T14:16:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gofor5](https://avatars.discourse-cdn.com/v4/letter/g/76d3ee/32.png) [@Gofor5](https://discuss.huggingface.co/u/Gofor5)\
**Post date:** [July 11, 2025, 2:16pm UTC](https://discuss.huggingface.co/t/no-module-named-torch/162651/1 "2025-07-11T14:16:52Z")

</div>

When deploying my deep learning codefile into huggingface, I met this error:

```auto
Traceback (most recent call last):
  File "/home/user/app/app.py", line 4, in <module>
    import torch
ModuleNotFoundError: No module named 'torch'
Traceback (most recent call last):
  File "/home/user/app/app.py", line 4, in <module>
    import torch
ModuleNotFoundError: No module named 'torch'

```

That’s very strange.How could I do?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [July 11, 2025, 2:25pm UTC](https://discuss.huggingface.co/t/no-module-named-torch/162651/2 "2025-07-11T14:25:21Z")

</div>

Try [this](https://huggingface.co/spaces/Gofor5/2048_Based_on_PyTorch/discussions/1). You just need `requirements.txt`.

> **[Handling Spaces Dependencies](https://huggingface.co/docs/hub/spaces-dependencies)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.
