Installing Pytorch

frankvanpaassen: <p>So i’m really new to Pytorch, and I’ve been having issues with installing pytorch nonstop. It keeps telling me that it couldn’t find a version that satisified the requirement torch, if anyone has any idea to fix, feel free to dm me on discord Joycebartfrank#3470</p>

AbdulsalamBande: <p><a class="mention" href="/u/frankvanpaassen">@frankvanpaassen</a> Maybe you are trying to installing a Pytorch version that doesn’t exist for example 1.55.4.1. You can check <a href="https://pytorch.org/get-started/previous-versions/" class="inline-onebox" rel="noopener nofollow ugc">Previous PyTorch Versions | PyTorch</a> for list of all pytorch versions and respective torchtext and torchvision libaries.</p>

frankvanpaassen: <p>When I type pip install pytorch, i dont specific a version, so I can’t imagine that the version would be the issue…</p>

ptrblck: <aside class="quote no-group" data-username="frankvanpaassen" data-post="3" data-topic="144240">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/f/bc8723/48.png" class="avatar"> frankvanpaassen:</div>
<blockquote>
<p>When I type pip install pytorch</p>
</blockquote>
</aside>
<p><code>pip install pytorch</code> is wrong, so copy/paste the commands from the install instructions e.g.:</p>
<pre data-code-wrap="python"><code class="lang-python">pip3 install torch torchvision torchaudio
# or 
pip3 install torch==1.10.2+cu113 torchvision==0.11.3+cu113 torchaudio==0.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
</code></pre>

frankvanpaassen: <p>See i did that, then it gives me errors again, first it gives me a warning saying that there is a missing-index-doctype, then it tells me there is a problematic url, and that it is unable to find a version that satisifies the requirement torch=1.10.2+cu113</p>

ptrblck: <p>Maybe you would need to update <code>pip</code> or are using an unsupported Python version?<br>
The cmd works for me:</p>
<pre><code class="lang-python">pip install torch==1.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
Looking in links: https://download.pytorch.org/whl/cu113/torch_stable.html
Collecting torch==1.10.2+cu113
  Downloading https://download.pytorch.org/whl/cu113/torch-1.10.2%2Bcu113-cp38-cp38-linux_x86_64.whl (1821.4 MB)
     ━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.4/1.8 GB 10.8 MB/s eta 0:02:13
</code></pre>

frankvanpaassen: <p>pip install torch==1.10.2+cu113 -f <a href="https://download.pytorch.org/whl/cu113/torch_stable.html" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu113/torch_stable.html</a><br>
Looking in links: <a href="http://download.pytorch.org/whl/cu113/torch_stable.html" rel="noopener nofollow ugc">download.pytorch.org/whl/cu113/torch_stable.html</a><br>
warning: missing-index-doctype</p>
<p>× The package index page being used does not have a proper HTML doctype declaration.<br>
╰─&gt; Problematic URL: (the pytorch one)</p>
<p>note: This is an issue with the page at the URL mentioned above.<br>
hint: You might need to reach out to the owner of that package index, to get this fixed. See github\pypa/pip/issues/10825 for context.<br>
ERROR: Could not find a version that satisfies the requirement torch==1.10.2+cu113 (from versions: none)<br>
ERROR: No matching distribution found for torch==1.10.2+cu113</p>
<p>This was the error I just got with that same command, my pip is updated, and I have the most recent version of Python, and ideas? Btw, I slightly changed the links in this comment due to restrictions from pytorch forums for me, however I assure you they were the same links as you gave me.</p>

ptrblck: <p>Were you able to check your Python version and verify that the pip wheels are actually built for it?</p>

frankvanpaassen: <p>how do I verify that?? If you can please give me steps that would be awesome!</p>

ptrblck: <p>Just run <code>python</code> in your terminal and check the Pyhton version:</p>
<pre><code class="lang-python">python
Python 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:59:51) 
[GCC 9.4.0] on linux
</code></pre>
<p>Alternatively, <code>python --version</code> would also work.<br>
Make sure you are using 3.6 to 3.9.</p>
<p>EDIT: small correction: even though the Python 3.6 wheels are built, I would recommend to update as Python 3.6’s EOL is reached as of Dec 2021.</p>

frankvanpaassen: <p>my python version is 3.10.2, do i have do downgrade?</p>

ptrblck: <p>Yes, you would have to downgrade to 3.9 or try to build from source (if 3.10 is fully supported by now).</p>

frankvanpaassen: <p>how would i go about downgrading? do i just install python 3.9 and that’s it? and then just add to path?<br>
edit: Thank you so much, after having downgraded python it worked, if only I knew before, but thank you so much man… real lifesaver.</p>

Soerendip: <p>In a Python 3.10 or 3.12 environment:</p>
<pre><code>pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu125
</code></pre>
<p>Looking in indexes: <a href="https://download.pytorch.org/whl/cu125" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu125</a></p>
<p>ERROR: Could not find a version that satisfies the requirement torch (from versions: none)</p>
<p>ERROR: No matching distribution found for torch</p>

ptrblck: <p>The URL is invalid and I don’t know where you’ve found it as it’s neither mentioned in our <a href="https://pytorch.org/get-started/previous-versions/">install docs</a> for previous versions nor in our current <a href="https://pytorch.org/get-started/locally/">install matrix</a>.</p>