psycopg / psycopg2

PostgreSQL database adapter for the Python programming language

Home Page:https://www.psycopg.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Python 3.12 support for Windows

dvarrazzo opened this issue · comments

We are in the process of releasing 2.9.9 with Windows support.

Building Windows packages needs to wait for appveyor/ci#3879.

on windows 10, it dont wors

	Collecting psycopg2

Using cached psycopg2-2.9.9.tar.gz (384 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: psycopg2
Building wheel for psycopg2 (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for psycopg2 (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-312
creating build\lib.win-amd64-cpython-312\psycopg2
copying lib\errorcodes.py -> build\lib.win-amd64-cpython-312\psycopg2
copying lib\errors.py -> build\lib.win-amd64-cpython-312\psycopg2
copying lib\extensions.py -> build\lib.win-amd64-cpython-312\psycopg2
copying lib\extras.py -> build\lib.win-amd64-cpython-312\psycopg2
copying lib\pool.py -> build\lib.win-amd64-cpython-312\psycopg2
copying lib\sql.py -> build\lib.win-amd64-cpython-312\psycopg2
copying lib\tz.py -> build\lib.win-amd64-cpython-312\psycopg2
copying lib_ipaddress.py -> build\lib.win-amd64-cpython-312\psycopg2
copying lib_json.py -> build\lib.win-amd64-cpython-312\psycopg2
copying lib_range.py -> build\lib.win-amd64-cpython-312\psycopg2
copying lib_init_.py -> build\lib.win-amd64-cpython-312\psycopg2
running build_ext
building 'psycopg2._psycopg' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for psycopg2
Failed to build psycopg2

Correct, for the reason stated above.

Thanks for raising this yourself for visibility.

Just to help SEO this is related to:

    from psycopg2._psycopg import (                     # noqa
ImportError: DLL load failed while importing _psycopg: The specified module could not be found.

with python --version -> 3.12.0

@dvarrazzo do you have an expected time for release? do you work closely with appveyor/ci#3879 to know when they expect to release it?

@Fran-Rg No, in the past it tooks days/weeks to release new builders. You can take this time to move to psycopg 3 instead, whose packages are built on GH.

@dvarrazzo - so it is better to move to newer psycopg? Because I simply installed those "Visual Studio Build Tools" + "Desktop Development with C++" option in Visual Studio Installer and pip install psycopg2-binary (which complained earlier about missing Visual Studio C++ during build) finished successfully. Maybe I should have waited with upgrade to Python 3.12...

Example of failed installation:

$ pip install psycopg2-binary
Collecting psycopg2-binary
  Using cached psycopg2-binary-2.9.9.tar.gz (384 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: psycopg2-binary
  Building wheel for psycopg2-binary (pyproject.toml): started
  Building wheel for psycopg2-binary (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error

  Building wheel for psycopg2-binary (pyproject.toml) did not run successfully.
  exit code: 1

  [20 lines of output]
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-312
  creating build\lib.win-amd64-cpython-312\psycopg2
  copying lib\errorcodes.py -> build\lib.win-amd64-cpython-312\psycopg2
  copying lib\errors.py -> build\lib.win-amd64-cpython-312\psycopg2
  copying lib\extensions.py -> build\lib.win-amd64-cpython-312\psycopg2
  copying lib\extras.py -> build\lib.win-amd64-cpython-312\psycopg2
  copying lib\pool.py -> build\lib.win-amd64-cpython-312\psycopg2
  copying lib\sql.py -> build\lib.win-amd64-cpython-312\psycopg2
  copying lib\tz.py -> build\lib.win-amd64-cpython-312\psycopg2
  copying lib\_ipaddress.py -> build\lib.win-amd64-cpython-312\psycopg2
  copying lib\_json.py -> build\lib.win-amd64-cpython-312\psycopg2
  copying lib\_range.py -> build\lib.win-amd64-cpython-312\psycopg2
  copying lib\__init__.py -> build\lib.win-amd64-cpython-312\psycopg2
  running build_ext
  building 'psycopg2._psycopg' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for psycopg2-binary
Failed to build psycopg2-binary
ERROR: Could not build wheels for psycopg2-binary, which is required to install pyproject.toml-based projects

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 0: invalid continuation byte. Error on python 3.12

appveyor/ci#3879
Ubuntu is released, windows likely within the next few days.

appveyor/ci#3879 (comment)
Windows and Ubuntu images are available now

Psycopg2 packages for Python 3.12 for Windows released.