PageSourceSearch

https://chris7462.github.io/assets/js/3512b228.2214b0c4.js

js chris7462.github.io collected 2026-10-03 08:49:28 UTC 3,237 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkchris7462_github_io=globalThis.webpackChunkchris7462_github_io||[]).push([[4636],{7151(n,e,t){t.r(e),t.d(e,{assets:()=>l,contentTitle:()=>c,default:()=>d,frontMatter:()=>s,metadata:()=>o,toc:()=>a});const o=JSON.parse('{"id":"dl-setup/pytorch-torchvision","title":"Install PyTorch and TorchVision","description":"Install PyTorch and TorchVision for Python using pre-built wheels on Ubuntu 24.04","source":"@site/docs/dl-setup/pytorch-torchvision.md","sourceDirName":"dl-setup","slug":"/dl-setup/pytorch-torchvision","permalink":"/docs/dl-setup/pytorch-torchvision","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":4,"frontMatter":{"sidebar_position":4,"title":"Install PyTorch and TorchVision","description":"Install PyTorch and TorchVision for Python using pre-built wheels on Ubuntu 24.04"},"sidebar":"tutorialSidebar","previous":{"title":"Install LibTorch and LibTorchVision","permalink":"/docs/dl-setup/libtorch-libtorchvision"},"next":{"title":"Perception Setup","permalink":"/docs/category/perception-setup"}}');var i=t(4848),r=t(8453);const s={sidebar_position:4,title:"Install PyTorch and TorchVision",description:"Install PyTorch and TorchVision for Python using pre-built wheels on Ubuntu 24.04"},c="Install PyTorch and TorchVision",l={},a=[{value:"Validation",id:"validation",level:2}];function h(n){const e={code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,r.R)(),...n.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(e.header,{children:(0,i.jsx)(e.h1,{id:"install-pytorch-and-torchvision",children:"Install PyTorch and TorchVision"})}),"\n",(0,i.jsx)(e.p,{children:"My suggestion is to install these packages from pre-built Python wheels directly. This saves a lot of time and trouble as long as you have installed the correct NVIDIA driver and CUDA toolkit."}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-bash",children:"sudo pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu132 --break-system-packages\n"})}),"\n",(0,i.jsx)(e.h2,{id:"validation",children:"Validation"}),"\n",(0,i.jsx)(e.p,{children:"Verify that PyTorch and TorchVision are installed correctly and that the GPU is accessible:"}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-python",children:"import torch\ntorch.__version__    # '2.12.0+cu132'\ntorch.cuda.is_available()    # True\n\nimport torchvision\ntorchvision.__version__    # '0.27.0+cu132'\n"})}),"\n",(0,i.jsx)(e.p,{children:"Expected output:"}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{children:"'2.12.0+cu132'\nTrue\n'0.27.0+cu132'\n"})}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{})})]})}function d(n={}){const{wrapper:e}={...(0,r.R)(),...n.components};return e?(0,i.jsx)(e,{...n,children:(0,i.jsx)(h,{...n})}):h(n)}},8453(n,e,t){t.d(e,{R:()=>s,x:()=>c});var o=t(6540);const i={},r=o.createContext(i);function s(n){const e=o.useContext(r);return o.useMemo(function(){return"function"==typeof n?n(e):{...e,...n}},[e,n])}function c(n){let e;return e=n.disableParentContext?"function"==typeof n.components?n.components(i):n.components||i:s(n.components),o.createElement(r.Provider,{value:e},n.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.