3 ms·
Please give me commands to create a virtual environment built with libraries listed in the requirements.txt of a GitHub repo. Ubuntu here.
by andrewinardeer 2y ago
Please give me commands to create a virtual environment built with libraries listed in the requirements.txt of a GitHub repo.
Ubuntu here.
- zanie 2y agoe.g. $ uv venv Using CPython 3.12.6 Creating virtual environment at: .venv Activate with: source .venv/bin/activate $ uv pip install -r https://raw.githubusercontent.com/astral-sh/uv/refs/heads/main/docs/requirements.txt Resolved 43 packages in 283ms Prepared 4 packages in 64ms Installed 43 packages in 445ms ...
- zahlman 2y agoFor comparison, with bare-bones tools (assuming `pip` is a globally-visible Pip version 22.3[0] or better): $ python -m venv --without-pip .venv $ pip --python .venv/bin/python install -r https://raw.githubusercontent.com/astral-sh/uv/refs/heads/main/docs/requirements.txt This venv creation is instantaneous, because it doesn't install Pip in the new venv. On my 10-year-old machine, with cached packages (it still has to unzip everything and move it around), the installation takes about 8.5 seconds. I have some wrapper scripts defined locally to smooth out this process; I can do `make-project-venv` (which puts the venv in `.local/.venv` and also attempts to install the current project with `pip --python ... install -e .`) and then `activate-local` and then `pipe install ...`. [0]: https://pip.pypa.io/en/stable/news/#v22-3 https://pip.pypa.io/en/stable/news/#v22-3