Circular import ?
See original GitHub issueHello 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/__init__.py in <module>
3 """
4
----> 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/windowers.py in <module>
13 import pandas as pd
14
---> 15 from ..datasets.base import WindowsDataset, BaseConcatDataset
16
17
~/miniconda3/lib/python3.7/site-packages/braindecode/datasets/__init__.py 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/mne.py in <module>
4
5 from .base import BaseDataset, BaseConcatDataset, WindowsDataset
----> 6 from ..datautil.windowers import (
7 _check_windowing_arguments, create_windows_from_events)
8
ImportError: cannot import name '_check_windowing_arguments' from 'braindecode.datautil.windowers' (/home/parietal/sfreybur/miniconda3/lib/python3.7/site-packages/braindecode/datautil/windowers.py)
Cause seems to be a circular import, but I am not confident enough to change the code organisation by myself.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 “mne.py” and " windowers.py" 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\datautil_init_.py)"
solved by #131