How do i install new python packages in the hosted image #108
Replies: 2 comments 1 reply
-
|
Step-by-step guide:
requirements.txt Example: Note: Specify package versions for better reproducibility.
Dockerfile Example: Dockerfile
Before (Example): YAML If you were running n8n with a simple docker run command, replace n8nio/n8n:latest with my-n8n-python.
If using Docker Compose: Bash If using Docker Run (stop and start): Stop the old container: Run the new container (using your new image): Your n8n container is now running with all the Python packages from your requirements.txt installed and available for use in nodes like the Execute Command node (using python3) or the Code node (if you've configured a custom Python task runner). |
Beta Was this translation helpful? Give feedback.
-
|
@AryanMithbawkar Sharing this here as a potential solution since it’s not mentioned in the thread: You can let n8n run Docker commands by mounting the host Docker socket + making the Docker CLI available inside the n8n container. Example: n8n:
...
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /usr/local/bin/docker:/usr/local/bin/docker
user: root # or match the docker group GIDThen n8n’s Execute Command node can run
This works well for local/self-hosted setups, but obviously comes with the usual Docker-socket security caveats. Still, it’s a simple and effective way to let workflows manage containers directly. Curious what others (especially @aldifayol) think about including this as an optional/advanced example. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
i want to install new packages in python environment of the n8n image how do i do so
Beta Was this translation helpful? Give feedback.
All reactions