DEV Community

Super Kai (Kazuya Ito)
Super Kai (Kazuya Ito)

Posted on

Install PyTorch and JupyterLab on Ubuntu

Buy Me a Coffee

First, update and upgrade Ubuntu:

sudo apt update && sudo apt -y upgrade
Enter fullscreen mode Exit fullscreen mode

Next, check the Python version:

python3 --version
# Python 3.12.3
Enter fullscreen mode Exit fullscreen mode

Next, install python3.12-venv:
*Memos:

  • For example, if the Python version is Python 3.13.x, you need to install python3.13-venv.
  • By default, python3.xx-venv isn't installed on Ubuntu.
sudo apt install -y python3.12-venv
Enter fullscreen mode Exit fullscreen mode

This is the current directory:

pwd
# /home/kai
Enter fullscreen mode Exit fullscreen mode

Next, create a virtual environment:

python3 -m venv venv
Enter fullscreen mode Exit fullscreen mode

Next, activate the virtual environment:

. venv/bin/activate
Enter fullscreen mode Exit fullscreen mode

Next, install PyTorch with CUDA 11.8. *There are other CUDA(Compute Unified Device Architecture) versons and a ROCm(Radeon Open Compute Platform) version and CPU version available from here:

pip install torch torchvision torchaudio
\ --index-url https://download.pytorch.org/whl/cu118
Enter fullscreen mode Exit fullscreen mode

Next, install JupyterLab:

pip install jupyterlab
Enter fullscreen mode Exit fullscreen mode

Next, open JupyterLab on Firefox:

jupyter lab
Enter fullscreen mode Exit fullscreen mode

*You can open JupyterLab with specific directory on Firefox:

jupyter lab --notebook-dir /home/kai
Enter fullscreen mode Exit fullscreen mode

Image description

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay