Python Support and Release Versions

Good News Everyone…

Python support is now available as a beta feature but is hidden by default, To enable this you will need to either paste the node below into your workflow or copy a code node into a text editor and change typeVersion from 1 to 2 then paste it back in.

Some of you may have also noticed that the latest tag is no longer the only tag we have, We now have 2 tags in use for npm and docker, latest and next. Latest is the version that we currently consider to be the most stable and next is more of a beta release for those that want the newest features.

These versions should be updated every week depending on if there are any serious issues that have been reported and need to be fixed, By doing this we hope to deliver a more stable platform for all of our users.

If you have any questions on these let us know below :+1:

16 Likes

@Jon Thank you. Does it allow to import external libraries?

Hey @artildo,

Once you paste the node in and select the Python option there is an option for Python Modules this will then grab what it needs.

2 Likes

Important to mention that those Python modules have to get installed first with pip3.

Update: that is not correct. Scroll to: Python Support and Release Versions - #24 by jan

3 Likes

@Jon thank you

1 Like

Hey there,

I wanted to try python in n8n cloud. I copied the node, which worked fine, but when I change anything and leave the node settings it always fall back to the original code. It is impossible to change anything. See the attached video.

I tried both 0.231.0 (Latest Beta) and 0.230.2 cloud versions.

Screen Recording 2023-06-05 at 15.21.40

Thanks a lot for reporting that. It got already mentioned here before, and we have planned to release a fix soon.

1 Like

Hi there

I just tried n8n python :slight_smile:

Just a quick bug report : syntax recognition doesn’t seem to like script begining with “return”

Maybe github is a best place for this kind of bug report ?

1 Like

Hey @Valerian_Lebert,

Best to keep that here rather than GitHub so we can keep the issues for the early users in one place

New version [email protected] got released which includes the GitHub PR 6390.

Hi there

A quick question regarding installing module : should they be installed within N8N (with pip) or can they be installed on the host locally (I run a self hosted instance).

I tried to import a custom local module (locally installed) but it doesn not seem to work that way. That could be an issue as this module is not publicly available on a repository.

Hey @Valerian_Lebert,

My understanding is they would need to be installed in the container for it to be able to find them.

In my case, I run a npm installed instance on a private server.

I’ll try if rebooting N8N refresh the environment

Well I did a

pm2 restart n8n --update-env but my local package is still unavailable

I did try with a more common package (pandas), here is the log. I guess packege should be installed somehow within n8n. It seem to be running a WASM version (pyodide)

I wonder if dependencies should be installed on each execution ?

I was thinking of replacing a google cloud function by my n8n instance for development purpose, but it does not seem a good idea

What happens if you put the module name in the Python Modules box?

hows adding python modules going to work for us docker folks?

1 Like

still pretty cool, just a test

Can you share the steps you used to set up n8n with pm2? I have just given it a go and adding the pandas module to the list and importing it worked as expected.

@Jon and I did some debugging today. It looks like the problem has to do with the access rights to the folder node_modules/pyodide. Make sure that the user that runs n8n has write access to it.
Where exactly that folder can be found, depends on how you npm installed n8n and what OS. If globally and on Linux it can probably be found here: /usr/local/lib/node_modules/n8n/node_modules/pyodide

1 Like