From 5ade2335c163cc14451dfa159b0396a65a8a9c31 Mon Sep 17 00:00:00 2001 From: Dianna Hoober Date: Thu, 11 Sep 2025 15:08:44 -0700 Subject: [PATCH 01/15] New version of installing PyTorch using pip --- .../pytorch-install-2-8-0-ubuntu/index.md | 201 ++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md diff --git a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md new file mode 100644 index 00000000000..2499d5a8e4c --- /dev/null +++ b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md @@ -0,0 +1,201 @@ +--- +slug: pytorch-install-22-04-ubuntu +title: Installation of Pytorch on Ubuntu 22.04 +description: This version updates to the current stable version using Pip as the installation tool and expands on how to use the services and features for CPU and GPU. +Authors: D Hoober +Contributors: D Hoober +published: 2021-11-05 +modified: 2025-9-11 +keywords: ['pytorch install','pytorch cpu','conda install pytorch','what is pytorch', 'uninstall pytorch'] +license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)' +external resources: +- '[PyTorch's official install guide](https://pytorch.org/get-started/locally/)' +- '[Markaicode's Complete Guide to Uninstally PyTorch](https://markaicode.com/how-to-uninstall-pytorch-complete-guide-for-all-systems/)' +- '[official PyTorch Tutorials and Knowledge Base](https://docs.pytorch.org/tutorials/)' +- '[PyTorch Get Started page](https://pytorch.org/get-started/locally/)' + +--- + +This guide shows examples for installing PyTorch, a Python framework, on an Ubuntu 22.04 compute instance and provides support for math-intensive applications that run on GPU and CPU. These instances are both available with Akamai Technologies. + +## What is PyTorch? + +This is an open-source machine learning framework that enables fast, flexible experimentation and production deployment. Whether you want to build neural networks or fine-tune pre-trained models, PyTorch offers intuitive APIs and dynamic computation graphs that make it ideal for research and real-world applications. + +## Before You Begin + +Our guide assumes you're working on a Linux-based compute instance with sudo access. You're going to install PyTorch in a Python environment--either system-wide or within a virtualenv (virtu +al environment is recommended). + +### Prerequisites + +To install and run PyTorch comfortably, your system should have: + +- **OS**: Ubuntu 22.04 or higher +- **Python**: 3.8 or higher +- **Pip**: Latest version recommended +- **Optional**: CUDA 11.8+ for GPU acceleration +- A working internet connection +- Clean Python environment (e.g., virtualenv or conda) +- At least **4 GB RAM** (8 GB+ preferred for training) +- No conflicting Python packages +- At least 3 - 5 GB of free disk space, depending on your python version, virtual environment setup, and additional packages. If working on a minimal or resource-constrained system, consider checking available disk space with: + + df -h + +## Installation Steps + +1. Update your system + +Once you have taken care of prerequisties, run: + + sudo apt update && sudo apt upgrade + +After running these commands, the system prompts you for confirmation [Y/n] before upgrading to ensure you are aware of resource usage and system changes before continuing. Choose "n" to stop and remedy this situation if you don't have the required resources. + +{{< Note>}} +After confirming the upgrade, you may be prompted to restart services or resolve config file changes. These are expected so carefully read and follow the contributor-safe defaults when available. +{{< /Note>}} + +1. Services restart + +Next you will be prompted to select which services to restart. You can accept the defaults and select any others you know are needed. If you are not sure, skip restarts by selecting Cancel, but it may delay updates taking effect. To navigate inside the Restart Services box: + + **Arrow keys**: Use up/down to move between services + **Spacebar**: Toggles selection showing an asterisk [*] if selected and blank if not [ ] + **Tab**: Moves the cursor to the ** or ** button + **Enter**: Confirms your selection (activates the highlighted button) + + If you selected ** the upgraded packages are still installed, but the changes won't take effect until the affected services are manually restarted or the system is rebooted. + +{{< Note>}} +Rebooting may seem like a quick fix, but it can obscure errors and delay troubleshooting. Restart services directly unless reboot is explicitly required. +{{< /Note>}} + +If you skipped service restarts during the upgrade process, you can apply the updates manually using `systemctl`: + + sudo systemctl restart + + Replacing `` with the actual service, such as: + + sudo systemctl restart ssh + sudo systemctl restart samba + sudo systemctl restart apache2 + +This ensures upgraded packages are used without requiring a full reboot. However, if the installer triggers a service restart (e.g., `systemd`, `udev`, or networking), contributors should: + + - Confirm the restart completed using: + + `systemctl status ` to verify it's active/running. + + - Validate basic functionality: + + Run a quick health check (e.g., `curl localhost:` or confirm CLI tool availability). + +**Summary**: +Messages like "no containers need to be restarted" or "No VM guests are running..." confirm that no action is needed in those areas. These checks are part of `needrestart` that can be ignored unless you're working in a containerized or virtualized environment. Also, some services may show "restart deferred" messages. This means they were flagged for retart but not restarted automatically. Use `sudo systemctl restart if needed. + +If the service fails to restart or behaves unexpectedly, see Troubleshooting: [Restart Response for edge-case handling](guides\development\python\pytorch-install-2-8-0-ubuntu\index.md\#restart-ts). + +1. Install Python and pip (if not already installed). To check: + + python3 --version + pip3 --version + +If it isn't installed, fails or shows an older version (e.g., Python 2.x), then install or update with: + + sudo apt install python3 python3-pip + +Then re-run the above validate version steps to confirm. + +1. Create a Virtual Environment (Optional) + +To isolate dependencies and avoid system-wide installs, you can create a virtual environment by running: + + python3 -m venv pytorch-env +Then do: + ls pytorch-env/bin + +You should see files like `activate`, `pip`, and `python`. If you see these files then run: + + source pytorch-env/bin/activate + +To activate the virtual environment. If you do not see activate, then install the missing package: + + sudo apt install python3.10-venv (where .10 is the latest stable version) + +Then follow the steps above to create the virtual environment and activate it. Then you will see the `(pytorch-env)` in your prompt. + +To keep your PyTorch install separate from system-wide Python packages and: + + - avoid version or dependency conflicts or accidental overwrites. Keeps your PyTorch install separate from other Python projects. + - prevent permission issues. You won't need to run `pip` as root, which also avoids system-level risks. + - enable reproducibility. You can freeze and share your environment with others using `requirements.txt`. + - Stay contributor-safe. No risk of breaking system packages or stepping on other users' toes. + +You can also spin up multiple environments for different projects (e.g., PyTorch CPU-only vs. GPU-enabled), without cross-contamination. CPU-only installs are ideal for low-resource environments. Then when you are done, just delete the environment folder--no lingering packages or broken dependencies. + +{{< Note>}} +This is optional but recommended. It isolates your PyTorch install, protects system packages, and makes contributor onboarding reproducible and frustration-free. +{{< /Note>}} + +1. Install PyTorch via pip + +To install the latest stable versions optimized for CPU use--perfect for lightweight experimentation or server-side work, run: + + pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu + +Respond with "Y" when prompted unless you are unsure about available space. See [Prerequisites](guides\development\python\pytorch-install-2-8-0-ubuntu\index.md\#prerequisites). + +For other configurations (e.g., GPU-enabled installs), refer to [PyTorch's official install guide](https://pytorch.org/get-started/locally/). Be sure to select your OS, package manager, and compute platform carefully. + +1. Validate the Installation + +Run the following Python commands to confirm PyTorch is installed and check for CUDA support: + + python -c "import torch; print(torch.__version__)" + +This confirms PyTorch is installed correctly when it returns something like `2.8.0` or `2.8.o+cpu` which indicates it is a CPU-only build and that it is not linked to any CUDA libraries. + +This gives contributors immediate feedback on both install success and CUDA availability. If `torch.cuda.is_available()` returns `False`, you're running a CPU-only install--which is expected unless you've configured CUDA. + +{{}} +This guide reflects real-world troubleshooting and contributor-safe practices. If you encounter issues during install, check for conflicting Python packages, insufficient RAM, or missing dependencies. +{{< /Note>}} + +## Uninstalling PyTorch + +Whether you're switching builds, cleaning up an environment, or troubleshooting a failed install, here's how to safely uninstall PyTorch (when installed with pip inside a virtual environment) without affecting your system-wide setup: + +### Uninstall inside a virtual environment: + + pip uninstall torch torchvision torchaudio + +If you are dealing with uninstalling PyTorch that was installed outside a virtual environment these instructions still work, but may affect other projects or scripts that rely on PyTorch globally (you might need `sudo` and elevated permissions depending on how it was installed). For help, under these circumstances, with safe uninstall practices see [Markaicode's Complete Guide to Uninstally PyTorch](https://markaicode.com/how-to-uninstall-pytorch-complete-guide-for-all-systems/). + +## Troubleshooting Tips + +### Restart Response for Edge-Case handling {#restart-ts}: + +If a restart fails silently or causes degraded behavior: + + - **Check logs** + Run: + `journalctl -u --since "5 minutes ago"` + to confirm restart confirmation or identify errors. + + - **Retry Safely**: + Use: + `sudo systemctl restart ` + and revalidate. Avoid full reboots unless required. + + - **Flag edge cases** + Services may appear active but fail to bind ports, load configs, or respond to requests. + Include time-stamped logs and config diffs when reporting. + +This section may grow over time as contributors encounter and resolve new issues. All additions are reviewed for clarity and accuracy before publishing. + +## For More Information + +If you run into issues or want to know more about PyTorch, check out the [official PyTorch Tutorials and Knowledge Base](https://docs.pytorch.org/tutorials/). +For the Conda based installation of PyTorch see the [PyTorch Get Started page](https://pytorch.org/get-started/locally/). \ No newline at end of file From 6eb77a2429001919190bf5f9cf684c2be8c6caf5 Mon Sep 17 00:00:00 2001 From: Dianna Hoober Date: Fri, 12 Sep 2025 10:44:25 -0700 Subject: [PATCH 02/15] Trying to fix linter issues in metadata --- .../pytorch-install-2-8-0-ubuntu/index.md | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md index 2499d5a8e4c..69a062c63e7 100644 --- a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md +++ b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md @@ -1,19 +1,14 @@ --- slug: pytorch-install-22-04-ubuntu -title: Installation of Pytorch on Ubuntu 22.04 -description: This version updates to the current stable version using Pip as the installation tool and expands on how to use the services and features for CPU and GPU. -Authors: D Hoober -Contributors: D Hoober +title: Install Pytorch on Ubuntu 22.04 +title_meta: "how to Install PyTorch on Ubuntu 22.04 +description: 'This guide updates to the current stable version using Pip as the installation tool and expands on how to use the services and features for CPU and GPU.' +Authors: Diana Hoober +Contributors: Diana Hoober published: 2021-11-05 -modified: 2025-9-11 +modified: 2025-9-12 keywords: ['pytorch install','pytorch cpu','conda install pytorch','what is pytorch', 'uninstall pytorch'] license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)' -external resources: -- '[PyTorch's official install guide](https://pytorch.org/get-started/locally/)' -- '[Markaicode's Complete Guide to Uninstally PyTorch](https://markaicode.com/how-to-uninstall-pytorch-complete-guide-for-all-systems/)' -- '[official PyTorch Tutorials and Knowledge Base](https://docs.pytorch.org/tutorials/)' -- '[PyTorch Get Started page](https://pytorch.org/get-started/locally/)' - --- This guide shows examples for installing PyTorch, a Python framework, on an Ubuntu 22.04 compute instance and provides support for math-intensive applications that run on GPU and CPU. These instances are both available with Akamai Technologies. From c98ae68a478c8ee5e7b9c52aff0419b517a0fd84 Mon Sep 17 00:00:00 2001 From: DHBR2 Date: Mon, 22 Sep 2025 09:24:30 -0700 Subject: [PATCH 03/15] Update index.md Fixed missing quote in metadata --- .../python/pytorch-install-2-8-0-ubuntu/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md index 69a062c63e7..bfb11d1c70e 100644 --- a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md +++ b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md @@ -1,12 +1,12 @@ --- slug: pytorch-install-22-04-ubuntu title: Install Pytorch on Ubuntu 22.04 -title_meta: "how to Install PyTorch on Ubuntu 22.04 +title_meta: "how to Install PyTorch on Ubuntu 22.04" description: 'This guide updates to the current stable version using Pip as the installation tool and expands on how to use the services and features for CPU and GPU.' Authors: Diana Hoober Contributors: Diana Hoober published: 2021-11-05 -modified: 2025-9-12 +modified: 2025-9-29 keywords: ['pytorch install','pytorch cpu','conda install pytorch','what is pytorch', 'uninstall pytorch'] license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)' --- @@ -193,4 +193,4 @@ This section may grow over time as contributors encounter and resolve new issues ## For More Information If you run into issues or want to know more about PyTorch, check out the [official PyTorch Tutorials and Knowledge Base](https://docs.pytorch.org/tutorials/). -For the Conda based installation of PyTorch see the [PyTorch Get Started page](https://pytorch.org/get-started/locally/). \ No newline at end of file +For the Conda based installation of PyTorch see the [PyTorch Get Started page](https://pytorch.org/get-started/locally/). From 3db3e221c41a92305a1c3a3a20a784a81927450a Mon Sep 17 00:00:00 2001 From: DHBR2 Date: Mon, 22 Sep 2025 09:55:56 -0700 Subject: [PATCH 04/15] Update index.md Corrected capitalization of Pytorch. --- .../development/python/pytorch-install-2-8-0-ubuntu/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md index bfb11d1c70e..20e80963be9 100644 --- a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md +++ b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md @@ -1,6 +1,6 @@ --- slug: pytorch-install-22-04-ubuntu -title: Install Pytorch on Ubuntu 22.04 +title: Install PyTorch on Ubuntu 22.04 title_meta: "how to Install PyTorch on Ubuntu 22.04" description: 'This guide updates to the current stable version using Pip as the installation tool and expands on how to use the services and features for CPU and GPU.' Authors: Diana Hoober From aac28dc28352ab814fab2375f6aef8e3495ba7e4 Mon Sep 17 00:00:00 2001 From: DHBR2 Date: Mon, 22 Sep 2025 10:27:02 -0700 Subject: [PATCH 05/15] Update index.md Changed my name to Smith so it will accept this. --- .../development/python/pytorch-install-2-8-0-ubuntu/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md index 20e80963be9..f2514cc8633 100644 --- a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md +++ b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md @@ -3,8 +3,8 @@ slug: pytorch-install-22-04-ubuntu title: Install PyTorch on Ubuntu 22.04 title_meta: "how to Install PyTorch on Ubuntu 22.04" description: 'This guide updates to the current stable version using Pip as the installation tool and expands on how to use the services and features for CPU and GPU.' -Authors: Diana Hoober -Contributors: Diana Hoober +Authors: Diana Smith +Contributors: Diana Smith published: 2021-11-05 modified: 2025-9-29 keywords: ['pytorch install','pytorch cpu','conda install pytorch','what is pytorch', 'uninstall pytorch'] From 424db76cf9bba968b9ae37426dc5cf6327d807d2 Mon Sep 17 00:00:00 2001 From: DHBR2 Date: Mon, 22 Sep 2025 10:35:01 -0700 Subject: [PATCH 06/15] Update index.md disabled Vale coverage of some metadata --- .../python/pytorch-install-2-8-0-ubuntu/index.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md index f2514cc8633..3644f53dc40 100644 --- a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md +++ b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md @@ -1,17 +1,21 @@ --- + slug: pytorch-install-22-04-ubuntu title: Install PyTorch on Ubuntu 22.04 + title_meta: "how to Install PyTorch on Ubuntu 22.04" description: 'This guide updates to the current stable version using Pip as the installation tool and expands on how to use the services and features for CPU and GPU.' -Authors: Diana Smith -Contributors: Diana Smith + +Authors: Diana Hoober +Contributors: Diana Hoober + published: 2021-11-05 modified: 2025-9-29 keywords: ['pytorch install','pytorch cpu','conda install pytorch','what is pytorch', 'uninstall pytorch'] license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)' --- -This guide shows examples for installing PyTorch, a Python framework, on an Ubuntu 22.04 compute instance and provides support for math-intensive applications that run on GPU and CPU. These instances are both available with Akamai Technologies. +This guide shows examples for installing PyTorch (a Python framework) on an Ubuntu 22.04 compute instance and provides support for math-intensive applications that run on GPU and CPU. These instances are both available with Akamai Technologies. ## What is PyTorch? From 77e33faee0c47dc233014baa3049c365b144f056 Mon Sep 17 00:00:00 2001 From: DHBR2 Date: Mon, 22 Sep 2025 10:42:02 -0700 Subject: [PATCH 07/15] Update index.md trying to fix metadata --- .../pytorch-install-2-8-0-ubuntu/index.md | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md index 3644f53dc40..fa7f3515e4b 100644 --- a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md +++ b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md @@ -1,18 +1,14 @@ --- - -slug: pytorch-install-22-04-ubuntu -title: Install PyTorch on Ubuntu 22.04 - -title_meta: "how to Install PyTorch on Ubuntu 22.04" -description: 'This guide updates to the current stable version using Pip as the installation tool and expands on how to use the services and features for CPU and GPU.' - -Authors: Diana Hoober -Contributors: Diana Hoober - -published: 2021-11-05 -modified: 2025-9-29 -keywords: ['pytorch install','pytorch cpu','conda install pytorch','what is pytorch', 'uninstall pytorch'] -license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)' +slug: "pytorch-install-22-04-ubuntu" +title: "Install PyTorch on Ubuntu 22.04" +title_meta: "How to Install PyTorch on Ubuntu 22.04" +description: "This guide updates to the current stable version using Pip as the installation tool" +authors: "Diana Hoober" +contributors: "Diana Hoober" +published: "2021-11-05" +modified: "2025-09-29" +keywords: ["pytorch install", "pytorch cpu", "conda install pytorch", "what is pytorch", "uninstall pytorch"] +license: "[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0/)" --- This guide shows examples for installing PyTorch (a Python framework) on an Ubuntu 22.04 compute instance and provides support for math-intensive applications that run on GPU and CPU. These instances are both available with Akamai Technologies. From 7bea559d9665a6be3eef5b6bdc44481b0a5f9ab2 Mon Sep 17 00:00:00 2001 From: nmelehan-akamai Date: Tue, 23 Sep 2025 13:51:29 -0400 Subject: [PATCH 08/15] Update index.md --- .../python/pytorch-install-2-8-0-ubuntu/index.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md index fa7f3515e4b..7f1f7c43fc5 100644 --- a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md +++ b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md @@ -48,9 +48,9 @@ Once you have taken care of prerequisties, run: After running these commands, the system prompts you for confirmation [Y/n] before upgrading to ensure you are aware of resource usage and system changes before continuing. Choose "n" to stop and remedy this situation if you don't have the required resources. -{{< Note>}} +{{< note >}} After confirming the upgrade, you may be prompted to restart services or resolve config file changes. These are expected so carefully read and follow the contributor-safe defaults when available. -{{< /Note>}} +{{< /note >}} 1. Services restart @@ -63,9 +63,9 @@ Next you will be prompted to select which services to restart. You can accept th If you selected ** the upgraded packages are still installed, but the changes won't take effect until the affected services are manually restarted or the system is rebooted. -{{< Note>}} +{{< note >}} Rebooting may seem like a quick fix, but it can obscure errors and delay troubleshooting. Restart services directly unless reboot is explicitly required. -{{< /Note>}} +{{< /note >}} If you skipped service restarts during the upgrade process, you can apply the updates manually using `systemctl`: @@ -130,9 +130,9 @@ To keep your PyTorch install separate from system-wide Python packages and: You can also spin up multiple environments for different projects (e.g., PyTorch CPU-only vs. GPU-enabled), without cross-contamination. CPU-only installs are ideal for low-resource environments. Then when you are done, just delete the environment folder--no lingering packages or broken dependencies. -{{< Note>}} +{{< note >}} This is optional but recommended. It isolates your PyTorch install, protects system packages, and makes contributor onboarding reproducible and frustration-free. -{{< /Note>}} +{{< /note >}} 1. Install PyTorch via pip @@ -154,9 +154,9 @@ This confirms PyTorch is installed correctly when it returns something like `2.8 This gives contributors immediate feedback on both install success and CUDA availability. If `torch.cuda.is_available()` returns `False`, you're running a CPU-only install--which is expected unless you've configured CUDA. -{{}} +{{< note >}} This guide reflects real-world troubleshooting and contributor-safe practices. If you encounter issues during install, check for conflicting Python packages, insufficient RAM, or missing dependencies. -{{< /Note>}} +{{< /note >}} ## Uninstalling PyTorch From ada8dac986a93c338d546abdcf447a8ecd1ad2a1 Mon Sep 17 00:00:00 2001 From: nmelehan-akamai Date: Tue, 23 Sep 2025 14:00:51 -0400 Subject: [PATCH 09/15] Update index.md --- .../development/python/pytorch-install-2-8-0-ubuntu/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md index 7f1f7c43fc5..90208060e5a 100644 --- a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md +++ b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md @@ -3,8 +3,8 @@ slug: "pytorch-install-22-04-ubuntu" title: "Install PyTorch on Ubuntu 22.04" title_meta: "How to Install PyTorch on Ubuntu 22.04" description: "This guide updates to the current stable version using Pip as the installation tool" -authors: "Diana Hoober" -contributors: "Diana Hoober" +authors: ["Diana Hoober"] +contributors: ["Diana Hoober"] published: "2021-11-05" modified: "2025-09-29" keywords: ["pytorch install", "pytorch cpu", "conda install pytorch", "what is pytorch", "uninstall pytorch"] From 720882a20bf74327962dafe6fe8e91c79c655ced Mon Sep 17 00:00:00 2001 From: nmelehan-akamai Date: Tue, 23 Sep 2025 14:05:02 -0400 Subject: [PATCH 10/15] Update index.md --- .../development/python/pytorch-install-2-8-0-ubuntu/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md index 90208060e5a..97830223dc9 100644 --- a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md +++ b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md @@ -5,8 +5,8 @@ title_meta: "How to Install PyTorch on Ubuntu 22.04" description: "This guide updates to the current stable version using Pip as the installation tool" authors: ["Diana Hoober"] contributors: ["Diana Hoober"] -published: "2021-11-05" -modified: "2025-09-29" +published: 2021-11-05 +modified: 2025-09-29 keywords: ["pytorch install", "pytorch cpu", "conda install pytorch", "what is pytorch", "uninstall pytorch"] license: "[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0/)" --- From 287498bf4828e3e3dd7b70c7d586a05e05b4532b Mon Sep 17 00:00:00 2001 From: nmelehan-akamai Date: Tue, 23 Sep 2025 14:10:42 -0400 Subject: [PATCH 11/15] Update index.md --- .../python/pytorch-install-2-8-0-ubuntu/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md index 97830223dc9..8c0118d020f 100644 --- a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md +++ b/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md @@ -42,7 +42,7 @@ To install and run PyTorch comfortably, your system should have: 1. Update your system -Once you have taken care of prerequisties, run: +Once you have taken care of prerequisites, run: sudo apt update && sudo apt upgrade @@ -88,7 +88,7 @@ This ensures upgraded packages are used without requiring a full reboot. However Run a quick health check (e.g., `curl localhost:` or confirm CLI tool availability). **Summary**: -Messages like "no containers need to be restarted" or "No VM guests are running..." confirm that no action is needed in those areas. These checks are part of `needrestart` that can be ignored unless you're working in a containerized or virtualized environment. Also, some services may show "restart deferred" messages. This means they were flagged for retart but not restarted automatically. Use `sudo systemctl restart if needed. +Messages like "no containers need to be restarted" or "No VM guests are running..." confirm that no action is needed in those areas. These checks are part of `needrestart` that can be ignored unless you're working in a containerized or virtualized environment. Also, some services may show "restart deferred" messages. This means they were flagged for restart but not restarted automatically. Use `sudo systemctl restart if needed. If the service fails to restart or behaves unexpectedly, see Troubleshooting: [Restart Response for edge-case handling](guides\development\python\pytorch-install-2-8-0-ubuntu\index.md\#restart-ts). @@ -166,7 +166,7 @@ Whether you're switching builds, cleaning up an environment, or troubleshooting pip uninstall torch torchvision torchaudio -If you are dealing with uninstalling PyTorch that was installed outside a virtual environment these instructions still work, but may affect other projects or scripts that rely on PyTorch globally (you might need `sudo` and elevated permissions depending on how it was installed). For help, under these circumstances, with safe uninstall practices see [Markaicode's Complete Guide to Uninstally PyTorch](https://markaicode.com/how-to-uninstall-pytorch-complete-guide-for-all-systems/). +If you are dealing with uninstalling PyTorch that was installed outside a virtual environment these instructions still work, but may affect other projects or scripts that rely on PyTorch globally (you might need `sudo` and elevated permissions depending on how it was installed). For help, under these circumstances, with safe uninstall practices see [Markaicode's Complete Guide to Uninstall PyTorch](https://markaicode.com/how-to-uninstall-pytorch-complete-guide-for-all-systems/). ## Troubleshooting Tips From 15c4cbff4aebf520009e3763aed1f003d5bc2367 Mon Sep 17 00:00:00 2001 From: Nathan Melehan Date: Tue, 23 Sep 2025 18:17:04 +0000 Subject: [PATCH 12/15] Move guide to new folder --- .../index.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/guides/development/python/{pytorch-install-2-8-0-ubuntu => install-pytorch-ubuntu-22-04}/index.md (100%) diff --git a/docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md b/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md similarity index 100% rename from docs/guides/development/python/pytorch-install-2-8-0-ubuntu/index.md rename to docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md From 0362886a15f81e207abd142b3a14513d7084904f Mon Sep 17 00:00:00 2001 From: Nathan Melehan Date: Tue, 23 Sep 2025 18:18:20 +0000 Subject: [PATCH 13/15] Update slug to match new folder name --- .../development/python/install-pytorch-ubuntu-22-04/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md b/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md index 8c0118d020f..b68256c1bba 100644 --- a/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md +++ b/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md @@ -1,5 +1,5 @@ --- -slug: "pytorch-install-22-04-ubuntu" +slug: "install-pytorch-ubuntu-22-04" title: "Install PyTorch on Ubuntu 22.04" title_meta: "How to Install PyTorch on Ubuntu 22.04" description: "This guide updates to the current stable version using Pip as the installation tool" From 39ed14e9a76bf7616c0f7d520cfd998ab4cebc3a Mon Sep 17 00:00:00 2001 From: DHBR2 Date: Wed, 8 Oct 2025 09:09:53 -0700 Subject: [PATCH 14/15] Update index.md Added missing backticks for format adherence. --- .../install-pytorch-ubuntu-22-04/index.md | 38 ++++++++++++++++--- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md b/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md index b68256c1bba..2df586429fa 100644 --- a/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md +++ b/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md @@ -19,8 +19,7 @@ This is an open-source machine learning framework that enables fast, flexible ex ## Before You Begin -Our guide assumes you're working on a Linux-based compute instance with sudo access. You're going to install PyTorch in a Python environment--either system-wide or within a virtualenv (virtu -al environment is recommended). +Our guide assumes you're working on a Linux-based compute instance with sudo access. You're going to install PyTorch in a Python environment--either system-wide or within a virtualenv (virtual environment is recommended). ### Prerequisites @@ -36,7 +35,9 @@ To install and run PyTorch comfortably, your system should have: - No conflicting Python packages - At least 3 - 5 GB of free disk space, depending on your python version, virtual environment setup, and additional packages. If working on a minimal or resource-constrained system, consider checking available disk space with: +``` df -h +``` ## Installation Steps @@ -44,7 +45,9 @@ To install and run PyTorch comfortably, your system should have: Once you have taken care of prerequisites, run: +``` sudo apt update && sudo apt upgrade +``` After running these commands, the system prompts you for confirmation [Y/n] before upgrading to ensure you are aware of resource usage and system changes before continuing. Choose "n" to stop and remedy this situation if you don't have the required resources. @@ -61,7 +64,7 @@ Next you will be prompted to select which services to restart. You can accept th **Tab**: Moves the cursor to the ** or ** button **Enter**: Confirms your selection (activates the highlighted button) - If you selected ** the upgraded packages are still installed, but the changes won't take effect until the affected services are manually restarted or the system is rebooted. +If you selected ** the upgraded packages are still installed, but the changes won't take effect until the affected services are manually restarted or the system is rebooted. {{< note >}} Rebooting may seem like a quick fix, but it can obscure errors and delay troubleshooting. Restart services directly unless reboot is explicitly required. @@ -69,14 +72,17 @@ Rebooting may seem like a quick fix, but it can obscure errors and delay trouble If you skipped service restarts during the upgrade process, you can apply the updates manually using `systemctl`: +``` sudo systemctl restart +``` Replacing `` with the actual service, such as: +``` sudo systemctl restart ssh sudo systemctl restart samba sudo systemctl restart apache2 - +``` This ensures upgraded packages are used without requiring a full reboot. However, if the installer triggers a service restart (e.g., `systemd`, `udev`, or networking), contributors should: - Confirm the restart completed using: @@ -88,18 +94,22 @@ This ensures upgraded packages are used without requiring a full reboot. However Run a quick health check (e.g., `curl localhost:` or confirm CLI tool availability). **Summary**: -Messages like "no containers need to be restarted" or "No VM guests are running..." confirm that no action is needed in those areas. These checks are part of `needrestart` that can be ignored unless you're working in a containerized or virtualized environment. Also, some services may show "restart deferred" messages. This means they were flagged for restart but not restarted automatically. Use `sudo systemctl restart if needed. +Messages like "no containers need to be restarted" or "No VM guests are running..." confirm that no action is needed in those areas. These checks are part of `needrestart` that can be ignored unless you're working in a containerized or virtualized environment. Also, some services may show "restart deferred" messages. This means they were flagged for restart but not restarted automatically. Use `sudo systemctl restart ` if needed. If the service fails to restart or behaves unexpectedly, see Troubleshooting: [Restart Response for edge-case handling](guides\development\python\pytorch-install-2-8-0-ubuntu\index.md\#restart-ts). 1. Install Python and pip (if not already installed). To check: +``` python3 --version pip3 --version +``` If it isn't installed, fails or shows an older version (e.g., Python 2.x), then install or update with: +``` sudo apt install python3 python3-pip +``` Then re-run the above validate version steps to confirm. @@ -107,17 +117,27 @@ Then re-run the above validate version steps to confirm. To isolate dependencies and avoid system-wide installs, you can create a virtual environment by running: +``` python3 -m venv pytorch-env +``` + Then do: + +``` ls pytorch-env/bin +``` You should see files like `activate`, `pip`, and `python`. If you see these files then run: +``` source pytorch-env/bin/activate +``` To activate the virtual environment. If you do not see activate, then install the missing package: +``` sudo apt install python3.10-venv (where .10 is the latest stable version) +``` Then follow the steps above to create the virtual environment and activate it. Then you will see the `(pytorch-env)` in your prompt. @@ -138,7 +158,9 @@ This is optional but recommended. It isolates your PyTorch install, protects sys To install the latest stable versions optimized for CPU use--perfect for lightweight experimentation or server-side work, run: +``` pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu +``` Respond with "Y" when prompted unless you are unsure about available space. See [Prerequisites](guides\development\python\pytorch-install-2-8-0-ubuntu\index.md\#prerequisites). @@ -148,7 +170,9 @@ For other configurations (e.g., GPU-enabled installs), refer to [PyTorch's offic Run the following Python commands to confirm PyTorch is installed and check for CUDA support: +``` python -c "import torch; print(torch.__version__)" +``` This confirms PyTorch is installed correctly when it returns something like `2.8.0` or `2.8.o+cpu` which indicates it is a CPU-only build and that it is not linked to any CUDA libraries. @@ -164,7 +188,9 @@ Whether you're switching builds, cleaning up an environment, or troubleshooting ### Uninstall inside a virtual environment: +``` pip uninstall torch torchvision torchaudio +``` If you are dealing with uninstalling PyTorch that was installed outside a virtual environment these instructions still work, but may affect other projects or scripts that rely on PyTorch globally (you might need `sudo` and elevated permissions depending on how it was installed). For help, under these circumstances, with safe uninstall practices see [Markaicode's Complete Guide to Uninstall PyTorch](https://markaicode.com/how-to-uninstall-pytorch-complete-guide-for-all-systems/). @@ -190,7 +216,7 @@ If a restart fails silently or causes degraded behavior: This section may grow over time as contributors encounter and resolve new issues. All additions are reviewed for clarity and accuracy before publishing. -## For More Information +## Further Information If you run into issues or want to know more about PyTorch, check out the [official PyTorch Tutorials and Knowledge Base](https://docs.pytorch.org/tutorials/). For the Conda based installation of PyTorch see the [PyTorch Get Started page](https://pytorch.org/get-started/locally/). From 159c6ca58200e8e4c9434662c229ff0ac995f67e Mon Sep 17 00:00:00 2001 From: DHBR2 Date: Wed, 8 Oct 2025 09:42:16 -0700 Subject: [PATCH 15/15] Update index.md Fixed numbering. --- .../python/install-pytorch-ubuntu-22-04/index.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md b/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md index 2df586429fa..13fc4fe7738 100644 --- a/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md +++ b/docs/guides/development/python/install-pytorch-ubuntu-22-04/index.md @@ -55,7 +55,7 @@ After running these commands, the system prompts you for confirmation [Y/n] befo After confirming the upgrade, you may be prompted to restart services or resolve config file changes. These are expected so carefully read and follow the contributor-safe defaults when available. {{< /note >}} -1. Services restart +2. Services restart Next you will be prompted to select which services to restart. You can accept the defaults and select any others you know are needed. If you are not sure, skip restarts by selecting Cancel, but it may delay updates taking effect. To navigate inside the Restart Services box: @@ -64,7 +64,7 @@ Next you will be prompted to select which services to restart. You can accept th **Tab**: Moves the cursor to the ** or ** button **Enter**: Confirms your selection (activates the highlighted button) -If you selected ** the upgraded packages are still installed, but the changes won't take effect until the affected services are manually restarted or the system is rebooted. +If you selected **Cancel** (or skipped the restart) the upgraded packages are still installed, but the changes won't take effect until the affected services are manually restarted or the system is rebooted. {{< note >}} Rebooting may seem like a quick fix, but it can obscure errors and delay troubleshooting. Restart services directly unless reboot is explicitly required. @@ -98,7 +98,7 @@ Messages like "no containers need to be restarted" or "No VM guests are running. If the service fails to restart or behaves unexpectedly, see Troubleshooting: [Restart Response for edge-case handling](guides\development\python\pytorch-install-2-8-0-ubuntu\index.md\#restart-ts). -1. Install Python and pip (if not already installed). To check: +3. Install Python and pip (if not already installed). To check: ``` python3 --version @@ -113,7 +113,7 @@ If it isn't installed, fails or shows an older version (e.g., Python 2.x), then Then re-run the above validate version steps to confirm. -1. Create a Virtual Environment (Optional) +4. Create a Virtual Environment (Optional) To isolate dependencies and avoid system-wide installs, you can create a virtual environment by running: @@ -154,7 +154,7 @@ You can also spin up multiple environments for different projects (e.g., PyTorch This is optional but recommended. It isolates your PyTorch install, protects system packages, and makes contributor onboarding reproducible and frustration-free. {{< /note >}} -1. Install PyTorch via pip +5. Install PyTorch via pip To install the latest stable versions optimized for CPU use--perfect for lightweight experimentation or server-side work, run: @@ -166,7 +166,7 @@ Respond with "Y" when prompted unless you are unsure about available space. See For other configurations (e.g., GPU-enabled installs), refer to [PyTorch's official install guide](https://pytorch.org/get-started/locally/). Be sure to select your OS, package manager, and compute platform carefully. -1. Validate the Installation +6. Validate the Installation Run the following Python commands to confirm PyTorch is installed and check for CUDA support: