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

Circular Import errors on the latest version #288

Open
austinv11 opened this issue Mar 7, 2024 · 0 comments
Open

Circular Import errors on the latest version #288

austinv11 opened this issue Mar 7, 2024 · 0 comments
Labels
bug Problem in the code

Comments

@austinv11
Copy link

austinv11 commented Mar 7, 2024

Describe the bug
There was a circular import error that I believe was introduced by this commit: 05f13be

This prevents me from making use of the omnipath database.

To Reproduce
Steps to reproduce the behavior:

from pypath import omnipath
op = omnipath.db.get_db('curated', ncbi_tax_id=9606)   # Circular import error here

Expected behavior
No exceptions

Traceback

Traceback (most recent call last):
  File "/Users/austinv11/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode
    coro = func()
  File "<input>", line 1, in <module>
  File "/Users/austinv11/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/homebrew/anaconda3/envs/riot/lib/python3.10/site-packages/pypath/omnipath/__init__.py", line 25, in <module>
    from pypath.omnipath import app as _app_mod
  File "/Users/austinv11/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/homebrew/anaconda3/envs/riot/lib/python3.10/site-packages/pypath/omnipath/app.py", line 34, in <module>
    import pypath.resources.network as netres
  File "/Users/austinv11/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/homebrew/anaconda3/envs/riot/lib/python3.10/site-packages/pypath/resources/network.py", line 25, in <module>
    import pypath.resources.data_formats as data_formats
  File "/Users/austinv11/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/homebrew/anaconda3/envs/riot/lib/python3.10/site-packages/pypath/resources/data_formats.py", line 26, in <module>
    import pypath.internals.input_formats as input_formats
  File "/Users/austinv11/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/homebrew/anaconda3/envs/riot/lib/python3.10/site-packages/pypath/internals/input_formats.py", line 27, in <module>
    import pypath.inputs.uniprot as uniprot_input
  File "/Users/austinv11/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/homebrew/anaconda3/envs/riot/lib/python3.10/site-packages/pypath/inputs/uniprot.py", line 41, in <module>
    import pypath.utils.taxonomy as taxonomy
  File "/Users/austinv11/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/homebrew/anaconda3/envs/riot/lib/python3.10/site-packages/pypath/utils/__init__.py", line 20, in <module>
    from . import orthology as homology
  File "/Users/austinv11/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/homebrew/anaconda3/envs/riot/lib/python3.10/site-packages/pypath/utils/orthology.py", line 45, in <module>
    import pypath.utils.mapping as mapping
  File "/Users/austinv11/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/homebrew/anaconda3/envs/riot/lib/python3.10/site-packages/pypath/utils/mapping.py", line 65, in <module>
    import pypath.internals.maps as maps
  File "/Users/austinv11/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/opt/homebrew/anaconda3/envs/riot/lib/python3.10/site-packages/pypath/internals/maps.py", line 31, in <module>
    input_formats.UniprotMapping(
AttributeError: partially initialized module 'pypath.internals.input_formats' has no attribute 'UniprotMapping' (most likely due to a circular import)

Log file
No additional logs.

Desktop (please complete the following information):

  • OS: macOS
  • Python version: 3.10
  • Version or commit hash: v0.16.10

Additional context
This error goes away when downgrading to 0.16.9

@austinv11 austinv11 added the bug Problem in the code label Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Problem in the code
Projects
None yet
Development

No branches or pull requests

1 participant