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 :
python -c "import pdfkit"
=> OK
At the end, I try to create a Python Node with the “pdfkit”…
import pyodide_js
await pyodide_js.loadPackage('pdfkit')
ERROR: JsException: Error: No known package with name ‘pdfkit’
import pdfkit
ERROR: ModuleNotFoundError: No module named ‘pdfkit’
I have also used the field defining the imported libraries :
ERROR: Traceback (most recent call last): File "/lib/python3.10/asyncio/futures.py", line 201, in result raise self._exception File "/lib/python3.10/asyncio/tasks.py", line 234, in __step result = coro.throw(exc) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 573, in install await transaction.gather_requirements(requirements) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 333, in gather_requirements await gather(*requirement_promises) File "/lib/python3.10/asyncio/futures.py", line 284, in __await__ yield self # This tells Task to wait for completion. File "/lib/python3.10/asyncio/tasks.py", line 304, in __wakeup future.result() File "/lib/python3.10/asyncio/futures.py", line 201, in result raise self._exception File "/lib/python3.10/asyncio/tasks.py", line 232, in __step result = coro.send(None) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 340, in add_requirement return await self.add_requirement_inner(Requirement(req)) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 432, in add_requirement_inner metadata = await _get_pypi_json(req.name, self.fetch_kwargs) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 48, in _get_pypi_json metadata = await fetch_string(url, fetch_kwargs) File "/lib/python3.10/site-packages/micropip/_compat_in_pyodide.py", line 35, in fetch_string return await (await pyfetch(url, **kwargs)).string() File "/lib/python3.10/pyodide/http.py", line 251, in pyfetch url, await _jsfetch(url, to_js(kwargs, dict_converter=Object.fromEntries)) NameError: name '_jsfetch' is not defined
what did I forget ?
Thanks