-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New version of installing PyTorch using pip #7337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
5ade233
6eb77a2
c98ae68
3db3e22
aac28dc
424db76
77e33fa
7bea559
ada8dac
720882a
287498b
15c4cbf
0362886
39ed14e
159c6ca
05721b0
2261bc0
3799ca0
af7a86c
1eb6334
974d6e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2052,6 +2052,8 @@ pyspark | |
| pytest | ||
| python3 | ||
| pythonic | ||
| pytorch | ||
| Pytorch | ||
| qemu | ||
| qmail | ||
| qmgr | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,224 @@ | ||||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||||
| 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 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-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. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ## 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. | ||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ## 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 (virtual 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: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| df -h | ||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+22
to
+42
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before You Begin
Optimizing a task may also require using external data sources. If using external data sources and data sets, like Linode Object Storage, you should prepare them ahead of setting up your PyTorch GPU instance.
This approach ensures we give users complete information about what they need and where to find it if they don’t already have it. It also strengthens our SEO performance through helpful internal links.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the suggestions. I understand the intent to align more closely with the Linode Formatting Guide, and I appreciate the attention to structure. I’ve been following a slightly different editorial approach across the content I’ve authored—based on my understanding of Andy’s preferences and the tone he’s asked me to bring to recent assignments. |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ## Installation Steps | ||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the suggestion. I understand the desire for consistency, but I haven’t found a rule in the Linode Writer’s Formatting Guide that mandates gerunds for all headings. “Installation Steps” is a noun phrase that aligns with other accepted patterns in Linode docs, and I’d prefer to retain it unless we receive specific guidance to revise. Happy to revisit if needed. |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| 1. Update your system | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Once you have taken care of prerequisites, run: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| 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 >}} | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+46
to
+59
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
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 >}}
This formatting ensures that the notes and the additional information related to step 1 remain under step 1.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a generic review command applicable across the guide.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’ll update the formatting to align with how similar steps are structured in existing Linode guides like the old Vaultwarden install doc. This keeps related content visually grouped under each step and supports consistency across the rendered output. |
||||||||||||||||||||||||||||||||||||||||
| 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: | ||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use different format to distinguish the verbs in the output or on the screen for example:
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the suggestion. I appreciate it and the intent to distinguish UI verbs and labels. Currently, the Linode Writer's Guide doesn't require this formatting, and most published guides us plain text for UI elements unless clarity demands emphasis. If we receive new direction to adopt external standards, I'll be happy to change those when needed. |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| **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 *<Ok>* or *<Cancel>* button | ||||||||||||||||||||||||||||||||||||||||
| **Enter**: Confirms your selection (activates the highlighted button) | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||||||||||
| {{< /note >}} | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| If you skipped service restarts during the upgrade process, you can apply the updates manually using `systemctl`: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| sudo systemctl restart <service-name> | ||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Replacing `<service-name>` with the actual service, such as: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| 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: | ||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generic comments applicable across the guide: |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - Confirm the restart completed using: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| `systemctl status <service>` to verify it's active/running. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - Validate basic functionality: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Run a quick health check (e.g., `curl localhost:<port>` 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 <service>` 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). | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| 3. Install Python and pip (if not already installed). To check: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| 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: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| sudo apt install python3 python3-pip | ||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Then re-run the above validate version steps to confirm. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| 4. Create a Virtual Environment (Optional) | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| To isolate dependencies and avoid system-wide installs, you can create a virtual environment by running: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| python3 -m venv pytorch-env | ||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Then do: | ||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is a new step then why not number it as 5. If it is a sub step then should it not be
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's an optional step not a new one but is a step within the context of the section if they choose to do so. Sub numbering might be confusing unless there is specific guidance that applies, I would prefer to leave it as is. |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| ls pytorch-env/bin | ||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| You should see files like `activate`, `pip`, and `python`. If you see these files then run: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| source pytorch-env/bin/activate | ||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| To activate the virtual environment. If you do not see activate, then install the missing package: | ||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If these are optional then may be it should be unordered list : https://www.linode.com/docs/guides/linode-writers-formatting-guide/#unordered-lists |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| 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: | ||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it unordered list?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I agree, it is an unordered list and I will fix this, my bad. |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - 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 >}} | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| 5. Install PyTorch via pip | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| To install the latest stable versions optimized for CPU use--perfect for lightweight experimentation or server-side work, run: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| 6. Validate the Installation | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Run the following Python commands to confirm PyTorch is installed and check for CUDA support: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| {{< 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 >}} | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ## 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: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```command | ||||||||||||||||||||||||||||||||||||||||
| 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/). | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ## Troubleshooting Tips | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ### Restart Response for Edge-Case handling {#restart-ts}: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| If a restart fails silently or causes degraded behavior: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - **Check logs** | ||||||||||||||||||||||||||||||||||||||||
| Run: | ||||||||||||||||||||||||||||||||||||||||
| `journalctl -u <service> --since "5 minutes ago"` | ||||||||||||||||||||||||||||||||||||||||
| to confirm restart confirmation or identify errors. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - **Retry Safely**: | ||||||||||||||||||||||||||||||||||||||||
| Use: | ||||||||||||||||||||||||||||||||||||||||
| `sudo systemctl restart <service>` | ||||||||||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ## 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/). | ||||||||||||||||||||||||||||||||||||||||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the goal of tightening the intro, but I’d prefer to retain a bit more context here. “Shows examples” reflects that we’re offering a primary method (pip) while also linking out to Conda as an alternative—per our approach of referencing existing material rather than duplicating it. I’d also like to keep “(a Python framework)” for clarity, especially for readers newer to PyTorch. My aim is to support a range of developer familiarity levels while staying within Linode’s editorial tone.
Happy to revisit if needed, but I’d like to preserve this slightly more explanatory phrasing for now.