Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Circular import ?

See original GitHub issue

Hello everyone,

I tried to add some new files to braindecode.datautil, and weren’t able to load them properly. During the process, I found one error : Input : from braindecode.datautil import * Output :

ImportError                               Traceback (most recent call last)
<ipython-input-5-81dbcb36302e> in <module>
----> 1 from braindecode.datautil import *

~/miniconda3/lib/python3.7/site-packages/braindecode/datautil/ in <module>
      3 """
----> 5 from .windowers import create_windows_from_events, create_fixed_length_windows
      6 from .preprocess import zscore, scale, exponential_moving_demean, exponential_moving_standardize

~/miniconda3/lib/python3.7/site-packages/braindecode/datautil/ in <module>
     13 import pandas as pd
---> 15 from ..datasets.base import WindowsDataset, BaseConcatDataset

~/miniconda3/lib/python3.7/site-packages/braindecode/datasets/ in <module>
      5 from .moabb import MOABBDataset
      6 from .tuh import TUHAbnormal
----> 7 from .mne import create_from_mne_raw, create_from_mne_epochs
      8 from .xy import create_from_X_y

~/miniconda3/lib/python3.7/site-packages/braindecode/datasets/ in <module>
      5 from .base import BaseDataset, BaseConcatDataset, WindowsDataset
----> 6 from ..datautil.windowers import (
      7     _check_windowing_arguments, create_windows_from_events)

ImportError: cannot import name '_check_windowing_arguments' from 'braindecode.datautil.windowers' (/home/parietal/sfreybur/miniconda3/lib/python3.7/site-packages/braindecode/datautil/

Cause seems to be a circular import, but I am not confident enough to change the code organisation by myself.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

sepahsaalaar93commented, Nov 11, 2020

Hi @robintibor I have the same problem and same errors when trying to import “create_from_X_y” by this command: from braindecode.datautil import create_from_X_y After moving imports in above mentioned “” and "" I still can’t import “create_from_X_y” and I got this error: "Traceback (most recent call last):

File “<ipython-input-1-94a865e0cc4c>”, line 1, in <module> from braindecode.datautil import create_from_X_y

ImportError: cannot import name ‘create_from_X_y’ from ‘braindecode.datautil’ (D:\anaconda3\envs\torch\lib\site-packages\braindecode\"

robintiborcommented, Jul 7, 2020

solved by #131

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Circular Imports - Stack Abuse
Circular importing is a form of circular dependency that is created with the import statement in Python. For example, let's analyze the ...
Read more >
Why do circular imports seemingly work further up in the call ...
I think the answer by jpmc26, while by no means wrong, comes down too heavily on circular imports. They can work just fine,...
Read more >
Python Circular Imports Module: Solving Circular Import Problem
Python Circular Imports is a type of Circular dependency. It occurs in python when two or more models import each other and it...
Read more >
Avoiding Circular Imports in Python | by André Menck - Medium
This is pretty obvious when you think about it for a second, but the key insight here is that the “circular” import exists...
Read more >
Python Circular Import Problem and Solutions
Generally, the Python Circular Import problem occurs when you accidentally name your working file the same as the module name and those modules ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found