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

Add Python 3.13 packages for Windows #1736

Open
dvarrazzo opened this issue Oct 16, 2024 · 9 comments
Open

Add Python 3.13 packages for Windows #1736

dvarrazzo opened this issue Oct 16, 2024 · 9 comments

Comments

@dvarrazzo
Copy link
Member

dvarrazzo commented Oct 16, 2024

Packages for other platforms already released: see #1692.

For Windows we need appveyor/ci#3927

@Erik-Stodola-Enerfrog
Copy link

@dvarrazzo Thanks for making note of this, this is currently impacting our team

Fingers crossed will be resolved soon. Have a great one 😇

@muizz-IHT
Copy link

Exception has occurred: ImportError
DLL load failed while importing _psycopg: The specified module could not be found.
File "C:\Users\Desktop\pg_connect.py", line 1, in
import psycopg2
ImportError: DLL load failed while importing _psycopg: The specified module could not be found.

I am using the latest version of python 3.13, on windows OS. so during my pip install psycopg2 the wheel build failed as i didn't install visual studio buildtools, once this was downloaded, the installation happened smoothly. But while running the code i am getting this error. Any help would be much appreciated!

Version of psycopg2 == 2.9.10

@Loparch
Copy link

Loparch commented Nov 2, 2024

I have the same problem as @muizz-IHT when I try to import psycopg2 on Python 3.13 (Windows OS).

Traceback (most recent call last):
File "", line 1, in
import psycopg2
File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\psycopg2_init_.py", line 51, in
from psycopg2._psycopg import ( # noqa
...<10 lines>...
)
ImportError: DLL load failed while importing _psycopg: No se puede encontrar el módulo especificado.

Any help would be much appreciated!

@stephenjoly
Copy link

I am also having this exact issue. @muizz-IHT and @Loparch. I am on python 13. tried downgrading and that didnt help. Installed using pip install pyscopg2-binary, uninstalled and reinstalled a few times. Installed the visual studio C+ tools, etc. Tried everything I could now posting this here. The issue for me happens here:

$ c:/Users/myuser/Home/Development/venv2/Scripts/python.exe c:/Users/myuser/Home/Development/app/main.py
Traceback (most recent call last):
  File "c:\Users\myuser\Home\Development\app\main.py", line 30, in <module>
    engine=create_engine(DATABASE_URL)
  File "<string>", line 2, in create_engine
  File "C:\Users\myuser\Home\Development\venv2\Lib\site-packages\sqlalchemy\util\deprecations.py", line 281, in warned
    return fn(*args, **kwargs)  # type: ignore[no-any-return]
  File "C:\Users\myuser\Home\Development\venv2\Lib\site-packages\sqlalchemy\engine\create.py", line 599, in create_engine
    dbapi = dbapi_meth(**dbapi_args)
  File "C:\Users\myuser\Home\Development\venv2\Lib\site-packages\sqlalchemy\dialects\postgresql\psycopg2.py", line 690, in import_dbapi
    import psycopg2
  File "C:\Users\myuser\Home\Development\venv2\Lib\site-packages\psycopg2\__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
    ...<10 lines>...
    )
ImportError: DLL load failed while importing _psycopg: The specified module could not be found.
(venv2) 

@offa
Copy link

offa commented Nov 8, 2024

Is there a change to workaround this by using Github Actions instead or Python 3.13rc1 on Appvayer?

@muizz-IHT
Copy link

Since Python 13 was just released in October, many library wheels and binaries haven’t been built yet. I tried using Python 12, which has been out for a year, and psycopg2 worked flawlessly. It’s also recommended to install Visual Studio Build Tools for C++ to ensure everything runs smoothly.
check the vsbuild installer here

@ninabel
Copy link

ninabel commented Nov 14, 2024

I can't install psycopg2-binary for python 3.13 on Windows 10.

C:\WINDOWS\system32>python -m pip install psycopg2-binary
Collecting psycopg2-binary
  Using cached psycopg2-binary-2.9.10.tar.gz (385 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: psycopg2-binary
  Building wheel for psycopg2-binary (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for psycopg2-binary (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build\lib.win-amd64-cpython-313\psycopg2
      copying lib\errorcodes.py -> build\lib.win-amd64-cpython-313\psycopg2
      copying lib\errors.py -> build\lib.win-amd64-cpython-313\psycopg2
      copying lib\extensions.py -> build\lib.win-amd64-cpython-313\psycopg2
      copying lib\extras.py -> build\lib.win-amd64-cpython-313\psycopg2
      copying lib\pool.py -> build\lib.win-amd64-cpython-313\psycopg2
      copying lib\sql.py -> build\lib.win-amd64-cpython-313\psycopg2
      copying lib\tz.py -> build\lib.win-amd64-cpython-313\psycopg2
      copying lib\_ipaddress.py -> build\lib.win-amd64-cpython-313\psycopg2
      copying lib\_json.py -> build\lib.win-amd64-cpython-313\psycopg2
      copying lib\_range.py -> build\lib.win-amd64-cpython-313\psycopg2
      copying lib\__init__.py -> build\lib.win-amd64-cpython-313\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: ERROR: Failed to build installable wheels for some pyproject.toml based projects (psycopg2-binary)

I've tryed to install Microsoft Visual C++ but it doesn't help. I would like to have psycopg2-binary ready for use without reistalling OS.

@dvarrazzo
Copy link
Member Author

@ninabel You are not required to reinstall OS. You can use Python 3.12 or move your project to psycopg 3.

@Erik-Stodola-Enerfrog
Copy link

@dvarrazzo Thanks for your help, we appreciate it. Using psycopg 3 has unblocked our team. Thank you! 😇🎖️

Official Python Packages - psycopg

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

7 participants