Trouble installing python packages in a dockerfile

Currently I am trying to build a custom n8n image in docker that has python packages built in, but I’m having trouble setting up a virtual environment for the packages.

Here’s my docker file:

FROM n8nio/n8n

USER root

RUN apk add --no-cache / python3 / py3-pip / python3-dev

RUN python3 venv /opt/venv

ENV PATH=”/opt/venv/bin:$PATH”

RUN pip install --no-cache-dir youtube-transcript-api

USER node

Im running on Ubuntu 24.04.3 LTS

I get the error that /opt/venv/bin directory doesn’t exist but I’m not sure where the virtual environments are kept on ubuntu.

Hey @smalldude hope all is good.

/opt/venv/bin doesn’t exist because it wasn’t created.
It wasn’t created because when you create a virtual environment you need the flag -m:

python3 -m venv /opt/venv

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.