Skip to content

Packages and virtual environments

Use third-party Python packages with Elide: create a Python 3.13 virtual environment, install packages with uv, and set VIRTUAL_ENV so Elide imports them.

On this page

Elide does not install PyPI packages in 1.6.0. It imports packages from a Python 3.13 virtual environment named by VIRTUAL_ENV.

SourceWhat Elide does
pyproject.toml [project] dependenciesNothing; [project.scripts] entry points run with elide run (Python Toolchain)
elide.pkl dependencies.pypiAccepts the declaration; elide install skips it (reference)
requirements.txtNothing
$VIRTUAL_ENV/lib/python3.13/site-packagesAdds it to sys.path

elide install --ecosystems=pypi prints elide install: pypi installs are not available in this build and exits 2.

Create a virtual environment

Create the environment with a Python 3.13 tool. With uv:

uv venv --python 3.13 .venv
uv pip install --python .venv/bin/python attrs

The environment’s own interpreter is only used to install packages; Elide runs the code.

Use it

# app.py
import attrs


@attrs.define
class Point:
    x: int
    y: int


print(Point(1, 2))
VIRTUAL_ENV=.venv elide python app.py
Point(x=1, y=2)

Activating the environment sets VIRTUAL_ENV too:

source .venv/bin/activate
elide run app.py

Without VIRTUAL_ENV, the import fails with ModuleNotFoundError: No module named 'attrs'.

Limits

  • The environment must be Python 3.13: Elide reads lib/python3.13/site-packages.
  • Pure-Python packages work. Some C extension modules do not load.
  • pip is not bundled, so elide python -m pip fails; install with the environment’s own tools.

Was this page helpful?