I have just upgraded python and I cannot get pandas to run properly, please see below. Nothing appears to work.
Traceback (most recent call last): File
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tqdm/_tqdm.py",
line 613, in pandas
from pandas.core.groupby.groupby import DataFrameGroupBy, \ ImportError: cannot import name 'DataFrameGroupBy' from
'pandas.core.groupby.groupby'
(/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/groupby/groupby.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"code/analysis/get_cost_matrix.py", line 23, in
tqdm.pandas() # Gives us nice progress bars File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tqdm/_tqdm.py",
line 616, in pandas
from pandas.core.groupby import DataFrameGroupBy, \ ImportError: cannot import name 'PanelGroupBy' from 'pandas.core.groupby'
(/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/groupby/init.py)
I guess you are using an older version of tqdm. Try using a version above tqdm>=4.23.4.
The command using pip would be,
pip install tqdm --upgrade
The problem is with the 0.25.1 version of pandas. Consider downgrading it to 0.24.0.
For more information read this
pip install --upgrade pandas==0.24.0
Related
I have a simple python program which I am running on a Mac machine.
import numpy as np
def main():
print("np arr test")
arr = np.array([1.0, 2.0, 3.0])
print(arr)
if __name__ == "__main__":
main()
I've verified that the numpy library was correct installed through pip
pip3 list | grep numpy
msgpack-numpy 0.4.4.3
numpy 1.16.2
numpydoc 0.8.0
I get the following error when I run the program
Traceback (most recent call last):
File "/Volumes/brazil-pkg-cache/packages/Python-numpy/Python-numpy-1.x.140450.0/AL2012/DEV.STD.PTHREAD/build/lib/python3.6/site-packages/numpy/core/__init__.py", line 24, in <module>
from . import multiarray
File "/Volumes/brazil-pkg-cache/packages/Python-numpy/Python-numpy-1.x.140450.0/AL2012/DEV.STD.PTHREAD/build/lib/python3.6/site-packages/numpy/core/multiarray.py", line 14, in <module>
from . import overrides
File "/Volumes/brazil-pkg-cache/packages/Python-numpy/Python-numpy-1.x.140450.0/AL2012/DEV.STD.PTHREAD/build/lib/python3.6/site-packages/numpy/core/overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Volumes/workplace/RPAsosDevelopmentWS/src/RPAsosDevelopmentPy/src/rp_asos_development_py/adhoc_dev/float_nan_test.py", line 1, in <module>
import numpy as np
File "/Volumes/brazil-pkg-cache/packages/Python-numpy/Python-numpy-1.x.140450.0/AL2012/DEV.STD.PTHREAD/build/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
from . import core
File "/Volumes/brazil-pkg-cache/packages/Python-numpy/Python-numpy-1.x.140450.0/AL2012/DEV.STD.PTHREAD/build/lib/python3.6/site-packages/numpy/core/__init__.py", line 50, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.6 from "/usr/local/bin/python3.6"
* The NumPy version is: "1.18.4"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
Process finished with exit code 1
Can you please help me figure out what I am missing? Appreciate your response!
NOTE : Based on the stack overflow post I updated the numpy through the following command
pip3 install numpy --upgrade
pip3 list | grep numpy
msgpack-numpy 0.4.4.3
numpy 1.21.2
numpydoc 0.8.0
WARNING: You are using pip version 21.2.1; however, version 21.2.4 is available.
However I still see the error message
Try to uninstall numpy and install it again.
Normally when I've done pip uninstall <module> if I then try to import the module I get a ModuleNotFoundError, for example:
dino#DINO:~$ python -c 'import mplfinance as mpf;print(mpf.__file__)'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'mplfinance'
However, after activating a conda environment, the import works fine even when the package is unstalled both with pip uninstall and with conda remove, either way, I get:
dino#DINO:~$ python -c 'import mplfinance as mpf;print(mpf.__file__)'
None
Can anyone tell me why the import is NOT raising an exception, even though there is no module there to import??
This behavior (lack of import exception) appears to be related somehow to having activated a conda environment.
I cannot import any python package when running python on Visual Studio code or on my Terminal. I can still do this if I were to code on a Jupyter notebook. However, when I tried other environment that doesn't use the notebook server. It returns me ModuleNotFound Error like this
Traceback (most recent call last):
File "/Users/truongminh/Desktop/DataScience/Datasets/CityU Text/test_PreprocessText.py", line 1, in <module>
import PreprocessText
File "/Users/truongminh/Desktop/DataScience/Datasets/CityU Text/PreprocessText.py", line 1, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
Most of my packages was download via anaconda. I don't know if it might be the cause of this.
from python prompt:
>>> import avro
>>> import avro.schema
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'avro.schema'
>>> print(avro)
<module 'avro' (namespace)>
>>> print(avro.schema)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'avro' has no attribute 'schema'
specs:
deb9 x64, Python 3.6.4 and avro-python3 Version: 1.8.2, pip 9.0.1
virtualenv activated and avro got pip installed
is avro maintained or should i use fastavro, how to solve above, cant run basic examples from quickstart
Check your requirements.
It might be avro==1.8.2
The above error was coming for this requirement.
Changing the requirement to:
avro-python3==1.8.2 solved the problem for me.
Used pip install avro-python3 instead of pip install avro
My python version is 3.6. my OS is windows. After install rpy2 module, when I type import rpy2, got no issue. But when type import rpy2.ipython, got error as below:
>>> import rpy2.ipython
Warning (from warnings module):
File "D:\Soft_app\Python\lib\site-packages\rpy2\ipython\rmagic.py", line 76
"either.")))
UserWarning: The Python package 'pandas' is strongly recommended when using `rpy2.ipython`. Unfortunately it could not be loaded, and we did not manage to load 'numpy' either.
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import rpy2.ipython
File "D:\Soft_app\Python\lib\site-packages\rpy2\ipython\__init__.py", line 1, in <module>
from .rmagic import load_ipython_extension
File "D:\Soft_app\Python\lib\site-packages\rpy2\ipython\rmagic.py", line 81, in <module>
from IPython.core.displaypub import publish_display_data
ModuleNotFoundError: No module named 'IPython'
Can help to figure out what's issue??
It seems that you are missing Ipython and pandas. Installing them should resolve your issue.
Run "pip install ipython" to install Ipython and run "pip install pandas" to install pandas.
Hopefully, this will solve your problem.
Happy Coding ~