Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prisma Python is missing binaries when frozen in CI but not locally #2509

Open
ntindle opened this issue Jul 17, 2024 Discussed in #2504 · 4 comments
Open

Prisma Python is missing binaries when frozen in CI but not locally #2509

ntindle opened this issue Jul 17, 2024 Discussed in #2504 · 4 comments

Comments

@ntindle
Copy link
Contributor

ntindle commented Jul 17, 2024

Discussed in #2504

Originally posted by ntindle July 15, 2024
When I freeze the Prisma python package as part of my CI using GitHub Actions, it has an error when run locally:

PS C:\Users\nicka> agpt_server.exe
Traceback (most recent call last):
  File "C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\autogpt-server-Hzddpd5Y-py3.10\src\cx_Freeze\cx_Freeze\initscripts\__startup__.py", line 141, in run
  File "C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\autogpt-server-Hzddpd5Y-py3.10\src\cx_Freeze\cx_Freeze\initscripts\console.py", line 25, in run
  File "autogpt_server\app.py", line 46, in <module>
  File "autogpt_server\app.py", line 34, in main
  File "autogpt_server\app.py", line 26, in run_processes
  File "autogpt_server\app.py", line 22, in run_processes
  File "D:\a\AutoGPT\AutoGPT\rnd\autogpt_server\autogpt_server\util\process.py", line 50, in start
  File "D:\a\AutoGPT\AutoGPT\rnd\autogpt_server\autogpt_server\util\process.py", line 28, in execute_run_command
  File "D:\a\AutoGPT\AutoGPT\rnd\autogpt_server\autogpt_server\util\service.py", line 64, in run
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\asyncio\base_events.py", line 649, in run_until_complete
  File "D:\a\AutoGPT\AutoGPT\rnd\autogpt_server\autogpt_server\data\db.py", line 10, in connect
  File "C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\autogpt-server-Hzddpd5Y-py3.10\lib\site-packages\prisma\_base_client.py", line 430, in connect
  File "C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\autogpt-server-Hzddpd5Y-py3.10\lib\site-packages\prisma\engine\_query.py", line 349, in connect
  File "C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\autogpt-server-Hzddpd5Y-py3.10\lib\site-packages\prisma\engine\_query.py", line 58, in _ensure_file
  File "C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\autogpt-server-Hzddpd5Y-py3.10\lib\site-packages\prisma\engine\utils.py", line 111, in ensure
prisma.engine.errors.BinaryNotFoundError: Expected C:\Users\nicka\prisma-query-engine-windows.exe, C:\Users\nicka\.cache\prisma-python\binaries\5.11.0\efd2449663b3d73d637ea1fd226bafbcf45b3102\prisma-query-engine-windows.exe or C:\Users\runneradmin\.cache\prisma-python\binaries\5.11.0\efd2449663b3d73d637ea1fd226bafbcf45b3102\node_modules\prisma\query-engine-windows.exe to exist but none were found or could not be executed.
Try running prisma py fetch

Repro Steps and far more details 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.

@marcelotduarte
Copy link
Owner

I'll try to look at it over the weekend, I'm busy these days.

@ntindle
Copy link
Contributor Author

ntindle commented Jul 19, 2024

Much appreciated. I got pretty out of my depth with it

@marcelotduarte
Copy link
Owner

I think you were close to figuring out how to solve the issue when you described it in RobertCraigie/prisma-client-py#976

Then rename query-engine-windows.exe to prisma-query-engine-windows.exe in prisma/node_modules/prisma

You have to copy this file next to the executable, or in the case of cx_Freeze, use include_files.

Find out how to get the 'binary cache dir' that is shown in the command prisma py version, and use it like

include_files.append(("{binary cache dir}/node_modules/prisma/query-engine-windows.exe", "prisma-query-engine-windows.exe"))

@marcelotduarte
Copy link
Owner

Please test the possibly solution at ntindle/cx_freeze_prisma_reproduction#2 to close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants