- Context
- Fastest package installer and virtual environment manager.
-
Using
pippip install uv
-
Using
exepowershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" -
More installation process can be found in official docs
uv venv # Creates a .venv in the current directory
uv venv my_environment # Creates a venv named my_environment
uv venv --python 3.11.6 # Create venv with a specific Python version
uv pip install requests # Install a package
uv pip list # List installed packages
uv run app.py # to run py file-
Activate environment
.venv\Scripts\activate
-
Sync environment exactly to a requirements file (installs missing, removes extra)
uv pip sync requirements.txt
-
Export to
requirements.txtuv export --format requirements-txt --no-hashes --no-annotate > requirements.txt
-
Adding packages to uv from
requirements.txtuv init uv add -r requirements.txt
-
Upgrade packages
uv lock --upgrade-package requests
or all packages
uv lock --upgrade
- Now run
uv sync
- Now run
-
Initialize a new project (creates
pyproject.toml)uv init
-
Add dependencies to
pyproject.tomland install/sync themuv add flask requests
-
Add a development dependency
uv add --group dev pytest
-
Remove a dependency
uv remove requests
-
Create/update the
uv.lockfile based onpyproject.tomluv lock
-
Install dependencies into the
venvbased onuv.lock(likeuv pip sync)uv sync
-
Display Dependency Tree
uv tree
-
Use pip command in uv environment by installing seed packages (one or more of: pip, setuptools, and wheel) into the virtual environment.
uv venv --seed
-
ModuleNotFoundError: No module named 'distutils'
-
pip install setuptoolswill solve this error
-
Install pipdeptree
uv pip install pipdeptree
-
Run the command to generate indented
requirements.txtpipdeptree -f > requirements.txt -
Package can be excluded
pipdeptree --exclude pip,pipdeptree,setuptools,wheel,build,packaging,pyproject_hooks -f > requirements.txt -
Minimal only main package
requirements.txtpipdeptree --warn silence | grep -E "^[a-zA-Z0-9]" | awk '{print $1}' > requirements.txt
or
pipdeptree --warn silence | findstr "^[a-zA-Z]" > requirements.txt
-
Combined exclude and minimal command
pipdeptree --exclude pip,pipdeptree,setuptools,wheel,build,packaging,pyproject_hooks --warn silence | grep -E "^[a-zA-Z0-9]" | awk '{print $1}' > requirements.txt
-
Upgrade package version in
requirements.txtusing purpur -r requirements.txt
- Full-fledged dependency and package manager.
curl -sSL https://install.python-poetry.org | python3 -Using pip
pip install poetry-
Create
pyproject.tomlpoetry init
-
Or create a peotry project
poetry new project_name
-
Create virual environment (env will be create in cache directory)
poetry install
-
To create virtual environment withing project directory
poetry config virtualenvs.in-project trueThen
poetry install
-
Add a package
poetry add requests
-
Remove a package
poetry remove flask
-
Show install packages
poetry show
-
Show details of a specific package
poetry show flask
-
Update all dependencies
poetry update
-
Lock dependencies (generate/update poetry.lock)
poetry lock
-
Run command inside the virtual environment
poetry run python new.py
-
List all virtual environments
poetry env list
-
Check for dependency issues
poetry check
- Best for managing multiple Python versions and virtual environments.
-
pip install pyenv-win --target %USERPROFILE%\\.pyenv -
If you run into an error with the above command use the following instead (#303):
pip install pyenv-win --target %USERPROFILE%\\.pyenv --no-user --upgrade -
Setup Windows environment variable
Variable Value PYENV C:\Users\my_pc.pyenv\pyenv-win\ PYENV_HOME C:\Users\my_pc.pyenv\pyenv-win\ PYENV_ROOT C:\Users\my_pc.pyenv\pyenv-win\ -
And add two more lines to user variable Path
C:\Users\my_pc\.pyenv\pyenv-win\bin C:\Users\my_pc\.pyenv\pyenv-win\shims
-
Restart cmd or run
RefreshEnv.cmdcommand provided byChocolatey
-
Get list of available python version
pyenv install -l
-
Installing a python version
pyenv install 3.10.5
-
Uninstalling a python version
pyenv uninstall 3.10.5
-
Set python
pyenv global 3.10
-
Select just for current shell session
pyenv shell 3.10.5
-
Multiple Python versions at the same time by specifying multiple arguments
pyenv global 3.11 3.12
-
pyenv update python version
pyenv update
- Best for installing standalone CLI tools globally in isolated environments.
-
Installing using pip
python -m pip install --user pipx
-
Warning solution
WARNING: The scripts activate-global-python-argcomplete.exe, python-argcomplete-check-easy-install-script.exe and register-python-argcomplete.exe are installed in 'C:\Users\Admin\AppData\Roaming\Python\Python312\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script userpath.exe is installed in 'C:\Users\Admin\AppData\Roaming\Python\Python312\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script pipx.exe is installed in 'C:\Users\Admin\AppData\Roaming\Python\Python312\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. -
Go to mentioned path
C:\Users\Admin\AppData\Roaming\Python\Python312\Scripts -
Open cmd on that path and run
.\pipx.exe ensurepath
-
Installing Package
pipx install pycowsay
-
Uninstalling Package
pipx uninstall pycowsay
-
Inject a package (when required additional packages)
pipx inject ipython matplotlib
-
Injecting multiple packages
pipx inject ipython matplotlib pandas # or: pipx inject ipython -r useful-packages.txt
| Tool | Purpose | Use Case |
|---|---|---|
httpie |
HTTP client | User-friendly curl alternative for APIs |
black |
Code formatter | Opinionated Python formatter (fast + safe) |
ruff |
Linter + Formatter | All-in-one linting (super fast, written in Rust) |
poetry |
Package manager | Modern dependency management + publishing |
pipenv |
Package manager | Dependency locking + venv in one |
cookiecutter |
Project scaffolding | Generate project boilerplates |
rich-cli |
Pretty CLI output | Render JSON, markdown, syntax-highlighted code |
glances |
System monitor | Real-time system resource viewer (cross-platform) |
pgcli |
PostgreSQL client | Auto-complete + syntax highlighting in terminal |
bpython |
Python REPL | Fancy REPL with autocomplete & docs |
ipython |
Advanced REPL | Interactive dev console with magic commands |
howdoi |
Quick answers | Searches StackOverflow from terminal |
doit |
Task runner | Better alternative to Makefiles for Python projects |
pdm |
Next-gen package manager | PEP 582 support (no venv needed) |
xonsh |
Shell + Python | Shell with full Python power |
yt-dlp |
YouTube downloader | Download and convert videos via CLI |
- It is a fast, multi-language package and environment manager built on top of the Conda ecosystem.
-
Run the powershell command
powershell -ExecutionPolicy ByPass -c "irm -useb https://pixi.sh/install.ps1 | iex"
I found an issue while working on jupyter notebook with multiple pixi environment, when I tried to select kernel it does not allow to select manually it only allows the auto listed ones, to solve this issue I tried some extension and found a good one that actually work which is Pixi Code by renan-r-santos
-
It will auto detect the parent virtual environment
-
To work with multiple environment we can either use the python environment tab and select it from there or create a
.vscodefolder and inside this folder a file namedsettings.jsonand write the following structure to find that specific environment in the jupyter kernel{ "python-envs.pythonProjects": [ { "path": "Module 32 - Feature Engineering/Day 61 - Handling Missing Data/.pixi", "envManager": "ms-python.python:venv", "packageManager": "ms-python.python:pip" } ] }
Note
- There are some issue when first time running the cell
getActivatedEnvironmentVariables Errorto solve it just restart the kernel and run the cell again- Or use the python environment tab and select the one refers in
settings.jsonit will be more faster
-
Initial pixi
pixi init
-
Create environment
pixi install
-
Add package
pixi add 'python>=3.13.0,<3.14' jupyterlab -
Add package (when package not available in conda channels
--pypiis used)pixi add django --pypi
-
Add packages from
requirements.txt-
Create a file
add_to_pixi.cmd@echo off REM ----------------------------- REM Install packages from requirements.txt using Pixi REM Automatically adds --pypi if default install fails REM ----------------------------- SETLOCAL ENABLEDELAYEDEXPANSION SET "FILE=requirements.txt" FOR /F "usebackq delims=" %%A IN ("%FILE%") DO ( REM Get package name without version FOR /F "tokens=1 delims==" %%B IN ("%%A") DO ( echo Installing %%B... pixi add %%B IF !ERRORLEVEL! NEQ 0 ( echo "Failed to install %%B via default, trying with --pypi..." pixi add %%B --pypi ) ) ) echo All packages processed! pause
-
Now run
add_to_pixi.cmd
-
-
Remove package
pixi remove django --pypi
-
Remove pixi environment
pixi clean
-
List all install packages
pixi list
-
Activate environment shell
pixi shell
-
Exit environment shell
exit -
Run command
pixi run python --version pixi run jupyter lab
- Default, lightweight, and comes with Python.
-
It is installed by default with Python >= 3.4
-
Update pip
python -m pip install pip --upgrade
-
Installing a package
pip install <package-name>
-
Installing specific version
pip install <package-name>==<version>
-
Installing from a requirements file
pip install -r requirements.txt
-
Saving current packages to a requirements file
pip freeze > requirements.txt -
Updating multiple packages
pip install -r requirements.txt --upgrade
-
Uninstalling a package
pip uninstall <package-name>
-
Listing installed packages
pip list
-
Checking outdated packages
pip list --outdated
-
Showing info about a package
pip show <package-name>
-
It is added in
3.3python -
Official docs
-
Creating a virtual environment
py -m venv env
here
envis the name of thevenvalso path can be provided here -
Activating the virtual environment
env\Scripts\activate
-
Deactivating the virtual environment
deactivate
-
Deleting a virtual environment
rd /s /q env
-
Check all available python
py -0
-
Specify alternative Python executable
C:\Python312\python.exe -m venv .venv
-
Create
venvwith different python version (PYLAUNCHER_ALLOW_INSTALLpermission required)py -3.12 -m venv .venv
-
Create multiple venv
py -m venv env1 env2 env3
-
venvcommand-line option(flags)-
Upgrade existing venv
py -m venv --upgrade .venv
-
Upgrade
pipsetuptoolspy -m venv --upgrade-deps .venv
-
Without pip
py -m venv --without-pip .venv
-
For advanced usage
--copies,--symlinksare used but not recommended on Windows -
Custom prompt name
py -m venv --prompt myproject .venv
-
Clear existing environment
py -m venv --clear .venv
-
Create environment with access to system packages
py -m venv --system-site-packages .venv
-
- It is a minimal, community-driven Conda distribution that includes both the
condaandmambapackage managers, with theconda-forgechannel set as the default source for packages.
- Ideal for data science and scientific computing. It manages packages, environments, and dependencies effectively across platforms.
- Since it is included with Miniforge3, there is no need to install it separately. However, if needed, download and install Miniconda (a lightweight Conda distribution) or Anaconda (which includes many pre-installed packages).
| Task | Command |
|---|---|
| Env in miniconda envs path | conda create -n myenv python=3.11 |
| Env in current path | conda create -p myenv python=3.11 |
| Activate environment | conda activate myenv |
| Deactivate environment | conda deactivate |
| List all environments | conda env list or conda info --envs |
| Install package | conda install numpy |
| Install specific version | conda install pandas=1.5.3 |
| Remove package | conda remove package_name |
| Update package | conda update scipy |
| Update all package | conda update --all |
| Export environment | conda env export > environment.yml |
| Recreate env from file | conda env create -f environment.yml |
| Delete environment | conda remove --name myenv --all |
-
Install packages from
requirements.txtconda install --yes --file requirements.txt
Note
-
Prefer
conda installwhen available to avoid dependency conflicts. -
Use
pip installwithin a conda environment if a package isn't available via conda.
- It is a fast, drop-in replacement for
condawritten in C++ - It is included by default in
Miniforgeversions23.3.1-0and above. - All commands are compatible with
conda, so simply replacing conda withmambawill work seamlessly.
- Modern package and virtual environment manager.
- Installer
- Download and install
- Using pipx
pipx install hatch
-
Create hatch project
hatch new hatch-project
-
Create environment
hatch env create
-
Activate and use the environment
hatch shell
-
Exit from environment
exit -
Remove environment
hatch env prune
-
View list of environment
hatch env show
-
Project version check
hatch version
-
Change project version
hatch version minor # patch, minor, major
- Alternative to
venvwith more features.
-
Using pipx
pipx install virtualenv
-
Creating env
virtualenv env
-
Activating env
env\Scripts\activate
-
Deactivate env
deactivate
- Universal version manager supporting Python and other languages.
- Helper for managing
virtualenvenvironments easily.
-
Using
pipxpipx install virtualenvwrapper-win
| Purpose | Command |
|---|---|
| Create & activate a new virtualenv | mkvirtualenv myenv |
| List or activate virtualenvs | workon myenv |
| Delete a virtualenv | rmvirtualenv myenv |
| Go to the directory of the current env | cdvirtualenv |
Go to site-packages of current env |
cdsitepackages |
| List packages installed in current env | lssitepackages |
| List all virtualenvs | lsvirtualenv |
Add folders to PYTHONPATH of active env |
add2virtualenv path\to\folder |
| Allow/disallow global packages in current env | toggleglobalsitepackages |
| Create a project directory and virtualenv | mkproject myproject |
| Go to the directory of the current project | cdproject |
| Link a project directory to the current virtualenv | setprojectdir D:\myproject |
| Used internally for deletion | folder_delete D:\Env\myenv |
| Locate the current virtualenv's base directory | whereis |
| Lists env variables for the current env | vwenv |
- Minimalistic package builder and publisher.
-
Using
pipxpipx install flit
-
Initial project
flit init
-
Publish package to PyPI
flit publish