I'm trying to replicate some Python code on a Github website. I'm running Python3.6.8 in a conda environment.
import numpy as np
import os.path
from data import DataSet
I get the Error:
Traceback (most recent call last):
File "extract_features.py", line 16, in <module>
from data import DataSet
ImportError: cannot import name 'DataSet'
I am not sure which module is causing this error. python -c "import data" gives no error.
Related
I am trying to run ID Card Segmentation (MIDV-500) on my Ubuntu machine.
I need to run some files, and one of them is "train.py".
when i run "train.py" i get an error message on the Import section.
(the full repository - https://github.com/AdivarekarBhumit/ID-Card-Segmentation)
i try to import:
import cv2
import numpy as np
from sklearn.model_selection import train_test_split
from keras.callbacks import TensorBoard, ModelCheckpoint
from .unet_model import get_model
the error on the Terminal:
/Downloads/ID-Card-Segmentation/model$ python train.py
Using TensorFlow backend.
Traceback (most recent call last):
File "train.py", line 5, in <module>
from .unet_model import get_model
ModuleNotFoundError: No module named '__main__.unet_model'; '__main__' is not a package
how to fix that?
I am using jupyter nb running python 3.9.1 using pip to install modules etc.
All imports work smoothly except missingno.
All the modules being imported are located in the same location Python39\lib\site-packages but missingno results in Import Error.
The missingno module had been imported and it has run smoothly before but after a kernel restart, the Import Error cropped up.
ImportError Traceback (most recent call last)
<ipython-input-16-fad26a6fb4fe> in <module>
6 #Visualization
7 import matplotlib.pyplot as plt
----> 8 import missingno
9 import seaborn as sns
10 plt.style.use('seaborn-whitegrid')
~\AppData\Local\Programs\Python\Python39\Lib\site-packages\missingno\missingno.py in <module>
6 import seaborn as sns
7 import pandas as pd
----> 8 from .utils import nullity_filter, nullity_sort
9 import warnings
10
ImportError: attempted relative import with no known parent package
How to fix it?
I have tried to delete the missingno files and reinstalling it using pip install missingno but nothing works.
Running Python in shell and importing missingno, I still get the same error. There is nothing fancy in my code, a simple, generic import which showed no signs of error before kernel restart.
>>> import missingno
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\OK\AppData\Local\Programs\Python\Python39\Lib\site-packages\missingno\missingno.py", line 8, in <module>
from .utils import nullity_filter, nullity_sort
ImportError: attempted relative import with no known parent package
Try opening the missingno.py file in site-packages.
Change
from .utils import nullity_filter, nullity_sort
to
from utils import nullity_filter, nullity_sort
I have got the following traceback error when importing pandas. I have installed all packages using anaconda3 distribution and also verified everything seems alright. When I use conda search numpy on command prompt also returns the installed packages. But if I try to import pandas as pd it throws an error.(numpy: No module named 'logging.handlers'; 'logging' is not a package) Need some guidance here.
Traceback (most recent call last):
File "1.py", line 1, in <module>
import pandas as pd
File "E:\Anaconda3\envs\venv\lib\site-packages\pandas\__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy: No module named 'logging.handlers'; 'logging' is not a package
I have a logging.py file on my project directory. After renaming the file also returns following error
Traceback (most recent call last):
File "1.py", line 1, in <module>
import pandas as pd
File "E:\Anaconda3\envs\venv\lib\site-packages\pandas\__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy: attempted relative import with no known parent package
After changing the entire project to a new directory resolves the issue.
I am trying to utilize pandas data reader in my program
from pandas_datareader import data
from pandas_datareader.utils import RemoteDataError
but when i run it a get an error
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pandas_datareader\compat\__init__.py:7: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead.
from pandas.util.testing import assert_frame_equal
Traceback (most recent call last):
File ".\tradingBOT.py", line 2, in <module>
from pandas_datareader.utils import RemoteDataError
ModuleNotFoundError: No module named 'pandas_datareader.utils'
I used pip to install pandas-datareader and it worked without a problem
Instead of typing this:
from pandas_datareader.utils import RemoteDataError
I tried this:
from pandas_datareader._utils import RemoteDataError
I don't know if there's a difference, but everything seems to be working!
I have installed numpy 1.16.4 and pandas 0.24.2. However i still get below error message;
Traceback (most recent call last):
File "C:\Users\FLUXNATURE\Desktop\khady_01\pandas.py", line 8, in'module'
import pandas as pd
File "C:\Users\FLUXNATURE\Desktop\khady_01\pandas.py", line 9, in 'module'
df = pd.read_excel(r'C:\Users\FLUXNATURE\Desktop\use.xlsx')
AttributeError: module 'pandas' has no attribute 'read_excel'
when running the code below:
import pandas as pd
df = pd.read_excel(r'C:\Users\FLUXNATURE\Desktop\use.xlsx')
print(df)
I'm running this file in Anaconda prompt with windows. Kindly help on this.