Skip to content

importing omnipath from pypath results in AttributeError #317

Description

@dmalzl

Describe the bug
I am currently trying to use pypath in a custom pipeline. For this I created a conda environment with python 3.13.5 and tried to go through the pypath book. importing pypath works without problems but when I try to import omnipath from pypath I get the following error message (message is truncated for clarity)

File ~/miniconda3/envs/omnipath/lib/python3.13/site-packages/pypath/share/curl.py:76
     74     import pysftp
     75 except:
---> 76     _logger.msg(
     77         'Module `pysftp` not available. '
     78         'Only downloading of a small number of resources '
     79         'relies on this module. '
     80         'Please install by PIP if it is necessary for you.',
     81         'curl',
     82         -1,
     83     )
     84 import codecs
     85 import gzip

AttributeError: 'NoneType' object has no attribute 'msg'

To Reproduce
Steps to reproduce the behavior:

  1. run pip install pypath-omnipath
  2. In python run from pypath import omnipath

Expected behavior
importing omnipath module without any errors

Traceback

In [1]: from pypath import omnipath
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
File ~/miniconda3/envs/omnipath/lib/python3.13/site-packages/pypath/share/curl.py:74
     73 try:
---> 74     import pysftp
     75 except:

File ~/miniconda3/envs/omnipath/lib/python3.13/site-packages/pysftp/__init__.py:14
     13 from paramiko import SSHException, AuthenticationException   # make available
---> 14 from paramiko import AgentKey, RSAKey, DSSKey
     16 from pysftp.exceptions import (CredentialException, ConnectionException,
     17                                HostKeysException)

ImportError: cannot import name 'DSSKey' from 'paramiko' (/Users/dmalzl/miniconda3/envs/omnipath/lib/python3.13/site-packages/paramiko/__init__.py)

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
Cell In[1], line 1
----> 1 from pypath import omnipath

File ~/miniconda3/envs/omnipath/lib/python3.13/site-packages/pypath/omnipath/__init__.py:25
     23 from pypath.share import session as _session_mod
     24 from pypath.share import settings as _settings_mod
---> 25 from pypath.omnipath import app as _app_mod
     28 _logger = _session_mod.Logger(name = 'omnipath.init')
     29 _log = _logger._log

File ~/miniconda3/envs/omnipath/lib/python3.13/site-packages/pypath/omnipath/app.py:34
     31 import collections
     32 import itertools
---> 34 import pypath.resources.network as netres
     35 from pypath.core import annot
     36 from pypath.core import intercell

File ~/miniconda3/envs/omnipath/lib/python3.13/site-packages/pypath/resources/network.py:20
      1 #!/usr/bin/env python
      2 # -*- coding: utf-8 -*-
      3
   (...)     17 #  Website: https://pypath.omnipathdb.org/
     18 #
---> 20 import pypath.resources._network as _netres
     21 import pypath.resources as _resources
     22 import pypath.internals.resource as _resfmt

File ~/miniconda3/envs/omnipath/lib/python3.13/site-packages/pypath/resources/_network.py:25
     22 import copy
     24 import pypath.internals.resource as resource
---> 25 import pypath.resources.data_formats as data_formats
     26 import pypath.share.session as session_mod
     27 import pypath.share.settings as settings

File ~/miniconda3/envs/omnipath/lib/python3.13/site-packages/pypath/resources/data_formats.py:26
     23 import copy
     25 # from pypath:
---> 26 import pypath.internals.input_formats as input_formats
     27 import pypath.resources.urls as urls
     28 import pypath.share.common as common

File ~/miniconda3/envs/omnipath/lib/python3.13/site-packages/pypath/internals/input_formats.py:27
     25 import pypath.share.session as session
     26 import pypath_common._constants as _const
---> 27 import pypath.inputs.uniprot_idmapping as uniprot_idmapping
     28 import pypath.inputs.unichem as unichem_input
     30 _logger = session.Logger(name = 'input_formats')

File ~/miniconda3/envs/omnipath/lib/python3.13/site-packages/pypath/inputs/uniprot_idmapping.py:27
     24 import pandas as pd
     26 import pypath.resources.urls as urls
---> 27 import pypath.share.curl as curl
     30 def idtypes(
     31         pairs: bool = True,
     32         raw: bool = False,
     33     ) -> dict[str, pd.DataFrame] | set[tuple[str, str]] | dict:
     34     """
     35     Identifier types in the UniProt ID mapping service.
     36
   (...)     46         otherwise a set of tuples of ID types.
     47     """

File ~/miniconda3/envs/omnipath/lib/python3.13/site-packages/pypath/share/curl.py:76
     74     import pysftp
     75 except:
---> 76     _logger.msg(
     77         'Module `pysftp` not available. '
     78         'Only downloading of a small number of resources '
     79         'relies on this module. '
     80         'Please install by PIP if it is necessary for you.',
     81         'curl',
     82         -1,
     83     )
     84 import codecs
     85 import gzip

AttributeError: 'NoneType' object has no attribute 'msg'

Log file
No other lines run

Desktop (please complete the following information):

  • OS: MacOS Tahoe 26.2
  • Python version: 3.13.5
  • Version or commit hash 0.16.20

Additional context
None

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugProblem in the code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions