Python Virtualenv Setup¶
barrel_embed requires Python with specific packages. Using a virtualenv is recommended.
Quick Start¶
# Using uv (recommended - fast)
./scripts/setup_venv.sh
# Or manually
uv venv .venv
uv pip install -r priv/requirements.txt --python .venv/bin/python
Usage in Erlang¶
Installing uvloop (Optional Performance Boost)¶
uvloop provides a faster asyncio event loop. It's optional but recommended on Linux/macOS:
# Add uvloop to an existing venv
uv pip install uvloop --python .venv/bin/python
# Or use the full requirements file
uv pip install -r priv/requirements-full.txt --python .venv/bin/python
When uvloop is installed, barrel_embed automatically uses it. Check the logs for:
Note: uvloop is not available on Windows.
Requirements Files¶
| File | Contents |
|---|---|
priv/requirements.txt |
Default: barrel_embed + sentence-transformers + uvloop |
priv/requirements-minimal.txt |
Just barrel_embed + uvloop (no ML libs) |
priv/requirements-full.txt |
All providers + uvloop |
Custom Requirements¶
Create your own requirements file that extends the base:
Then setup:
For Dependent Applications¶
If your app (e.g., barrel_vectordb) uses barrel_embed as a dependency:
-
Create
priv/requirements.txtin your app: -
Setup venv in your app:
-
Pass venv to barrel_embed:
How Venv Activation Works¶
When you specify venv, barrel_embed sets these environment variables in the Python port:
VIRTUAL_ENV=/path/to/.venvPATH=/path/to/.venv/bin:$PATHPYTHONPATH=<priv_dir>
This is equivalent to running source .venv/bin/activate before starting Python.