python-3.8ubuntu-20.04pyopensslodoo-16

Odoo16 installation Error (OpenSSL/cryptography): module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'


I have installed odoo16 on Ubuntu 20.04 using Yenthe install-script at https://github.com/Yenthe666/InstallScript

The result of the launch command : ./odoo-bin -c /etc/odoo-server.conf
is:

    2022-11-11 15:09:01,324 23800 INFO ? odoo: addons paths: ['/odoo/odoo-server/odoo/addons', '/odoo/.local/share/Odoo/addons/16.0', '/odoo/enterprise/addons', '/odoo/odoo-server/addons']
    2022-11-11 15:09:01,324 23800 INFO ? odoo: database: default@default:default
    2022-11-11 15:09:01,799 23800 INFO ? odoo.addons.base.models.ir_actions_report: A package may be missing to print Data Matrix barcodes: pylibdmtx or libdmtx.
    2022-11-11 15:09:01,811 23800 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /bin/wkhtmltopdf
    2022-11-11 15:09:02,311 23800 CRITICAL ? odoo.modules.module: Could not load module web
    2022-11-11 15:09:02,311 23800 CRITICAL ? odoo.modules.module: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'
    2022-11-11 15:09:02,311 23800 ERROR ? odoo.service.server: Failed to load server-wide module `web`.
    The `web` module is provided by the addons found in the `openerp-web` project.
    Maybe you forgot to add those addons in your addons_path configuration.
    Traceback (most recent call last):
      File "/odoo/odoo-server/odoo/service/server.py", line 1239, in load_server_wide_modules
        odoo.modules.module.load_openerp_module(m)
      File "/odoo/odoo-server/odoo/modules/module.py", line 432, in load_openerp_module
        __import__('odoo.addons.' + module_name)
      File "/odoo/odoo-server/addons/web/__init__.py", line 4, in <module>
        from . import controllers
      File "/odoo/odoo-server/addons/web/controllers/__init__.py", line 5, in <module>
        from . import database
      File "/odoo/odoo-server/addons/web/controllers/database.py", line 24, in <module>
        from odoo.addons.base.models.ir_qweb import render as qweb_render
      File "/odoo/odoo-server/odoo/addons/base/__init__.py", line 5, in <module>
        from . import models
      File "/odoo/odoo-server/odoo/addons/base/models/__init__.py", line 21, in <module>
        from . import ir_mail_server
      File "/odoo/odoo-server/odoo/addons/base/models/ir_mail_server.py", line 19, in <module>
        from OpenSSL import crypto as SSLCrypto
      File "/usr/local/lib/python3.8/dist-packages/OpenSSL/__init__.py", line 8, in <module>
        from OpenSSL import crypto, SSL
      File "/usr/local/lib/python3.8/dist-packages/OpenSSL/crypto.py", line 1553, in <module>
        class X509StoreFlags(object):
      File "/usr/local/lib/python3.8/dist-packages/OpenSSL/crypto.py", line 1573, in X509StoreFlags
        CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK
    AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'
    2022-11-11 15:09:02,319 23800 CRITICAL ? odoo.modules.module: Couldn't load module base
    2022-11-11 15:09:02,319 23800 CRITICAL ? odoo.modules.module: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'
    2022-11-11 15:09:02,319 23800 ERROR ? odoo.service.server: Failed to load server-wide module `base`.

Using these recommendations: https://github.com/odoo/odoo/issues/99809 and https://github.com/odoo/odoo/pull/99829, I have already tried to change the requirements file (pyopenssl==22.0.0 and cryptography==37.0.2):

    root@localhost:/odoo/odoo-server# sudo pip install -r /odoo/odoo-server/requirements.txt

Output:

    Installing collected packages: cryptography, pyopenssl
      Attempting uninstall: cryptography
        Found existing installation: cryptography 38.0.3
        Uninstalling cryptography-38.0.3:
          Successfully uninstalled cryptography-38.0.3
      Attempting uninstall: pyopenssl
        Found existing installation: pyOpenSSL 22.1.0
        Uninstalling pyOpenSSL-22.1.0:
          Successfully uninstalled pyOpenSSL-22.1.0
    Successfully installed cryptography-37.0.2 pyopenssl-20.0.1

The recommandations for Odoo15 are different: https://github.com/ForgeFlow/odoo/blob/4a7a8f32862bd7fbf1afa5c26de6d97de46eea5b/requirements.txt

But after re-launching odoo, the error still remains. Any idea please ?


Solution

  • I have eventually managed to find the compatible versions using the ones in odoo15's requirements.txt file:

    And then re-install my requirements file for odoo16 on my server:

    sudo pip install -r /odoo/odoo-server/requirements.txt