# Python node \[GOT CREATED\]

**URL:** <https://community.n8n.io/t/python-node-got-created/5827>\
**Category:** Feature Requests (done)\
**Created:** [May 18, 2021, 6:05am UTC](https://community.n8n.io/t/python-node-got-created/5827 "2021-05-18T06:05:29Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![sackoh](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/sackoh/32/18308_2.png) [@sackoh](https://community.n8n.io/u/sackoh)\
**Post date:** [February 2, 2023, 5:41am UTC](https://community.n8n.io/t/python-node-got-created/5827/21 "2023-02-02T05:41:14Z")

</div>

COOL!!! 🕶  
@jan  
I’m currently working on developing AI models and want to connect AI models deployed on local device or cloud with `n8n`  
Python is my main programming language. 😄 I am waiting for your wonderful project!

Thanks for all you attending these!! 🤲

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [February 3, 2023, 11:51pm UTC](https://community.n8n.io/t/python-node-got-created/5827/22 "2023-02-03T23:51:10Z")

</div>

OK, the first beta version is ready to be tested.

Example command to start it:

```auto
docker run -it --rm --name n8n -p 5678:5678 -v ~/.n8n:/home/node/.n8n n8nio/n8n:PR-4295-python-code-node

```

There is now an additional setting in the Code-Node where `Python` can be selected:

 ![Screenshot from 2023-02-03 17-31-05](https://europe1.discourse-cdn.com/n8n/original/3X/2/6/26564aaefe8bdb448ef418551c1ac67babbf701a.png)

### A few important things to consider:

- This is a beta. So there are probably still issues. It is also possible that things will change in the final production version. So workflows that get created now may not work in the production version without modifications.
- We did not do a security review yet. That means you should not give users you do not trust access to an n8n instance with this n8n version running.
- The Python editor is very basic. It only provides syntax highlighting but not the more fancy things like auto-complete or lining like the JavaScript version does.

### Regarding usage

The variables that are available are identical between JavaScript and Python. But because of variable naming restrictions in Python do they not start with `$` but rather with `_`. So it is for example `_input.all()`, `_input.first().json`, `_itemIndex`, `_workflow`, and so on.

So give it a try and please share with us any feedback you have and problems you face. Also if you tried it, but did not face any issues and have no feedback. Then we know that one more person tested it, which is also an important data point.

Thanks a lot for your help and support!

---

<div class="post-metadata">

**Author:** ![d4vidsha](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/d4vidsha/32/24617_2.png) [@d4vidsha](https://community.n8n.io/u/d4vidsha)\
**Post date:** [February 4, 2023, 1:39am UTC](https://community.n8n.io/t/python-node-got-created/5827/23 "2023-02-04T01:39:24Z")

</div>

This is huge 😍

---

<div class="post-metadata">

**Author:** ![symn](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/symn/32/4772_2.png) [@symn](https://community.n8n.io/u/symn)\
**Post date:** [February 5, 2023, 8:12pm UTC](https://community.n8n.io/t/python-node-got-created/5827/24 "2023-02-05T20:12:46Z")

</div>

Nice to see that this is getting implemented! I need to get back into n8n and to all the stuff I planed to do. 😀

---

<div class="post-metadata">

**Author:** ![sackoh](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/sackoh/32/18308_2.png) [@sackoh](https://community.n8n.io/u/sackoh)\
**Post date:** [February 6, 2023, 2:09am UTC](https://community.n8n.io/t/python-node-got-created/5827/25 "2023-02-06T02:09:46Z")

</div>

@jan  
Happy to see the first beta version! ☺  
I will give you a feedback after testing it!!!

---

<div class="post-metadata">

**Author:** ![Boris\_Idesman](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/boris_idesman/32/17797_2.png) [@Boris\_Idesman](https://community.n8n.io/u/Boris_Idesman)\
**Post date:** [February 6, 2023, 4:05pm UTC](https://community.n8n.io/t/python-node-got-created/5827/26 "2023-02-06T16:05:26Z")

</div>

Hi @jan ,  
Two things I noticed:

1. The node takes significantly longer time for its code to complete with python, than it’s javascript version.
2. How can we add modules? `import requests` does not work.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [February 7, 2023, 4:26am UTC](https://community.n8n.io/t/python-node-got-created/5827/27 "2023-02-07T04:26:37Z")

</div>

Thanks a lot for giving it a try @Boris_Idesman and giving feedback. Is very appreciated.

1. Yes, that is sadly expected and will always be the case as there is overhead running the Python code.
2. Played around some more and made some modifications. Please pull the same image again from dockerhub to get the latest version. It includes now a parameter called “Python Module”. There you can enter the names of the modules that should be able to be imported. We will iterate how we want to solve that long-term. So you can for example type in `opencv-python` that you can then import `cv2` via `import cv2`. Be however aware, that you can only import modules that you installed before (if there are non standard ones). So if you want to use opencv, you first have to install it via pip. So you would need a custom image. If you want you could use `n8nio/n8n:PR-4295-python-code-node` as the base.

Also important to mention is that n8n uses [pyodide](https://pyodide.org/) underneath the hood. You can find more information about loading packages [here](https://pyodide.org/en/stable/usage/loading-packages.html).

---

<div class="post-metadata">

**Author:** ![sackoh](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/sackoh/32/18308_2.png) [@sackoh](https://community.n8n.io/u/sackoh)\
**Post date:** [February 8, 2023, 1:05am UTC](https://community.n8n.io/t/python-node-got-created/5827/28 "2023-02-08T01:05:07Z")

</div>

Hi @Boris_Idesman ,  
I’m also struggling with importing `requests` and other packages.

Thanks to the @jan 's mention about n8n uses pyodide, I can figure out why I cannot import it.  
you can refer [this](https://lwebapp.com/en/post/pyodide-fetch).

and packages supported by pyodide only could be used at this moment I figured out.

---

<div class="post-metadata">

**Author:** ![Boris\_Idesman](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/boris_idesman/32/17797_2.png) [@Boris\_Idesman](https://community.n8n.io/u/Boris_Idesman)\
**Post date:** [February 22, 2023, 9:22am UTC](https://community.n8n.io/t/python-node-got-created/5827/29 "2023-02-22T09:22:48Z")

</div>

Apart from this I think the python node works very well - any ETA when it will be released?

---

<div class="post-metadata">

**Author:** ![Ruslan\_Yanyshyn](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ruslan_yanyshyn/32/15080_2.png) [@Ruslan\_Yanyshyn](https://community.n8n.io/u/Ruslan_Yanyshyn)\
**Post date:** [April 28, 2023, 8:50pm UTC](https://community.n8n.io/t/python-node-got-created/5827/30 "2023-04-28T20:50:21Z")

</div>

Hello there,  
Is there any news on the release date?

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [April 29, 2023, 6:38am UTC](https://community.n8n.io/t/python-node-got-created/5827/31 "2023-04-29T06:38:16Z")

</div>

It will officially be released end of June with n8n v1.0. It will, however, probably already be merged within the next 1-2 weeks but will only be available if a special v1-pre-release environment variable gets set. That gives us some time to test its quality, stability and security.

---

<div class="post-metadata">

**Author:** ![home](https://avatars.discourse-cdn.com/v4/letter/h/b5a626/32.png) [@home](https://community.n8n.io/u/home)\
**Post date:** [May 2, 2023, 7:23pm UTC](https://community.n8n.io/t/python-node-got-created/5827/32 "2023-05-02T19:23:30Z")

</div>

Hello jan,  
I have opened a topic about no-standard library for Python.

> [@Import python library with n8nio/n8n:PR-4295-python-code-node : Not found](http://community.n8n.io/t/import-python-library-with-n8nio-n8n-pr-4295-python-code-node-not-found/25709):
>
> Hello, I have created from n8nio/n8n:PR-4295-python-code-node a new image for using Python Node and some customs library… FROM n8nio/n8n:PR-4295-python-code-node WORKDIR /data COPY requirements.txt requirements.txt USER root RUN apk add --update py-pip automake gcc g++ subversion python3-dev RUN pip3 install -r requirements.txt requirements.txt : Contains “pdfkit” I build the image, named n8n-python : docker build -t n8n-python -f DockerFile . After that, I run it, and open a terminal …

Can you just give me information how to add custom library ? Because it’s not knew for n8n ?  
Thank you

---

<div class="post-metadata">

**Author:** ![Locos](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/locos/32/14213_2.png) [@Locos](https://community.n8n.io/u/Locos)\
**Post date:** [May 9, 2023, 8:10am UTC](https://community.n8n.io/t/python-node-got-created/5827/33 "2023-05-09T08:10:09Z")

</div>

Hi @jan,

Thanks to keep us informed.

In which version it will be provided ? I can’t found any “python” in the release changelogs.  
I’m currently facing many performance issue using the naskio python node. It would be great if I can have a try on a (almost) stable version of your official python node code. I’ll be able to provide you feedbacks

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [May 9, 2023, 8:31am UTC](https://community.n8n.io/t/python-node-got-created/5827/34 "2023-05-09T08:31:37Z")

</div>

The code got merged last week and it will be released with the next version (`n8n@0.228.0`) on Wednesday. But as mentioned, will it not be available by default. One way to use it would then be to copy a Code-Node in a Text-Editor, manually change the `typeVersion` to `2`, copy it the Node-JSON, and then paste it into n8n.

We are also in the process of releasing the first v1 release candidates, which will have it enabled by default (so it will always create Code-Nodes of version 2). Those images will be auto-generated every night and named: `docker.n8n.io/n8nio/n8n:1.0.0-rc`. That will however take probably another 1-3 days.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [May 10, 2023, 8:52am UTC](https://community.n8n.io/t/python-node-got-created/5827/35 "2023-05-10T08:52:22Z")

</div>

> [@jan](#):
>
> Those images will be auto-generated every night and named: `docker.n8n.io/n8nio/n8n:1.0.0-rc`. That will however take probably another 1-3 days.

fyi: The image is now available.

---

<div class="post-metadata">

**Author:** ![forsalebypwner](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/forsalebypwner/32/25380_2.png) [@forsalebypwner](https://community.n8n.io/u/forsalebypwner)\
**Post date:** [May 14, 2023, 8:59pm UTC](https://community.n8n.io/t/python-node-got-created/5827/36 "2023-05-14T20:59:24Z")

</div>

Thrilled to see this officially being added. I’ve been using my own fork of @naskdev ‘s image for a while now, so it’ll be nice to have it officially added. Thanks for everybody’s hard work on this!!

---

<div class="post-metadata">

**Author:** ![sirdavidoff](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/sirdavidoff/32/2423_2.png) [@sirdavidoff](https://community.n8n.io/u/sirdavidoff)\
**Post date:** [May 19, 2023, 9:41am UTC](https://community.n8n.io/t/python-node-got-created/5827/37 "2023-05-19T09:41:36Z")

</div>

Python support is now in the main release (although hidden by default): [Python Support and Release Versions](http://community.n8n.io/t/python-support-and-release-versions/26291)

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [May 25, 2023, 11:39am UTC](https://community.n8n.io/t/python-node-got-created/5827/38 "2023-05-25T11:39:07Z")

</div>

New version [`n8n@0.228.2`](https://github.com/n8n-io/n8n/releases/tag/n8n%400.228.2) got released which includes the [GitHub PR 4295](https://github.com/n8n-io/n8n/pull/4295).

---

<div class="post-metadata">

**Author:** ![jreyesr](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jreyesr/32/22452_2.png) [@jreyesr](https://community.n8n.io/u/jreyesr)\
**Post date:** [May 25, 2023, 11:53pm UTC](https://community.n8n.io/t/python-node-got-created/5827/39 "2023-05-25T23:53:39Z")

</div>

Hello! I think I may have found a bug in the new Python code node, where Python code is not saved once the configuration dialog is dismissed.

When I edit Python code, then press Escape or otherwise dismiss the configuration dialog, and then open it again, the field that holds the source code is reset to the sample Python code.

I have managed to reproduce it in two completely separate N8N instances, both running v0.228.2 on Docker. It only happens when using the Code node with typeVersion set to 2 and Language set to Python (Javascript with typeVersion 2 is not affected)

Would you like me to post more detailed reproduction steps here, or on a new thread, or as a Github issue? It should be really easy to reproduce: create a Python code node, edit it (say, delete the comment on the first line), close and reopen the dialog, the comment should be back.

As an aside: that’s a really neat functionality, thank you! Adding Python scripts should really extend the range of people that can easily pick up N8N.

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [May 27, 2023, 6:27pm UTC](https://community.n8n.io/t/python-node-got-created/5827/40 "2023-05-27T18:27:16Z")

</div>

Hey @jreyesr,

Can you open a new thread for it and complete the template with the detailed steps.

[Previous page](https://community.n8n.io/t/python-node-got-created/5827.md?page=1)

[Next page](https://community.n8n.io/t/python-node-got-created/5827.md?page=3)
