ModuleNotFoundError: No module named 'pandas_datareader.utils' - python

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!

Related

numpy dependencies thrown an error when importing pandas to my python project

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.

Error Import awswrangler: AttributeError: module 'multiprocessing' has no attribute 'connection'

I have a python script that uses the lib awswrangler. Today my scrpit started to give errors in the import of the library and I don't know what is happening.
I'm running the script in a docker container with image python: 3.8
Example:
import awswrangler as wr
print(wr.__version__)
Error:
Traceback (most recent call last):
File "src/avec/automation/TaskBaseUserPass.py", line 1, in <module>
from awswrangler.pandas import Pandas
File "/usr/local/lib/python3.8/site-packages/awswrangler/__init__.py", line 17, in <module>
from awswrangler.pandas import Pandas # noqa
File "/usr/local/lib/python3.8/site-packages/awswrangler/pandas.py", line 45, in <module>
class Pandas:
File "/usr/local/lib/python3.8/site-packages/awswrangler/pandas.py", line 273, in Pandas
def _read_csv_once_remote(send_pipe: mp.connection.Connection, session_primitives: "SessionPrimitives",
AttributeError: module 'multiprocessing' has no attribute 'connection'
I have been experienced the same issue today when trying to import awswrangler. For me, downgrading the following dependencies helped:
pip install fsspec==0.6.3 PyAthena==1.10.2 s3fs==0.4.0
It seems that one or more of them were causing the problem.
If your code uses multiprocessing.connection.Listener or multiprocessing.connection.Client, then you should use:
import multiprocessing.connection
If you just use
import multiprocessing
.. then your code might get an ImportError or not. It depends on other modules. If an other module imports multiprocessing.connection, then it will work.
But I guess you don't want random behavior, and that's why you should import multiprocessing.connection.
I managed to run version 3.6, the library has a problem with mp.connection.Connection in current python versions

ModuleNotFoundError: No module named 'pandas' in Pycharm

import pandas as pd
while running this code I have the following error.
C:\Users\user3\PycharmProjects\Customer_Revieww\venv\Scripts\python.exe C:/Users/user3/PycharmProjects/Customer_Revieww/venv/cust_rev.py
Traceback (most recent call last):
File "C:/Users/user3/PycharmProjects/Customer_Revieww/venv/cust_rev.py", line 1, in <module>
import pandas
ModuleNotFoundError: No module named 'pandas'
please provide solution.
Thank you in advance
You need to instal the module in the environment you are using in PyCharm.
This can be done from command line:
pip install pandas
As well as in PyCharm itself - see this video.

Can not import the package which i installed via Pycharm(pandas-datareader

Can not import pandas_datareader package. Python told me that No module named 'pandas_datareader'
installed the pandas_datareader via pycharm.
import pandas.datareader as web
Traceback (most recent call last):
File "<ipython-input-4-0106485ab891>", line 1, in <module>
import pandas.datareader as web
ImportError: No module named 'pandas.datareader'
for p in sys.path:
print(p)
C:\Users\ilike\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\utils\site
C:\Users\ilike\AppData\Local\Continuum\Anaconda3\python35.zip
C:\Users\ilike\AppData\Local\Continuum\Anaconda3\DLLs
C:\Users\ilike\AppData\Local\Continuum\Anaconda3\lib
C:\Users\ilike\AppData\Local\Continuum\Anaconda3
C:\Users\ilike\AppData\Local\Continuum\Anaconda3\lib\site-packages
C:\Users\ilike\AppData\Local\Continuum\Anaconda3\lib\site-packages\Sphinx-1.3.5-py3.5.egg
C:\Users\ilike\AppData\Local\Continuum\Anaconda3\lib\site-packages\win32
C:\Users\ilike\AppData\Local\Continuum\Anaconda3\lib\site-packages\win32\lib
C:\Users\ilike\AppData\Local\Continuum\Anaconda3\lib\site-packages\Pythonwin
C:\Users\ilike\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\extensions
C:\Users\ilike\.ipython
What about import pandas_datareader as web ?

from data import DataSet

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.

Categories

Resources