Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Using Third-party libraries

You want to use Python to execute your own Python code that require third party projects. You have many choices to do this!

General recommendations

We can give general advices:

Not recommended

Recommended

Few installation methods

Traditional workflow with venv and pip

python3 -m venv venv-for-something
. venv-for-something/bin/activate
pip install numpy

or in a project with a requirements.txt file:

python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt

Traditional workflow with conda

conda create -n venv-for-something
conda activate venv-for-something
conda install numpy

UV in a project using UV

In a project using UV, one can run

uv sync
. .venv/bin/activate

Pixi in a project using UV

In a project using Pixi, one can run

pixi shell

New environment using UV

Following the traditional workflow

uv venv .venv -p 3.13
. .venv/bin/activate
uv pip install numpy

Standard UV workflow:

uv init
uv add numpy
. .venv/bin/activate

New environment using Pixi

pixi init
pixi add numpy
pixi shell

Environments with install-locked-env

install-locked-env is a tool that install locked environments in a local directory. It uses UV or Pixi so it is very fast. It can be used for example to install locally the main environment of this Python training:

uvx install-locked-env https://foss.heptapod.net/py-edu-fr/py-edu-fr

or to install a good environment to work with the Computational Fluid Dynamics framework Fluidsim:

uvx install-locked-env https://github.com/fluiddyn/fluidsim/tree/branch/default/pixi-envs/env-fluidsim