M.Sc and M.Tech hands-on QC Lab IIT Jodhpur.
This guide explains how to set up and use a Python environment using
uv — a fast Python package manager and project tool.
If your repository contains a uv.lock file, it means dependencies are already pinned and reproducible.
We'll use that to create an isolated environment.
- Python 3.8+ installed
- Internet connection (for initial dependency resolution)
- Access to a terminal or shell (PowerShell on Windows, bash/zsh on macOS or Linux)
uv can be installed globally or used temporarily.
Choose your operating system below:
You can install via the installation script or with pip:
# Recommended fast install
curl -LsSf https://astral.sh/uv/install.sh | sh
# or using pip
pip install uv
Confirm installation:
```bash
uv --versionTo install uv on Windows, open PowerShell and run either of the following commands:
# Using PowerShell installer (recommended)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Or install via pip
pip install uv
---
## 2️⃣ Create or Sync Environment from `uv.lock`
If your repository already includes a `uv.lock` file, you can create a virtual environment with all dependencies locked and reproducible.
```bash
uv syncThis command:
- Creates a
.venv/folder (if it doesn't exist) - Installs dependencies exactly as specified in
uv.lock - Uses the fastest available wheels and build cache
---
## 3️⃣ Activate the Environment
Once installed, activate the environment:
```bash
source .venv/bin/activate # macOS / Linux
.venv\Scripts\activate # Windows
If you are inside a Jupyter notebook, you can directly use the interpreter via:
uv run pythonYou can execute any script or module from the environment using uv run.
Example:
uv run python main.pyOr launch Jupyter Notebook:
uv run jupyter notebookTo add a new dependency:
uv add numpyThen re-sync:
uv syncTo export your lock file for pip users:
uv export --format requirements.txt --output requirements.txtuvmanages environment setup and dependency locking efficiently.uv syncensures reproducibility usinguv.lock.- Use
uv runto execute commands in the environment.
Now you can start developing or running your Quantum Computing Codes! 🚀