n4thyra

n4thyra

Hello,

I’m trying to get my app working on Windows and I can’t figure out what the issue is. Everything works flawlessly on Linux(Xubuntu) but when I’m trying to run my app on Windows I’m constantly getting these errors. It looks like Phoenix can’t spawn python3 instances, but I don’t know why. I am 100% sure that python3 is installed and matches the path that Phoenix is trying to use.

Hasn’t anyone run into a similar issues on Windows?
Any ideas?

$ python -V
Python 3.10.2

[error] GenServer #PID<0.631.0> terminating
** (stop) :enoent
    erlang.erl:2217: :erlang.open_port({:spawn, 'c:\\Users\\Jiri\\AppData\\Local\\Microsoft\\WindowsApps\\python3.exe -V'}, [{:line, 80}, :stderr_to_stdout, :hide])
    (erlport 0.10.1) c:/Users/Jiri/Desktop/Phoenix/Pluto/phx/deps/erlport/src/erlport_options.erl:227: :erlport_options.get_version/1
    (erlport 0.10.1) c:/Users/Jiri/Desktop/Phoenix/Pluto/phx/deps/erlport/src/python_options.erl:177: :python_options.check_python_version/1
    (erlport 0.10.1) c:/Users/Jiri/Desktop/Phoenix/Pluto/phx/deps/erlport/src/python_options.erl:161: :python_options.find_python/1
    (erlport 0.10.1) c:/Users/Jiri/Desktop/Phoenix/Pluto/phx/deps/erlport/src/python_options.erl:146: :python_options.get_python/1
    (erlport 0.10.1) c:/Users/Jiri/Desktop/Phoenix/Pluto/phx/deps/erlport/src/python_options.erl:88: :python_options.parse/2
    (erlport 0.10.1) c:/Users/Jiri/Desktop/Phoenix/Pluto/phx/deps/erlport/src/python.erl:168: :python.start/3
    (pluto 0.1.0) lib/pluto/image/pil_worker.ex:112: Pluto.Image.PilWorker.handle_info/2
    (stdlib 3.12) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib 3.12) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib 3.12) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:create_port, "c:/Users/Jiri/Desktop/Phoenix/Pluto/phx/_build/dev/lib/pluto/priv/python"}
State: %{arg: "c:/Users/Jiri/Desktop/Phoenix/Pluto/phx/_build/dev/lib/pluto/priv/python", max_size: nil, port: nil}

Showing Posts 1 to 10

03juan

03juan

I have 0 experience with Windows Elixir and Python.

You cmd line example calls python but the error calls python3.exe. Are you sure the file name is correct and exists at that path?

n4thyra

n4thyra OP

My bad, sorry! Either way, both python3 and python output the same result

$ python3 -V
Python 3.10.2
$ python -V
Python 3.10.2

python3.exe does exist inside the folder and even outputs the same result

$ c:\\Users\\Jiri\\AppData\\Local\\Microsoft\\WindowsApps\\python3.exe -V
Python 3.10.2

I’m honestly confused why it’s not working.
I can’t even run python calling

:erlang.open_port({:spawn, 'python -V'}, [{:line, 80}, :stderr_to_stdout, :hide])
 or
:erlang.open_port({:spawn, 'python3 -V'}, [{:line, 80}, :stderr_to_stdout, :hide]) 
03juan

03juan

There may be a $PATH issue.

Have you tried?

path = "C:\\Users\\Jiri\\AppData\\Local\\Microsoft\\WindowsApps\\python3.exe"
Port.open({:spawn_executable, path}, [:binary, args: ["-V"]])
n4thyra

n4thyra OP

This solution does not work, either.

C:\Users\Jiri>iex
Interactive Elixir (1.13.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> path = "C:\\Users\\Jiri\\AppData\\Local\\Microsoft\\WindowsApps\\python3.exe"
"C:\\Users\\Jiri\\AppData\\Local\\Microsoft\\WindowsApps\\python3.exe"
iex(2)> Port.open({:spawn_executable, path}, [:binary, args: ["-V"]])
** (ErlangError) Erlang error: :enoent
    erlang.erl:2217: :erlang.open_port({:spawn_executable, "C:\\Users\\Jiri\\AppData\\Local\\Microsoft\\WindowsApps\\python3.exe"}, [:binary, {:args, ["-V"]}])
iex(2)>

03juan

03juan

Curious. And what do you get from System.find_executable("python") as per `'Port - spawn_executable docs?

n4thyra

n4thyra OP

The output is following

iex(2)> System.find_executable("python")
"c:/Users/Jiri/AppData/Local/Microsoft/WindowsApps/python.exe"
03juan

03juan

Ah ok I see, try to use that output.

path = System.find_executable("python")
Port.open({:spawn_executable, path}, [:binary, args: ["-V"]])

I think it was my fault for misunderstanding the way erlang output the path name vs. elixir.

kartheek

kartheek

Environment variable ERLPORT_PYTHON can be set to python interpreter path. ErlPort tries to pick up from this env variable by default.

n4thyra

n4thyra OP

Sadly, no luck. It gives the same error.

iex(1)> path = System.find_executable("python")
"c:/Users/Jiri/AppData/Local/Microsoft/WindowsApps/python.exe"
iex(2)> Port.open({:spawn_executable, path}, [:binary, args: ["-V"]])
** (ErlangError) Erlang error: :enoent
    erlang.erl:2217: :erlang.open_port({:spawn_executable, "c:/Users/Jiri/AppData/Local/Microsoft/WindowsApps/python.exe"}, [:binary, {:args, ["-V"]}])
n4thyra

n4thyra OP

It may be a dumb question, but how can I change the path?
However, even the current path points to a valid path.

Where Next? Top

Trending in Questions Top

Hellowman
Hello everyone! I am new to coding with Elixir/Erlang. And i am looking for some utilities for fuzzing testing like AFL++. Does anyone ...
New
yarrichar
I’m very new to Elixir, so sorry if this is a silly question: I am wondering what happens to the mailbox of a process when the machine i...
New
pragdave
How do I tell Hologram not to escape HTML when substituting into templates? {Textile.render(@product.long_description)} escapes the HTM...
New
Fl4m3Ph03n1x
Background When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error: * assembling mark...
New
mandar1045
I load tested a plain Phoenix chat app backed by Postgres with 100 million messages in it, everything on default settings, to see what br...
New
rlipscombe
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
saleyn
Is there a way to import record definitions in the iex shell for pretty printing (similar to the rr command in the erl shell)? This woul...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews