--- venv/Lib/site-packages/psycopg2/extensions.py	2022-03-10 15:46:10.094551200 +0100
+++ extensions.py	2022-03-10 17:15:11.264398600 +0100
@@ -48,13 +48,18 @@
     DateFromPy, TimeFromPy, TimestampFromPy, IntervalFromPy, )
 
 from psycopg2._psycopg import (                             # noqa
-    adapt, adapters, encodings, connection, cursor,
+    adapt, adapters, connection, cursor,
     lobject, Xid, libpq_version, parse_dsn, quote_ident,
     string_types, binary_types, new_type, new_array_type, register_type,
     ISQLQuote, Notify, Diagnostics, Column, ConnectionInfo,
     QueryCanceledError, TransactionRollbackError,
     set_wait_callback, get_wait_callback, encrypt_password, )
 
+try:
+    from psycopg2._psycopg import encodings
+    hasEncodings = True
+except ImportError:
+    hasEncodings = False
 
 """Isolation level values."""
 ISOLATION_LEVEL_AUTOCOMMIT = 0
@@ -202,12 +207,13 @@
 del Range
 
 
-# Add the "cleaned" version of the encodings to the key.
-# When the encoding is set its name is cleaned up from - and _ and turned
-# uppercase, so an encoding not respecting these rules wouldn't be found in the
-# encodings keys and would raise an exception with the unicode typecaster
-for k, v in list(encodings.items()):
-    k = k.replace('_', '').replace('-', '').upper()
-    encodings[k] = v
-
-del k, v
+if hasEncodings:
+    # Add the "cleaned" version of the encodings to the key.
+    # When the encoding is set its name is cleaned up from - and _ and turned
+    # uppercase, so an encoding not respecting these rules wouldn't be found in the
+    # encodings keys and would raise an exception with the unicode typecaster
+    for k, v in list(encodings.items()):
+        k = k.replace('_', '').replace('-', '').upper()
+        encodings[k] = v
+    
+    del k, v
