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

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
water
I’m aware of 2 such projects, are there others? git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
bradley
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
Alvinkariuki
How Can I Optimise Compile Time Dependencies I have been building an elixir application for about 2 years now. Many modules and files ha...
New

Other Trending Topics Top

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
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
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
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews