Skip to content

TypeError: __SSHCipher() takes no arguments error in relation to cryptography package #384

@cwb-slu

Description

@cwb-slu

Good day to everyone here, I am encountering an error when attempting to deploy a Django application in Windows Server 2016 with Apache and mod_wsgi. I am not sure whether the root cause of this is with my Apache configuration or settings, but it seems that the import comes from the cryptography package installed with oracledb.

1. What versions are you using?

For my virtual environment packages:
Django 3.2
oracledb: 2.3.0
mod_wsgi 5.0.0
cryptography 43.0.0
cx-Oracle 8.3.0

My oracle db:
Screenshot 2024-08-22 111058

Python output:

>>> import sys
>>> import platform
>>> print("platform.platform:", platform.platform())
platform.platform: Windows-10-10.0.14393-SP0
>>> print("sys.maxsize > 2**32:", sys.maxsize > 2**32)
sys.maxsize > 2**32: True
>>> print("platform.python_version:", platform.python_version())
platform.python_version: 3.10.0
>>> import oracledb
>>> print("oracledb.__version__:", oracledb.__version__)
oracledb.__version__: 2.3.0
>>>

2. Is it an error or a hang or a crash?
Error connected with wsgi

3. What error(s) or behavior you are seeing?

[wsgi:error] [pid 5432:tid 1284]  mod_wsgi (pid=5432): Failed to exec Python script file 'C:/Users/opc/Desktop/analyticsdashboard/dashboardslu/dashboardslu/wsgi.py'.
[wsgi:error] [pid 5432:tid 1284]  mod_wsgi (pid=5432): Exception occurred processing WSGI script 'C:/Users/opc/Desktop/analyticsdashboard/dashboardslu/dashboardslu/wsgi.py'.
[wsgi:error] [pid 5432:tid 1284]  Traceback (most recent call last):\r
[wsgi:error] [pid 5432:tid 1284]    File "C:/Users/opc/Desktop/analyticsdashboard/dashboardslu/dashboardslu/wsgi.py", line 24, in <module>\r
[wsgi:error] [pid 5432:tid 1284]      application = get_wsgi_application()\r
[wsgi:error] [pid 5432:tid 1284]    File "C:\\Users\\opc\\Desktop\\analyticsdashboard\\local-environment-slu\\Lib\\site-packages\\django\\core\\wsgi.py", line 12, in get_wsgi_application\r
[wsgi:error] [pid 5432:tid 1284]      django.setup(set_prefix=False)\r
[wsgi:error] [pid 5432:tid 1284]    File "C:\\Users\\opc\\Desktop\\analyticsdashboard\\local-environment-slu\\Lib\\site-packages\\django\\__init__.py", line 19, in setup\r
[wsgi:error] [pid 5432:tid 1284]      configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)\r
[wsgi:error] [pid 5432:tid 1284]    File "C:\\Users\\opc\\Desktop\\analyticsdashboard\\local-environment-slu\\Lib\\site-packages\\django\\conf\\__init__.py", line 82, in __getattr__\r
[wsgi:error] [pid 5432:tid 1284]      self._setup(name)\r
[wsgi:error] [pid 5432:tid 1284]    File "C:\\Users\\opc\\Desktop\\analyticsdashboard\\local-environment-slu\\Lib\\site-packages\\django\\conf\\__init__.py", line 69, in _setup\r
[wsgi:error] [pid 5432:tid 1284]      self._wrapped = Settings(settings_module)\r
[wsgi:error] [pid 5432:tid 1284]    File "C:\\Users\\opc\\Desktop\\analyticsdashboard\\local-environment-slu\\Lib\\site-packages\\django\\conf\\__init__.py", line 170, in __init__\r
[wsgi:error] [pid 5432:tid 1284]      mod = importlib.import_module(self.SETTINGS_MODULE)\r
[wsgi:error] [pid 5432:tid 1284]    File "C:\\Users\\opc\\AppData\\Local\\Programs\\Python\\Python310\\lib\\importlib\\__init__.py", line 126, in import_module\r
[wsgi:error] [pid 5432:tid 1284]      return _bootstrap._gcd_import(name[level:], package, level)\r
[wsgi:error] [pid 5432:tid 1284]    File "<frozen importlib._bootstrap>", line 1050, in _gcd_import\r
[wsgi:error] [pid 5432:tid 1284]    File "<frozen importlib._bootstrap>", line 1027, in _find_and_load\r
[wsgi:error] [pid 5432:tid 1284]    File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked\r
[wsgi:error] [pid 5432:tid 1284]    File "<frozen importlib._bootstrap>", line 688, in _load_unlocked\r
[wsgi:error] [pid 5432:tid 1284]    File "<frozen importlib._bootstrap_external>", line 883, in exec_module\r
[wsgi:error] [pid 5432:tid 1284]    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed\r
[wsgi:error] [pid 5432:tid 1284]    File "C:\\Users/opc/Desktop/analyticsdashboard/dashboardslu\\dashboardslu\\settings.py", line 101, in <module>\r
[wsgi:error] [pid 5432:tid 1284]      import oracledb\r
[wsgi:error] [pid 5432:tid 1284]    File "C:\\Users\\opc\\Desktop\\analyticsdashboard\\local-environment-slu\\Lib\\site-packages\\oracledb\\__init__.py", line 43, in <module>\r
[wsgi:error] [pid 5432:tid 1284]      from . import base_impl, thick_impl, thin_impl\r
[wsgi:error] [pid 5432:tid 1284]    File "src\\\\oracledb\\\\impl/thin/crypto.pyx", line 33, in init oracledb.thin_impl\r
[wsgi:error] [pid 5432:tid 1284]    File "C:\\Users\\opc\\Desktop\\analyticsdashboard\\local-environment-slu\\Lib\\site-packages\\cryptography\\x509\\__init__.py", line 8, in <module>\r
[wsgi:error] [pid 5432:tid 1284]      from cryptography.x509.base import (\r
[wsgi:error] [pid 5432:tid 1284]    File "C:\\Users\\opc\\Desktop\\analyticsdashboard\\local-environment-slu\\Lib\\site-packages\\cryptography\\x509\\base.py", line 15, in <module>\r
[wsgi:error] [pid 5432:tid 1284]      from cryptography.hazmat.primitives import hashes, serialization\r
[wsgi:error] [pid 5432:tid 1284]    File "C:\\Users\\opc\\Desktop\\analyticsdashboard\\local-environment-slu\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\serialization\\__init__.py", line 25, in <module>\r
[wsgi:error] [pid 5432:tid 1284]      from cryptography.hazmat.primitives.serialization.ssh import (\r
[wsgi:error] [pid 5432:tid 1284]    File "C:\\Users\\opc\\Desktop\\analyticsdashboard\\local-environment-slu\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\serialization\\ssh.py", line 105, in <module>\r
[wsgi:error] [pid 5432:tid 1284]      b"aes256-ctr": _SSHCipher(\r
[wsgi:error] [pid 5432:tid 1284]  TypeError: _SSHCipher() takes no arguments\r

4. Does your application call init_oracle_client()?

  • Yes, based on the logs it shows that the thin version is being used.

Also, I've tried to find a solution for this online, but this is the closest I found :
pyca/cryptography#9988

Any help would be appreciated, thank you!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions