I did try using psycopg2-binary and the app wouldn't start. I'll have to 
revisit to find what that exact error was. That's a good suggestion, 
though, as I did not try with the Python (i.e. non-binary) package. 

Anyways, the consensus after a quick web search seemed to be to use 
psycopg2cffi when using PyPy. I'm open to any driver that'll work, though. 
This is just an experiment.

On Monday, December 11, 2023 at 9:28:06 PM UTC-5 Jason wrote:

> the last release of psycopg2cffi was January 2021
>
> pypy support for 3.10 came out Dec 2022
>
> Is there a reason you're on psycopg2cffi?  have you tried with regular 
> psycopg2?
>
> On Monday, December 11, 2023 at 3:19:11 PM UTC-5 Pete Doherty wrote:
>
>> I'm wondering if anyone is using Django 4.2, PyPy 3.10 and Postgres 15?
>>
>> I tried using psycopg2cffi==2.9.0 and it works up until a point but 
>> eventually fails with a series of errors relating to imports.
>>
>> After adding the compatibility layer to the top of my settings.py script 
>> using:
>>
>> > from psycopg2cffi import compat, errorcodes
>> > compat.register()
>>
>>
>> The first error I see is:
>>
>> > ImportError: cannot import name 'errors' from 'psycopg2cffi' 
>> (/home/appuser/.local/lib/pypy3.10/site-packages/psycopg2cffi/__init__.py)
>>
>> I see the errors module in the psycopg2cffi repo and seem to be able to 
>> import it like so:
>>
>> > import psycopg2cffi
>> > from psycopg2cffi import compat, errorcodes
>> psycopg2cffi.errors = errorcodes
>>
>> I then see an error stating:
>>
>> > ImportError: cannot import name 'sql' from 'psycopg2cffi' 
>> (/home/appuser/.local/lib/pypy3.10/site-packages/psycopg2cffi/__init__.py)
>>
>> While I see the sql.py module in the repo, it does not seem to be 
>> included in the built psycopg2cffi package. Trying to patch it in results 
>> in:
>>
>> > from psycopg2cffi import sql
>> > psycopg2cffi.sql = sql
>>
>> > ImportError: cannot import name 'sql' from 'psycopg2cffi' 
>> (/home/appuser/.local/lib/pypy3.10/site-packages/psycopg2cffi/__init__.py)
>>
>> I tried copying sql.py into my locally installed package and that 
>> resulted yet another error:
>>
>> > ImportError: cannot import name 'PY3' from 'psycopg2cffi.compat' 
>> (/home/appuser/.local/lib/pypy3.10/site-packages/psycopg2cffi/compat.py)
>>
>> So, before I go any further down this path, I wanted to see if anyone is 
>> using this setup, knows that it will definitely not work or has any 
>> suggestions about alternatives.
>>
>> Thanks!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a4dba1b8-b656-4ae9-90b2-e1284e9f6260n%40googlegroups.com.

Reply via email to