Installation problem

I could not find a category for installation problems.
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.

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.

Now the problem is that it doesn’t work. See what happens:

$ 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
╰─> 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.

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.

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.

Thanks in advance.

You could check out Google Colab while trying to create a valid setup on your workstation.
Colab provides notebooks with PyTorch pre-installed and allows you to use NVIDIA GPUs as well as TPUs.

For your local issue: search what Python virtual environments are, how to create and manage them, and use them to continue with your installation.

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.

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.

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.

Ah, I understand now; I’ll try that, thanks.

Create a virtual environment using python3 -m venv venv_name, then activate it with source venv_name/bin/activate, and install PyTorch within this environment.

2 Likes

A little late: I thought this thread on SO might be relevant python - How do I solve "error: externally-managed-environment" every time I use pip 3? - Stack Overflow