Joldz 🔮
Joldz 🔮•3w ago

I keep getting an error that says that the psycopg2 python module doesn't exist when i run code

I have succesffully imported the module, and have actually copy and pasted this code from another app that is working fine with this exact code and I can't get it to work. I changed it to import psycopg instead of psycopg2 and the code runs fine but it is not functioning with psycopg2 and whats even weirder is that every now and then it does work if i just keep hitting run. Is there a way I can maybe remove and reinstall that binary and its dependencies within windmill?
5 Replies
Joldz 🔮
Joldz 🔮•3w ago
Nevermind, I am now also getting this error on psycopg module as well. Here's the full error: ExitCode: 1, last log lines: mill/cache/pip/psycopg==3.2.1/psycopg/pq/init.py", line 118, in <module> import_from_libpq() File "/tmp/windmill/cache/pip/psycopg==3.2.1/psycopg/pq/init.py", line 110, in import_from_libpq raise ImportError( ImportError: no pq wrapper available. Attempts made: - couldn't import psycopg 'c' implementation: No module named 'psycopg_c' - couldn't import psycopg 'binary' implementation: cannot import name 'pq' from 'psycopg_binary' (/tmp/windmill/cache/pip/psycopg-binary==3.2.1/psycopg_binary/init.py) - couldn't import psycopg 'python' implementation: libpq library not found
rubenf
rubenf•3w ago
are you on cloud? How did you define your requirements?
Joldz 🔮
Joldz 🔮•3w ago
I just have ‘import psycopg2’ at the top of the file. And I don’t think so. The company I work for has it set up for us to use so I don’t think it’s cloud. @rubenf
rubenf
rubenf•3w ago
If your company is on EE we can investigate but otherwise I don't know, clear the worker cache and volumes maybe I can't reproduce that issue so it might be specific to your setup If you give us a very clear repro we can dig in when we're available. Meaning creating a new instance and having that error on a new vanilla script
Joldz 🔮
Joldz 🔮•3w ago
We are on EE. I will work with my company's dev ops team and work on getting some of this information to you.