You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is probably user error but I was not able to get their sample hello world running with codon. It might be a dependency issue?
Here is the simpliest code I could come up with:
from python import fastapi as fast
from typing import Union
#from fastapi import FastAPI
app = fast.FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
I also tried without the decorator with the same error below:
codon run main.py
PyError: ((), ()) is not a callable object
Raised from: pyobj.exc_check:0
/root/.codon/lib/codon/stdlib/internal/python.codon:1198:13
Backtrace:
[0x7f37143126b7] pyobj.exc_check:0.882 at /root/.codon/lib/codon/stdlib/internal/python.codon:1198:13
[0x7f37143126f0] pyobj.exc_wrap:0[Ptr[byte],Ptr[byte]].883 at /root/.codon/lib/codon/stdlib/internal/python.codon:1201:9
[0x7f3714313a60] pyobj:pyobj.__call__:0[pyobj,Tuple[Partial.N.read_root:0[read_root:0,Tuple,KwTuple.N0]],KwTuple.N0].1033 at /root/.codon/lib/codon/stdlib/internal/python.codon:1225:68
[0x7f37143153d2] main.0 at /workspace/fast-api/main.py:11:1
Aborted
I made sure export CODON_PYTHON=/usr/lib/python3.12/config-3.12-x86_64-linux-gnu/libpython3.12.so is populated and other codon examples from the main site works on the machine. Im using ubuntu:latest docker container but was able to reproduce on a bare metal ubuntu machine as well.
Any ideas?
The text was updated successfully, but these errors were encountered:
Hi @michaelachrisco -- thanks for the question. For this type of use case, it probably makes more sense to use Codon's JIT mode, which would allow you to decorate functions you want to accelerate with @codon.jit and then run the code normally through Python. Another option would be to use Codon's Python extension backend, which would avoid any compilation overhead at runtime. Let me know if this makes sense or if I can clarify anything further!
See here:
I tried to get fast api working with codon. I like the idea of getting quite a bit of speed out of python.
fastapi/fastapi#10096
This is probably user error but I was not able to get their sample hello world running with codon. It might be a dependency issue?
Here is the simpliest code I could come up with:
I also tried without the decorator with the same error below:
Error:
I made sure
export CODON_PYTHON=/usr/lib/python3.12/config-3.12-x86_64-linux-gnu/libpython3.12.so
is populated and other codon examples from the main site works on the machine. Im using ubuntu:latest docker container but was able to reproduce on a bare metal ubuntu machine as well.Any ideas?
The text was updated successfully, but these errors were encountered: