Creating a Python Environment with Poetry and uv
Modern Python projects frequently rely on tools that manage dependencies and virtual environments. Two common tools are Poetry and uv. Poetry is used for dependency management and packaging, while uv provides a very fast installer and environment manager.
1. Install Poetry
Poetry can be installed using the official installer:
curl -sSL https://install.python-poetry.org | python3 -
Verify installation:
poetry --version
2. Create a New Project
poetry new my_project
cd my_project
This will create a project structure similar to:
my_project/
├── pyproject.toml
├── README.md
├── src/
└── tests/
3. Add Dependencies
poetry add numpy pandas
Poetry automatically updates pyproject.toml and the lock file.
4. Install uv
uv is a fast Python package installer written in Rust.
curl -Ls https://astral.sh/uv/install.sh | sh
Check installation:
uv --version
5. Using uv to Install Dependencies
You can export dependencies from Poetry and install them using uv:
poetry export -f requirements.txt > requirements.txt
uv pip install -r requirements.txt
6. Running Code in the Environment
poetry shell
python script.py
This workflow combines Poetry's dependency management with uv's high-performance installation system.

