Python ModuleNotFoundError in Code node

Describe the problem/error/question

Our n8n instance is self-hosted on k8s.
I tried to import a package called cryptography in my script, which exists in the list of available packages, but it throws an error.

I also tried other packages in the list, and they all throw the same error.

This was from [Bug Report][Self-Hosted n8n] Python ModuleNotFoundError in code node · Issue #16414 · n8n-io/n8n · GitHub

What is the error message (if any)?

ModuleNotFoundError: No module named ‘cryptography’ The module ‘cryptography’ is included in the Pyodide distribution, but it is not installed. You can install it by calling: await micropip.install(“cryptography”) in Python, or await pyodide.loadPackage(“cryptography”) in JavaScript See Loading packages — Version 0.28.2 for more details.

Information on your n8n setup

  • n8n version: 1.105.3
  • Database (default: SQLite): PostgreSQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): self-hosted on kubernetes
  • Operating system: Alpine Linux

Appears to be working for me:

Workflow

Hi @jabbson ,

Thank you for the reply! Which version of n8n were you using?

Hey @jolin

Ha, this is a very good question. Which version did I use two weeks ago?.. Most likely the latest stable there was at the time.