N8N + HOSTINGER + Exec command + Script Python

Hi,

I try to execute a python script in my Exec command Node.
Unfortunately, it does not work.

Content of python script :
print(“Hello”)

Describe the problem/error/question

The error message
Command failed: python3 /home/user/hello.py /bin/sh: python3: not found

The script is wowrking well on the server.

Please share your workflow

Share the output returned by the last node

Command failed: python3 /home/user/hello.py /bin/sh: python3: not found

Information on your n8n setup

  • n8n version: 1.95 Self Hosted on a HOSTINGER Server. n8n
  • Database (default: SQLite): n/a
  • n8n EXECUTIONS_PROCESS setting (default: main): n/a
  • Running n8n via (Docker): yes
  • Operating system: Ubuntu 24.04

Thank you for your help

Python is not installed in the n8n container image. If you want/need to do this, you would have to build and use a derivative of the n8n image with python added to it with a Dockerfile like this:

ARG tag=latest
FROM n8nio/n8n:$tag
USER root
RUN apk update
RUN apk add python3
USER node
1 Like

Thank you for your help.

I used it but some issue. I had to use another way by updating directly the n8n image with python.

docker exec -u root -it root-n8n-1 sh -c “apk add --no-cache python3 py3-pip”

docker exec -u root -it root-n8n-1 sh -c "
python3 -m venv /tmp/n8n-python &&
. /tmp/n8n-python/bin/activate &&
pip install pandas &&
deactivate
"

Now, I’m looking how to access to /home/node/ from the n8n node.

1 Like

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