skyvern
skyvern copied to clipboard
Psycopg cannot use the 'ProactorEventLoop' (Install of skyvern fails on windows during skyvern quickstart)
skyvern quickstart fails at this section
Generating local organization API key...
Error during quickstart: (psycopg.InterfaceError) Psycopg cannot use the 'ProactorEventLoop' to run in async mode. Please use a compatible event loop, for instance by setting 'asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())'
(Background on this error at: https://sqlalche.me/e/20/rvf5)
python version 3.12.0
win 11
steps to repro:
- finish pip install successfully.
- run "skyvern quickstart" in cmd
Expected result: it will run smoothly on windows without any unexpected errors. :-)
Have same issue
as stated here on Windows machine you need to use another driver: https://github.com/Skyvern-AI/skyvern/blob/main/.env.example#L99
basically in your connection string change psycopg on this asyncpg and it should work just fine.
@radimbrixi-del , @Elliot-Construct have you had a chance to take a look and check if driver change in .env file or docker setup is working for you ^?
Thank you very much for you kind and truly helpful insight. Since I did pip insall and just skyvern.exe emerged in Python12 Scripts subdir, I had no chance to find all the files of skyvern anywhere on my pc. I expected that it would be installed in the dir I launched pip but nothing emerged there. I am trying to install new notebook, but I had skyvern running using my antrophic key in my previous house and I remember putting the api key somewhere around half a year ago. But this time I am struggelling, so I installed sourcetree and got sourcecodes cloned.
Please consider to put this KEY information for windows users into the initial readme as instruction otherwise people might got stuck because of not knowing to comment one line and uncomment the windows one. It looks that we were not the only ones. :-)
Ok, so bad news, after editing the file as @Valeran86 recommended, I run still into issues on win 11.
FIRST: Error during quickstart: (psycopg.OperationalError) connection failed: could not receive data from server: Socket is not connected (0x00002749/10057) could not send SSL negotiation packet: Socket is not connected (0x00002749/10057) (Background on this error at: https://sqlalche.me/e/20/e3q8)
SECOND: Error during quickstart: (psycopg.InterfaceError) Psycopg cannot use the 'ProactorEventLoop' to run in async mode. Please use a compatible event loop, for instance by setting 'asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())' (Background on this error at: https://sqlalche.me/e/20/rvf5)
If you pip install it, you should be able to add/update .env file in your Windows profile, for example in mine it's here:
I think you still using psycopg driver for DB connection and that's what causing it.
Also network error (first one - Socket is not connected) indicates that DB might not be reachable or not started? Could you please check?
I do not have any .env file to be found anywhere on c drive after pip install so I downloaded source codes and made .env from .env.example with having uncommented line for windows...
Somehow it still crasshes here
@Valeran86 Steps I did made copy of .env.examle and made .env as a copy. Deleted in docker Containers and images. Fixed docker to run as admimistrator after showing error connect ENOENT \.\pipe\errorReporter started skyvern init selected local
I think I know what's happening.
In repo we have updated alembic/env.py file but after installation it's not updated in packages.
To resolve your issue you can take this file and update it in directory similar to this one:
C:\Users\<your_user_profile>\AppData\Local\Programs\Python\Python312\Lib\site-packages\alembic
also btw, after installation skyvern and skyvern-frontend available here:
Before
After
It looks that the file is key for successful installation. Nevertheless one more error occured, python was not detected so I had to put path manually although its the first item in my PATH env var. Thank you for your great insight and I hope this feedback helps rising the ease of installing of the product for others as well.
I think it's now fixed with new Python packaging, I see that after re-installation mentioned file is up-to-date.
I did these to make it work:
pip uninstall skyvern
pip cache purge
Then removed manually from folder C:\Users\<your_user_profile>\AppData\Local\Programs\Python\Python312\Lib\site-packages\:
alembic*skyvern*
Then I installed it back with usual:
pip install skyvern
If that helps we can close this issue.
@radimbrixi have you had a chance to give it another try with "fresh" installation/re-installation as described above?
I am now happy to have it kind of working, I did not want to mess it up. I might get back to it 10+ days later due to travelling abroad... If i do I will give the feedback here.
I have solved this problem.
Modify Lib\site-packages\skyvern\cli\quickstart.py
from asyncio import WindowsSelectorEventLoopPolicy
asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())
After "quickstart" , comment out those two lines
Then modify .\.env
DATABASE_STRING='postgresql+asyncpg://skyvern@localhost/skyvern'