Installation problem

DanW58: <p>I could not find a category for installation problems.<br>
I was following the instructions in the “Start Locally” page, which repeatedly made reference to something never introduced, namely “in the selector above, select X Y or Z”, where the selector above was never mentioned.  I managed to install Anaconda, but only to find out later that it does not support AMD ROCM acceleration.  My (brand new) machine is pure AMD, with Ryzen 5 7600 and a Radeon card I haven’t installed yet;  using the integrated GPU for now.  And I’m on Ubuntu 24.04 with MATE window manager.</p>
<p>Anyways, I proceeded to install pip3, with a lot of trepidation since I don’t have the foggiest idea what pip is, first of all.  But I got it installed.</p>
<p>Now the problem is that it doesn’t work.  See what happens:</p>
<pre><code>$ pip3 install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/rocm5.7
error: externally-managed-environment

× This environment is externally managed
╰─&gt; To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python
installation or OS distribution provider. You can override this, at
the risk of breaking your Python installation or OS, by
passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
</code></pre>
<p>To me that sounds like Greek with Chinese characteristics… “externally managed” … external to what?  I haven’t the foggiest idea what any of that means.  I noticed elsewhere you have binaries to download, but they also have to be installed using pip, so they wouldn’t help me much, I guess…  So, I’m stuck.</p>
<p>Just know that I’m a newbie at everything: neural networks, Python, and Linux, even though I’ve been using Linux for many years now, I really know nothing much about it.  I need PyTorch for a Coursera course on Deep Learning that I’m taking.</p>
<p>Thanks in advance.</p>

ptrblck: <p>You could check out <a href="https://colab.google/">Google Colab</a> while trying to create a valid setup on your workstation.<br>
Colab provides notebooks with PyTorch pre-installed and allows you to use NVIDIA GPUs as well as TPUs.</p>
<p>For your local issue: search what Python virtual environments are, how to create and manage them, and use them to continue with your installation.</p>

DanW58: <p>I have never programmed in Python before;  I’m an old C, C++ and Assembly programmer. I appreciate you are trying to help me, but it does not help right now.  For my course in deep learning I need to get PyTorch running for me now, not after months of studying python and virtual environments. Otherwise, my other option is to do the labs without PyTorch.  I’m also retired, with my rent being half my income, so getting a google colab laptop is out of the question.  I just put together this new rig, and I had to increase my debts by $2000 to do it.  I just need detailed instructions how to install this.</p>

ptrblck: <aside class="quote no-group" data-username="DanW58" data-post="3" data-topic="202396">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/danw58/48/69878_2.png" class="avatar"> DanW58:</div>
<blockquote>
<p>For my course in deep learning I need to get PyTorch running for me now, not after months of studying python and virtual environments.</p>
</blockquote>
</aside>
<p>That’s why I recommended Google Colab to get started without any setup issues while you can decide how much you want to invest learning about Python and its setup itself for your local setup.</p>
<aside class="quote no-group" data-username="DanW58" data-post="3" data-topic="202396">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/danw58/48/69878_2.png" class="avatar"> DanW58:</div>
<blockquote>
<p>I’m also retired, with my rent being half my income, so getting a google colab laptop is out of the question.</p>
</blockquote>
</aside>
<p>Google Colab is not a laptop, but a Python notebook environment allowing you to use (some) GPUs for free. Just click on the link, open a new notebook, select the GPU runtime, and use PyTorch on this device.</p>

DanW58: <p>Ah, I understand now;  I’ll try that, thanks.</p>

MyCenturaHealth: <aside class="quote no-group" data-username="DanW58" data-post="1" data-topic="202396" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/danw58/48/69878_2.png" class="avatar"> DanW58:</div>
<blockquote>
<p>I could not find a category for installation problems.<br>
I was following the instructions in the “Start Locally” page, which repeatedly made reference to something never introduced, namely “in the selector above, select X Y or Z”, where the selector above was never mentioned. I managed to install Anaconda, but only to find out later that it does not support AMD ROCM acceleration. My (brand new) machine is pure AMD, with Ryzen 5 7600 and a Radeon card I haven’t installed yet; using the integrated GPU for now. And I’m on Ubuntu 24.04 with MATE window manager.</p>
<p>Anyways, I proceeded to install pip3, with a lot of trepidation since I don’t have the foggiest idea what pip is, first of all. But I got it installed.</p>
<p>Now the problem is that it doesn’t work. See what happens:</p>
<pre><code class="lang-auto">$ pip3 install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/rocm5.7
error: externally-managed-environment

× This environment is externally managed
╰─&gt; To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python
installation or OS distribution provider. You can override this, at
the risk of breaking your Python installation or OS, by
passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
</code></pre>
<p>To me that sounds like Greek with Chinese characteristics… “externally managed” … external to what? I haven’t the foggiest idea what any of that means. I noticed elsewhere you have binaries to download, but they also have to be installed using pip, so they wouldn’t help me much, I guess… So, I’m stuck.</p>
<p>Just know that I’m a newbie at everything: neural networks, Python, and Linux, even though I’ve been using Linux for many years now, I really know nothing much about it. I need PyTorch for a Coursera course on Deep Learning that I’m taking.</p>
<p>Thanks in advance.</p>
</blockquote>
</aside>
<p>Create a virtual environment using <code>python3 -m venv venv_name</code>, then activate it with <code>source venv_name/bin/activate</code>, and install PyTorch within this environment.</p>

bsassoli: <p>A little late: I thought this thread on SO might be relevant <a href="https://stackoverflow.com/questions/75608323/how-do-i-solve-error-externally-managed-environment-every-time-i-use-pip-3" class="inline-onebox" rel="noopener nofollow ugc">python - How do I solve "error: externally-managed-environment" every time I use pip 3? - Stack Overflow</a></p>