Skip to content

Trouble importing and accessing omnipath from pypath #275

Open
@hcl1216

Description

@hcl1216

Hello,

When I try importing pypath or omnipath after installing it, I keep getting AttributeError: 'NoneType' object has no attribute 'msg'. However, it works fine if I delete the the last line of init.py: info(0).


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

File c:\Users\sundo\anaconda3\Lib\site-packages\pypath_init_.py:110
81 _session_mod.log().msg(
82 (
83 '\n'
(...)
106 wrap = False,
107 )
109 # include info at the beginning of the log:
--> 110 info(0)

File c:\Users\sundo\anaconda3\Lib\site-packages\pypath_init_.py:81, in info(loglevel)
76 def info(loglevel = -9):
77 """
78 Prints basic information about the current session.
79 """
---> 81 _session_mod.log().msg(
82 (
83 '\n'
84 '\t- session ID: %s\n'
85 '\t- working directory: %s\n'
...
105 level = loglevel,
106 wrap = False,
107 )

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

In addition, further error arises when I try accessing omnipath database.


NameError Traceback (most recent call last)
Cell In[9], line 1
----> 1 cu = omnipath.db.get_db('curated')
2 cu.make_df()
3 cu.df

File c:\Users\sundo\anaconda3\Lib\site-packages\pypath\omnipath\app.py:492, in DatabaseManager.get_db(self, dataset, ncbi_tax_id)
482 def get_db(self, dataset, ncbi_tax_id = 9606):
483 """
484 Returns a dataset object. Loads and builds the dataset if necessary.
485
(...)
489 files.
490 """
--> 492 self.ensure_dataset(dataset, ncbi_tax_id = ncbi_tax_id)
494 _dataset = self._dataset_taxid(dataset, ncbi_tax_id = ncbi_tax_id)
496 return getattr(self, _dataset)

File c:\Users\sundo\anaconda3\Lib\site-packages\pypath\omnipath\app.py:136, in DatabaseManager.ensure_dataset(self, dataset, force_reload, force_rebuild, ncbi_tax_id)
128 if (
129 force_rebuild or
130 self.rebuild or
131 rebuild_dataset or
132 not self.pickle_exists(dataset, ncbi_tax_id = ncbi_tax_id)
...
--> 323 if isinstance(value, _const.LIST_LIKE) else
324 getattr(self.resource, attr) == value
325 )

NameError: name '_const' is not defined

OS: Windows
Python version: 3.11.5

Apologies if this is a simple problem,

Thank you for your help

Metadata

Metadata

Assignees

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