Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to import pandas (pandas._libs.window.aggregations)

I've lost a couple of hours trying to solve this so I guess it's time to ask someone/somehwere.

I (think) I have uninstalled everything related to python and than installed again. I just installed python most recent version and used pip to install pandas. I also try to install it with anaconda but the error persists. I've also tried installing directly from github but was unsuccessful. I'm using windows 10.

C:\Users\m>python -V
Python 3.8.2

C:\Users\m>pip install pandas
Collecting pandas
  Downloading https://files.pythonhosted.org/packages/07/12/5a087658337a230f4a77e3d548c847e81aa59b332cdd8ddf5c8d7f11c4a1/pandas-1.0.3-cp38-cp38-win32.whl (7.6MB)
     |████████████████████████████████| 7.6MB 3.3MB/s
Collecting pytz>=2017.2 (from pandas)
  Downloading https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl (509kB)
     |████████████████████████████████| 512kB 3.2MB/s
Collecting python-dateutil>=2.6.1 (from pandas)
  Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
     |████████████████████████████████| 235kB 6.4MB/s
Collecting numpy>=1.13.3 (from pandas)
  Downloading https://files.pythonhosted.org/packages/5d/b3/f3543d9919baa11afc24adc029a25997821f0376e5fab75fdc16e13469db/numpy-1.18.2-cp38-cp38-win32.whl (10.8MB)
     |████████████████████████████████| 10.8MB 6.4MB/s
Requirement already satisfied: six>=1.5 in c:\users\m\appdata\roaming\python\python38\site-packages (from python-dateutil>=2.6.1->pandas) (1.13.0)
Installing collected packages: pytz, python-dateutil, numpy, pandas
Successfully installed numpy-1.18.2 pandas-1.0.3 python-dateutil-2.8.1 pytz-2019.3
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\m>python
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\__init__.py", line 55, in <module>
    from pandas.core.api import (
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\api.py", line 29, in <module>
    from pandas.core.groupby import Grouper, NamedAgg
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\groupby\__init__.py", line 1, in <module>
    from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\groupby\generic.py", line 60, in <module>
    from pandas.core.frame import DataFrame
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\frame.py", line 124, in <module>
    from pandas.core.series import Series
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\series.py", line 4572, in <module>
    Series._add_series_or_dataframe_operations()
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\generic.py", line 10349, in _add_series_or_dataframe_operations
    from pandas.core.window import EWM, Expanding, Rolling, Window
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\window\__init__.py", line 1, in <module>
    from pandas.core.window.ewm import EWM  # noqa:F401
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\window\ewm.py", line 5, in <module>
    import pandas._libs.window.aggregations as window_aggregations
ImportError: DLL load failed while importing aggregations: The specified module could not be found.
like image 286
Murilo Sitonio Avatar asked Mar 19 '20 19:03

Murilo Sitonio


People also ask

What is the current Pandas version?

Release notes — pandas 1.5.


2 Answers

I finally ended up trying a slightly older version of pandas to resolve this exact error. The default install was 1.0.3, so I backed up a couple of release points:

pip uninstall pandas
pip install pandas==1.0.1

Then I could import pandas without error

like image 73
Roger Avatar answered Nov 10 '22 01:11

Roger


It looks to me that Pandas 1.0.3 is not installing the DLLs in the "Lib\site-packages\pandas_libs\window" folder.

For me this worked:

Installing Pandas 1.0.1.

Then copying the these two DLLs from the folder somewhere safe

concrt140.dll
msvcp140.dll

Now update to Pandas 1.0.3

After that, the DLLs are missing. Move them back to the folder and the import runs fine.

like image 39
576i Avatar answered Nov 10 '22 03:11

576i