Python Noob: Installed reviewboard 5.0.2, incompatible dependency, borked python3

25 views
Skip to first unread message

Astro Jetson

unread,
Mar 2, 2023, 4:36:59 PM3/2/23
to Review Board Community
Installed reviewboard 5.0.2, recieved the following Error:
ERROR: paramiko 3.0.0 has requirement cryptography>=3.3, but you'll have cryptography 2.8 which is incompatible.

tried to fix paramiko error with pip3 install cryptography=3.3.0
Borked Python3 

  File "/usr/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
  File "/usr/lib/python3/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 664, in <module>
    _lib.Cryptography_HAS_TLSEXT_HOSTNAME, "SNI not available"

Commented out offending line in SSL.py
re-installed pip3 install cryptography=2.8.0.

Looked at the paramiko site, 3.0.0 introduced a lot of breaking changes.  I'll install the last 2.x version:  downgarded using:
pip3 install ---force-reinstall paramiko=2.12.0.
(That was the advice I read in multiple paces.)  a bunch of stuff was reinstalled, including cryptography 39.0.0!
Now pip3 won't run.  The old comment out the offending line trick isn't working. Too much to comment out.

So where to go from here?  Do I have to reinstall reviewboard from scratch? pip3?  All of Python3?  Wipe out the VM?

How?  pip3 does not run


  

Christian Hammond

unread,
Mar 2, 2023, 4:46:49 PM3/2/23
to revie...@googlegroups.com
Hi Astro,

I can help you out here, but first, what version of Python do you have installed?

Paramiko 3.0 and cryptography 3.3 should be working, and both advertise the versions of Python that Review Board 5.0.2 supports, so I want to first check on your system install.

What Linux distro is installed there?

And can you show me the full output from the failing pip3?

Christian


--
Supercharge your Review Board with Power Pack: https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups "Review Board Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reviewboard/077ae915-681b-42c9-b811-b5342a09efa5n%40googlegroups.com.


--
Christian Hammond
President/CEO of Beanbag
Makers of Review Board

Astro Jetson

unread,
Mar 2, 2023, 5:01:35 PM3/2/23
to Review Board Community
Ubuntu 20.04 LTS, Python 3.8

root@some-vm:/home/jet...@some.company# pip3 install --force-reinstall paramiko==2.12.0
Collecting paramiko==2.12.0
  Downloading paramiko-2.12.0-py2.py3-none-any.whl (213 kB)
     |████████████████████████████████| 213 kB 9.5 MB/s
Collecting cryptography>=2.5
  Downloading cryptography-39.0.1-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.2 MB)
     |████████████████████████████████| 4.2 MB 108.6 MB/s
Collecting bcrypt>=3.1.3
  Using cached bcrypt-4.0.1-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (593 kB)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting pynacl>=1.0.1
  Using cached PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB)
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (442 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
ERROR: launchpadlib 1.10.13 requires testresources, which is not installed.
Installing collected packages: pycparser, cffi, cryptography, bcrypt, six, pynacl, paramiko
  Attempting uninstall: pycparser
    Found existing installation: pycparser 2.21
    Uninstalling pycparser-2.21:
      Successfully uninstalled pycparser-2.21
  Attempting uninstall: cffi
    Found existing installation: cffi 1.15.1
    Uninstalling cffi-1.15.1:
      Successfully uninstalled cffi-1.15.1
  Attempting uninstall: cryptography
    Found existing installation: cryptography 2.8
    Uninstalling cryptography-2.8:
      Successfully uninstalled cryptography-2.8
  Attempting uninstall: bcrypt
    Found existing installation: bcrypt 4.0.1
    Uninstalling bcrypt-4.0.1:
      Successfully uninstalled bcrypt-4.0.1
  Attempting uninstall: six
    Found existing installation: six 1.16.0
    Uninstalling six-1.16.0:
      Successfully uninstalled six-1.16.0
  Attempting uninstall: pynacl
    Found existing installation: PyNaCl 1.5.0
    Uninstalling PyNaCl-1.5.0:
      Successfully uninstalled PyNaCl-1.5.0
  Attempting uninstall: paramiko
    Found existing installation: paramiko 3.0.0
    Uninstalling paramiko-3.0.0:
      Successfully uninstalled paramiko-3.0.0
Successfully installed bcrypt-4.0.1 cffi-1.15.1 cryptography-39.0.1 paramiko-2.12.0 pycparser-2.21 pynacl-1.5.0 six-1.16.0

Looking at this, not so disasterous, everything that was un installed was re installed at the same version.  I only have to backdate cryptography-39.0.1 to 2.8.0.  prolem is:  pip won't run. I get the following:
<snip>
Original exception was:
Traceback (most recent call last):
  File "/usr/bin/pip3", line 11, in <module>
    load_entry_point('pip==20.0.2', 'console_scripts', 'pip3')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
    from pip._internal.exceptions import CommandError
  File "/usr/lib/python3/dist-packages/pip/_internal/exceptions.py", line 10, in <module>
    from pip._vendor.six import iteritems
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 65, in <module>
    vendored("cachecontrol")
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
    __import__(modulename, globals(), locals(), level=0)
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/__init__.py", line 9, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/wrapper.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/adapter.py", line 5, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl/requests/__init__.py", line 95, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module

  File "/usr/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
  File "/usr/lib/python3/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1553, in <module>
    class X509StoreFlags(object):
  File "/usr/lib/python3/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'

Tried commenting out the offending line (worked last time) didn't this time, reverted file.


PS: Windows developer since 1991, old dogs and such.

Christian Hammond

unread,
Mar 2, 2023, 5:22:01 PM3/2/23
to revie...@googlegroups.com
Seems this is a pretty widespread Python-on-Ubuntu 22.04 bug, with the bundled OpenSSL and modern versions of cryptography. The 22.04 version seems to have this fixed in the distro-bundled OpenSSL library, and a newer pyOpenSSL library would also do the trick.

Details on the bug are here: https://github.com/pyca/pyopenssl/issues/1143

It's a system-level bug, but we'll test whether we can upgrade our pyOpenSSL dependency to work around the documented issue, bypassing the buggy Ubuntu-provided version.

So to resolve this, what we'll need to do is get rid of the system-provided pip and install a newer version that should (hopefully) bypass this and come with more compatible packages. Try:

    sudo apt remove python3-pip
    sudo python3 get-pip.py

That's the official installer for pip, which bundles everything it needs to install itself. That should do the right thing, and allow you to resolve the issue.

You probably then want to upgrade pyOpenSSL instead of downgrading cryptography, as other packages may in time require newer versions of cryptography:

    sudo pip3 install -U pyOpenSSL

See if that works. If anything breaks, stop and send me all output, and we'll move onto the next step.

We will be able to get this working again.

Christian




Message has been deleted

Astro Jetson

unread,
Mar 2, 2023, 6:11:37 PM3/2/23
to Review Board Community
pip3 works.  looks like everything is ready to go.  Thanks so much
Reply all
Reply to author
Forward
0 new messages