Skip to content

oracledb with cryptography >=43 cause error DPY-3016: python-oracledb thin mode cannot be used because the cryptography package is not installed #401

@zdenop

Description

@zdenop

Used versions

cryptography==43.0.1
pyinstaller==6.10.0
oracledb==2.4.1

oracledb.version: 2.4.1
platform.platform: Windows-10-10.0.19045-SP0
sys.maxsize > 2**32: True
platform.python_version: 3.11.9

Error reproducing

Example code:

import os
from contextlib import suppress

import oracledb
from dotenv import load_dotenv

with suppress(BaseException):
    oracledb.init_oracle_client()
    print(f'Oracle client version: {oracledb.clientversion()}')

oracle_cnx = None
load_dotenv()

try:
    oracle_cnx = oracledb.connect(
        user=os.getenv('user'), password=os.getenv('pwd'), dsn=os.getenv('db')
    )
except oracledb.DatabaseError as err:
    (error,) = err.args
    print(error)

if oracle_cnx:
    print('Oracle connection works.')
    oracle_cnx.close()

app is created with:
python -OO -m PyInstaller -F -c --noupx --noconfirm --hidden-import secrets --hidden-import asyncio --hidden-import uuid test.py

and run by:
dist\test.exe

which produce:
DPY-3016: python-oracledb thin mode cannot be used because the cryptography package is not installed

Workarounds

  1. Downgrade cryptography to 42.0.8. IMO this will cause dependency problems soon.
  2. set PATH=C:\oracle\ora122\client_x64\bin before running dist\test.exe. This will cause my app will not be usable on other computers and anyway it is not needed by cryptography==42.0.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions