SirWerto

SirWerto

Machine learning in Elixir

Good evening,
I am doing a machine learning application and unfortunately I can’t do it yet in Elixir (thank you for all your effort put in Nx:)). So, I decided to make a port (a bare port, not ErlPort) but I’m struggling with python envs.

Does anyone know how to launch a python program with a python environment activated in Elixir?

And for the people who deploy machine learning models in production, how do you do that?Thanks:)

Thanks! :smiley:

Marked As Solved

ImNotAVirus

ImNotAVirus

I have never tried it but I think that setting the environment variable PYTHONPATH should be enough.

If you’re using Port.open/2 you can try

port = Port.open({:spawn, cmd}, [:binary, {:env, [{'PYTHONPATH', '/path/to/your/venv/Lib/site-packages'}]}])

Also Liked

dtew

dtew

You may also find some goodness within @alvises blog here: Real-time Object Detection with Phoenix and Python

ImNotAVirus

ImNotAVirus

I made a mistake in my previous answer and I just corrected it. Try to use the PYTHONPATH and not PYTHONHOME variable.

Last Post!

SirWerto

SirWerto

Excellent post!! thank you, marked as solution too :slight_smile:

The forum only allow me to select one solution :cry: sorry

Where Next?

Popular in Questions Top

RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

We're in Beta

About us Mission Statement