Skip to content

PShiw/MLForEverything

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MLForEverything

Prerequisites

Installing UV Package Manager

What is UV?

UV is an extremely fast Python package installer and resolver, written in Rust. It's designed as a drop-in replacement for pip and pip-tools, offering significant performance improvements for package installation and dependency resolution.

Advantages of Using UV

  • Speed: 10-100x faster than pip for package installation and dependency resolution
  • Reliable: Consistent dependency resolution with a robust resolver
  • Drop-in Replacement: Compatible with pip commands and workflows
  • Disk Space Efficient: Uses a global cache to avoid redundant downloads
  • Better Error Messages: Provides clearer feedback when dependency conflicts occur
  • Modern: Built with modern Rust tooling for performance and reliability

Installation Instructions

macOS

Install UV using Homebrew:

brew install uv

Or using curl:

curl -LsSf https://astral.sh/uv/install.sh | sh

Or using pip:

pip install uv
Linux (Ubuntu/Debian)

Using curl:

curl -LsSf https://astral.sh/uv/install.sh | sh

Or using pip:

pip install uv

Or using pipx (recommended for system-wide installation):

pipx install uv
Windows

Using PowerShell:

powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

Or using pip:

pip install uv

Or using Scoop:

scoop install uv

Verify Installation

After installation, verify that UV is installed correctly:

uv --version

Basic UV Usage

Replace pip with uv pip in your commands:

# Install a package
uv pip install package-name

# Install from requirements.txt
uv pip install -r requirements.txt

# Install in a virtual environment
uv venv --python 3.12 
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv pip install package-name

Installing Jupyter Notebook with UV

Step 1: Create a Virtual Environment (Recommended)

First, create a virtual environment using UV:

uv venv --python 3.12

This creates a .venv directory in your project.

Step 2: Activate the Virtual Environment

On macOS/Linux:

source .venv/bin/activate

On Windows:

.venv\Scripts\activate

Step 3: Install Jupyter Notebook

Install Jupyter Notebook using UV:

uv pip install notebook

Or install JupyterLab (modern interface):

uv pip install jupyterlab

Alternative: Install All Dependencies at Once

If you have a requirements.txt file with all your project dependencies, you can install everything in one command:

uv pip install -r requirements.txt

This will install Jupyter, data science libraries, deep learning frameworks, and visualization tools all together.

Step 4: Create a Jupyter Kernel (Optional but Recommended)

To use your virtual environment as a kernel in Jupyter Notebook, install and register it:

# Install ipykernel
uv pip install ipykernel

# Register the kernel with Jupyter
python -m ipykernel install --user --name=mlforeverything --display-name="Python (MLForEverything)"

This creates a kernel named "mlforeverything" that will appear in Jupyter's kernel selection menu.

Parameters explained:

  • --user: Installs the kernel for the current user only
  • --name: Internal name for the kernel (used in kernel specs)
  • --display-name: Name shown in Jupyter's interface

Step 5: Launch Jupyter Notebook

Start Jupyter Notebook:

jupyter notebook

Or start JupyterLab:

jupyter lab

This will open Jupyter in your default web browser at http://localhost:8888.

When creating a new notebook, select "Python (MLForEverything)" from the kernel menu.

Managing Kernels

List all installed kernels:

jupyter kernelspec list

Remove a kernel:

jupyter kernelspec remove mlforeverything

Change to a different kernel in a running notebook: Go to KernelChange Kernel in the Jupyter Notebook menu.

Alternative: Install and Run in One Step

You can also use UV to run Jupyter without explicitly installing it first:

uv run jupyter notebook

This automatically installs Jupyter in an isolated environment and runs it.

Installing Additional Packages

Once your virtual environment is active, you can install additional packages for your notebooks:

Option 1: Install from requirements.txt (Recommended)

uv pip install -r requirements.txt

Option 2: Install packages individually

# Install data science packages
uv pip install numpy pandas matplotlib seaborn scikit-learn

# Install deep learning frameworks
uv pip install torch tensorflow

# Install visualization libraries
uv pip install plotly bokeh altair

Stopping Jupyter

To stop the Jupyter server, press Ctrl+C in the terminal where it's running.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors