Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarily silence paramiko deprecation warning for cryptography #831

Open
corneliusroemer opened this issue Aug 8, 2024 · 2 comments
Open

Comments

@corneliusroemer
Copy link

When using smart_open with cryptograph >=43.0.0, one gets 2 deprecation warnings at program startup which is a bit annoying. It would be great if smart_open could temporarily silence this warning until there is a fix in paramiko.

See paramiko issue paramiko/paramiko#2419

I encountered this issue as a snakemake user, see snakemake/snakemake#3004

full traceback showing where paramiko is imported:

Traceback (most recent call last):

  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/snakemake/common/__init__.py", line 126, in parse_uri
    from smart_open import parse_uri

  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/smart_open/__init__.py", line 34, in <module>
    from .smart_open_lib import open, parse_uri, smart_open, register_compressor  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/smart_open/smart_open_lib.py", line 35, in <module>
    from smart_open import doctools

  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/smart_open/doctools.py", line 21, in <module>
    from . import transport

  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/smart_open/transport.py", line 105, in <module>
    register_transport("smart_open.ssh")

  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/smart_open/transport.py", line 49, in register_transport
    submodule = importlib.import_module(submodule)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/smart_open/ssh.py", line 37, in <module>
    import paramiko

  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/paramiko/__init__.py", line 22, in <module>
    from paramiko.transport import (

  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/paramiko/transport.py", line 93, in <module>
    from paramiko.dsskey import DSSKey

  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/paramiko/dsskey.py", line 37, in <module>
    from paramiko.pkey import PKey

  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/paramiko/pkey.py", line 23, in <module>
    raise Exception("import of paramiko")

Exception: import of paramiko
@ddelange
Copy link
Contributor

ddelange commented Aug 8, 2024

I think no changes needed on smart_open: this looks like a transient issue with a fix on the way: paramiko/paramiko#2421

for the time being you can pin/install cryptography<43 in your env

@ddelange
Copy link
Contributor

fixed as of paramiko 3.3.2, this issue can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants