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

Python 3.11 compatibility #305

Closed
dvarrazzo opened this issue May 15, 2022 · 18 comments
Closed

Python 3.11 compatibility #305

dvarrazzo opened this issue May 15, 2022 · 18 comments

Comments

@dvarrazzo
Copy link
Member

At the moment, psycopg-c build is not compatible with Python 3.11. We probably need to wait for release of Cython 3.0.0a11 because the errors during build seem already addressed and merged to master:

@septatrix
Copy link

It would also be nice to replace the str in the Query type alias with LiteralString (sadly there is no bytes equivalent)

@itsankitkp
Copy link

itsankitkp commented Jul 19, 2022

On related note:
Build is failing for psycopg_c (working fine for psycopg[dev,test])
Tested on Python 3.12.0a0 (built from source)
Run
pip install -e ./psycopg_c
Response:
res.txt

@dvarrazzo
Copy link
Member Author

dvarrazzo commented Jul 19, 2022

@itsankitkp they seem cython-related issues. Did you build it with the master version of cython? 3.0.0a10 surely doesn't support Python 3.12.

@itsankitkp
Copy link

Yes, I build with master version of CPython (Python 3.12.0a0 (heads/main:16b6e14) [GCC 11.2.0] on linux).

Might need to dig deeper.

@dvarrazzo
Copy link
Member Author

Yes, I build with master version of CPython

And which version of Cython?

@itsankitkp
Copy link

Pip freeze result as follows:
Cython==0.29.30

@dvarrazzo
Copy link
Member Author

Cython 0.x definitely doesn't work. As already stated, to have a chance to compile for Python 3.11 you need cython from master, for the reasons explained in this ticket. I expect Python 3.12 to need at least the same.

@itsankitkp
Copy link

I did try that but it is still failing with Cython==3.0.0a10 (Cython master)

Might need to wait for 3.0.0a11

@itsankitkp
Copy link

Error log error.txt

@honglei
Copy link

honglei commented Sep 8, 2022

https://pythoninsider.blogspot.com/2022/08/python-3110rc1-is-now-available.html
Any updates for Python3.11rc1?
The https://pypi.org/project/psycopg/#files version 3.1.1 still not work under Python3.11.

C:\Users\Admin>c:/python311/python.exe -m pip install -U psycopy 
ERROR: Could not find a version that satisfies the requirement psycopy (from versions: none)
ERROR: No matching distribution found for psycopy

@dvarrazzo
Copy link
Member Author

dvarrazzo commented Sep 8, 2022

You have a typo in the package name. You can probably install psycopg and it should probably work already. You must have your libpq.dll in the system: see the install docs for more details.

psycopg[binary] needs a specific release, which won't happen until the official Python 11 release: it is advised against loading packages on pypi for unstable releases.

I have noticed that Cython 3.0.0a11 has been released: will try if it fixes all the problems and merge this branch so that we can release packages for Py11 as soon as it's final.

@dvarrazzo
Copy link
Member Author

The py311 branch passes all the test and builds packages successfully for Python 3.11.

To be merged to master and released as soon as Python 3.11 is officially released.

@septatrix
Copy link

PyPi supports pre-releases. What do you think about publishing the preliminary version as such a pre-release to allow early adopters to already test their application with it?

@dvarrazzo
Copy link
Member Author

It makes sense, @septatrix, you are right 👍

I've uploaded the packages just built on test pypi: instruction to install them at https://test.pypi.org/project/psycopg/3.1.2.dev0/

@dvarrazzo
Copy link
Member Author

Merging to master and releasing, see #424.

@loopassembly

This comment was marked as abuse.

@dvarrazzo
Copy link
Member Author

@loopassembly

so then how much time it is going to take to be fixed?

Do I owe you anything?

Psycopg 3 for 3.11 has been released days ago. You are most likely barking at the wrong tree. But, because you are so nice, I will save you from barking more by blocking you. I have zero patience for people like you.

@septatrix
Copy link

@loopassembly I assume you are trying to build from source. If so it seems like pg_config is not installed though that is not the fault of this project but instead due to you missing requirements: See the local install section

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

5 participants