Artem Selivanov
Artem Selivanov

Reputation: 1957

Python 3.7 and psycopg2. ImportError: DLL load failed

I tried the Python 3.7 on Windows 10 and got ImportError of psycopg2 module which installed from pip.

In psycopg2\__init__.py there is an import from pyd:

from psycopg2._psycopg import (                     # noqa
    BINARY, NUMBER, STRING, DATETIME, ROWID,

    Binary, Date, Time, Timestamp,
    DateFromTicks, TimeFromTicks, TimestampFromTicks,

    Error, Warning, DataError, DatabaseError, ProgrammingError, IntegrityError,
    InterfaceError, InternalError, NotSupportedError, OperationalError,

    _connect, apilevel, threadsafety, paramstyle,
    __version__, __libpq_version__,
)

And this causes ImportError: DLL load failed: Can't find specified moudule. while the file Python37\Lib\site-packages\psycopg2\_psycopg.cp37-win_amd64.pyd exists!

Whats wrong with import? It's regression?

Upvotes: 1

Views: 3330

Answers (1)

Bedilbek
Bedilbek

Reputation: 899

According to installation prerequisites of psycopg2 psycopg2-prerequisites:

  • Python 2 versions from 2.6 to 2.7

  • Python 3 versions from 3.2 to 3.6

You'd better uninstall python 3.7 and install 3.6 instead, or install 3.6 along with 3.7. and create an alias for 3.6

Upvotes: 2

Related Questions