Open ntindle opened 4 months ago
You can see our attempts at debugging this in https://github.com/Significant-Gravitas/AutoGPT/actions/runs/9969740139/job/27547269902?pr=7406 in this pipeline with the msi artifact available here: https://github.com/Significant-Gravitas/AutoGPT/actions/runs/9969740139?pr=7406
Repro steps and repo here: https://github.com/ntindle/cx_freeze_prisma_reproduction
It is worth pointing out you MUST build in ci (or another PC), as your paths will be valid from the poetry install in the repo once you run cx_freeze.
Hey @ntindle, thanks for the detailed reproduction steps, it's much appreciated.
Unfortunately I won't have time to debug this deeply soon but I suspect you should be able to reproduce this locally by deleting / moving the downloaded binaries to a separate dir before running the app. This should replicate a "fresh install" environment, like any users of your app would have.
You can identify where the binaries are by running prisma py version
& it'll be the last entry shown, binary cache dir
.
Please let me know if I can be of any more help.
Any idea how you would run the prisma py version with the correct python
using python -m
as a prefix works for me on macos, e.g. python -m prisma py version
That uses the version from cx freeze?
ah sorry I misunderstood, that shouldn't matter for just determining the location of the binary cache as it's just dependent on the current user.
So with @marcelotduarte 's help I was able to get the DB "running" but hit
{"is_panic":false,"message":"Error querying the database: Error code 14: Unable to open the database file","backtrace":" 0: <unknown>\n 1: <unknown>\n 2: <unknown>\n 3: <unknown>\n 4: <unknown>\n 5: <unknown>\n 6: <unknown>\n 7: <unknown>\n 8: BaseThreadInitThunk\n 9: RtlUserThreadStart\n"}
@ntindle you will likely have to apply migrations (i.e. creating the database file) before attempting to connect, are you doing that?
I'm attempting that and it seems to work with Postgres but not SQLite
š I suspect there's some mismatch with where the sqlite db is created.
Unfortunately it looks like there currently aren't any debug logs showing the file path. Will fix that.
You could try manually specifying the absolute file path programmatically, https://prisma-client-py.readthedocs.io/en/stable/reference/client/#datasource-overriding.
Bug description
For background, cx_freeze works by freezing all the required files for a Python program into an installable and executable package. When you run cx_freeze over a Prisma python project, it fails to copy in some files and errors on the following.
You can set the params of prisma python using the following env when freezing to get the files included, and again when loading the binary but this still fails to run. Settings in the build pipeline
Then rename
query-engine-windows.exe
toprisma-query-engine-windows.exe
inprisma/node_modules/prisma
Error:
How to reproduce
Quite detailed reproduction steps and repo here: ntindle/cx_freeze_prisma_reproduction
Expected behavior
cx_Freezing a Prisma project works easily without configuration and can be run without configuration. Otherwise, with config, it can work on a machine that did not have Prisma installed before
Prisma information
Environment & setup