# PyTorch with python3.13t

**URL:** https://dev-discuss.pytorch.org/t/pytorch-with-python3-13t/2922
**Category:** release/packaging
**Created:** [April 17, 2025, 5:55pm UTC](https://dev-discuss.pytorch.org/t/pytorch-with-python3-13t/2922 "2025-04-17T17:55:48Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![BossBoss2021](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@BossBoss2021](https://dev-discuss.pytorch.org/u/BossBoss2021)
#### Post date: [April 17, 2025, 5:55pm UTC](https://dev-discuss.pytorch.org/t/pytorch-with-python3-13t/2922/1 "2025-04-17T17:55:48Z")

</div>

Conversation started at: [Not working with python3.13t · Issue #151584 · pytorch/pytorch · GitHub](https://github.com/pytorch/pytorch/issues/151584), continuing it here.  
I tried compiling PyTorch for the CPU with the config shown in the attached image, yet I’m still getting this error:

```bash
PS D:\Python\StockEmulateAI> python3.13t -c "import torch"                             
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import torch
  File "C:\Users\Bogdan\AppData\Local\Programs\Python\Python313\Lib\site-packages\torch\ __init__.py", line 1003, in <module>
    raise ImportError(
    ...<14 lines>...
    ) from None
ImportError: Failed to load PyTorch C extensions:
    It appears that PyTorch has loaded the `torch/_C` folder
    of the PyTorch repository rather than the C extensions which
    are expected in the `torch._C` namespace. This can occur when
    using the `install` workflow. e.g.
        $ python setup.py install && python -c "import torch"

    This error can generally be solved using the `develop` workflow
        $ python setup.py develop && python -c "import torch" # This should succeed   
    or by running Python from a different directory.

```

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pytorch1/original/2X/6/6a9512dd10e34a1c7635d794838c6471fc61af3b.png)

---

<div class="post-metadata">

### Author: ![albanD](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/alband/32/9_2.png) [@albanD](https://dev-discuss.pytorch.org/u/albanD)
#### Post date: [April 17, 2025, 6:55pm UTC](https://dev-discuss.pytorch.org/t/pytorch-with-python3-13t/2922/2 "2025-04-17T18:55:33Z")

</div>

Hey!

As the error suggests, did you try changing folder? The error often happens when Python confuses a local folder for the actual install (due to how python prioritizes local files).

---

<div class="post-metadata">

### Author: ![BossBoss2021](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@BossBoss2021](https://dev-discuss.pytorch.org/u/BossBoss2021)
#### Post date: [April 17, 2025, 6:56pm UTC](https://dev-discuss.pytorch.org/t/pytorch-with-python3-13t/2922/3 "2025-04-17T18:56:56Z")

</div>

There’s no `torch.py` script in my directory, but I tried what you suggested either way! …It didn’t work. I should mention that the error only occurs when using `python3.13t` (no GIL).

---

<div class="post-metadata">

### Author: ![albanD](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/alband/32/9_2.png) [@albanD](https://dev-discuss.pytorch.org/u/albanD)
#### Post date: [April 21, 2025, 3:48pm UTC](https://dev-discuss.pytorch.org/t/pytorch-with-python3-13t/2922/4 "2025-04-21T15:48:18Z")

</div>

Just tried from scratch and it works fine on linux. This might be a windows issue then.  
Could you open an issue on github please?

---

<div class="post-metadata">

### Author: ![BossBoss2021](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@BossBoss2021](https://dev-discuss.pytorch.org/u/BossBoss2021)
#### Post date: [May 17, 2025, 12:17pm UTC](https://dev-discuss.pytorch.org/t/pytorch-with-python3-13t/2922/5 "2025-05-17T12:17:32Z")

</div>

There’s already an issue on github linked in the description. ([Not working with python3.13t · Issue #151584 · pytorch/pytorch · GitHub](https://github.com/pytorch/pytorch/issues/151584))

---

<div class="post-metadata">

### Author: ![albanD](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/alband/32/9_2.png) [@albanD](https://dev-discuss.pytorch.org/u/albanD)
#### Post date: [May 20, 2025, 9:23pm UTC](https://dev-discuss.pytorch.org/t/pytorch-with-python3-13t/2922/6 "2025-05-20T21:23:21Z")

</div>

Ho you’re looking for PyTorch 2.6 in particular? 2.7 which is the latest version in the selector should work !
