deno_python
I'm trying to use Python with Deno with https://deno.land/x/python@0.2.7
What should I do to enable import Python 3rd party module, should I create Python venv?
14 Replies
@load1n9
if you install the 3rd party extension to the used python version it should work
Is it like running a venv inside the Deno project?
nope its bindings to your installed python version
Oh so I need to install say, pandas globally?
yep
I see, thank youu
Another thing to try could be using python via pyodide. With deno's npm and
--node-modules-dir
support I found you can leverage pyodide and the libraries compiled for it (the example there shows numpy):
https://github.com/pyodide/pyodide/issues/3420#issuecomment-1542742906GitHub
Deno support · Issue #3420 · pyodide/pyodide
Deno support was discussed in #1477 (comment) and I think it would be good to add it and have some minimal tests in CI. As discussed in the linked PR only a few minor fixes are needed. I'll ope...
deno_python supports all python modules because it just talks to the interpreter, I feel like these are different use cases for sure
Seems like the use case is pretty similar, leverage some python libraries and code in a deno app, but the tradeoffs in implementation are different, python that runs inside the deno sandbox as webassembly vs global / system installed python.
There is a fair number of libraries available in pyodide but true that it's not everything available on a system: https://pyodide.org/en/stable/usage/packages-in-pyodide.html
fair enough
There is a PR I made for installing and importing pip packages for deno_python too! https://github.com/denosaurs/deno_python/pull/43 I realized I need to fix some name normalization which I have on my other computer so you will have to wait a little longer but it uses the same environment as python so if
sys.path
in python contains the venv lib path it uses venv. (my pr does some magic and adds a deno path to the sys.path
)thanks for the update eliass