Repository: pandas-dev/pandas

Issue:
Pandas 0.23.0 gives ImportError: DLL load failed
Installed pandas not able to import with:

```
ImportError: DLL load failed: The specified module could not be found.
```

As far as we know, this happens if you install with pip on Windows 32bit machines (if you have another case, please comment below with specifying your OS, Python version, how you installed pandas, ..).

**Workaround for now is to keep your version at pandas 0.22.0.** (or to install using conda, or to install VS tools for C++, see https://github.com/pandas-dev/pandas/issues/21106#issuecomment-391459521)

We will fix this problem for 0.23.1.

---
original post:

#### Code Sample, a copy-pastable example if possible

```python
import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\lfletcher\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pandas\__init__.py", line 42, in <module>
    from pandas.core.api import *
  File "C:\Users\lfletcher\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pandas\core\api.py", line 10, in <module>
    from pandas.core.groupby.groupby import Grouper
  File "C:\Users\lfletcher\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pandas\core\groupby\__init__.py", line 2, in <module>
    from pandas.core.groupby.groupby import (
  File "C:\Users\lfletcher\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pandas\core\groupby\groupby.py", line 49, in <module>
    from pandas.core.frame import DataFrame
  File "C:\Users\lfletcher\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pandas\core\frame.py", line 74, in <module>
    from pandas.core.series import Series
  File "C:\Users\lfletcher\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pandas\core\series.py", line 3978, in <module>
    Series._add_series_or_dataframe_operations()
  File "C:\Users\lfletcher\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pandas\core\generic.py", line 8891, in _add_series_or_dataframe_operation
s
    from pandas.core import window as rwindow
  File "C:\Users\lfletcher\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pandas\core\window.py", line 36, in <module>
    import pandas._libs.window as _window
ImportError: DLL load failed: The specified module could not be found.



Discussion:
How'd you install pandas?
I used pip install pandas

On 5/17/18, Tom Augspurger <notifications@github.com> wrote:
> How'd you install pandas?
>
> --
> You are receiving this because you authored the thread.
> Reply to this email directly or view it on GitHub:
> https://github.com/pandas-dev/pandas/issues/21106#issuecomment-389951948

the version is 0.23.0

On 5/17/18, Manish <manishkumar.bobbili3@gmail.com> wrote:
> I used pip install pandas
>
> On 5/17/18, Tom Augspurger <notifications@github.com> wrote:
>> How'd you install pandas?
>>
>> --
>> You are receiving this because you authored the thread.
>> Reply to this email directly or view it on GitHub:
>> https://github.com/pandas-dev/pandas/issues/21106#issuecomment-389951948
>

Can you paste the output from your pip install?
when i installed from pip it successfully installed. I didnt see any errors

On 5/17/18, Tom Augspurger <notifications@github.com> wrote:
> Can you paste the output from your pip install?
>
> --
> You are receiving this because you authored the thread.
> Reply to this email directly or view it on GitHub:
> https://github.com/pandas-dev/pandas/issues/21106#issuecomment-389954577

And what was the output? You can uninstall and reinstall to get the log, if
you don't have it anymore.

On Thu, May 17, 2018 at 1:49 PM, manish59 <notifications@github.com> wrote:

> when i installed from pip it successfully installed. I didnt see any errors
>
> On 5/17/18, Tom Augspurger <notifications@github.com> wrote:
> > Can you paste the output from your pip install?
> >
> > --
> > You are receiving this because you authored the thread.
> > Reply to this email directly or view it on GitHub:
> > https://github.com/pandas-dev/pandas/issues/21106#issuecomment-389954577
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/issues/21106#issuecomment-389970033>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABQHIhnYGqVV7gVU6UpLsqcbfqlWGofsks5tzcYogaJpZM4UDf0A>
> .
>

Collecting pandas
  Using cached https://files.pythonhosted.org/packages/a2/f1/9c90efc7a128c3336bca8ceb38374c2ba97b90d590e3bb9a2cca1c87fda9/pandas-0.23.0-cp36-cp36m-win32.whl
Requirement already satisfied: pytz>=2011k in
c:\users\lfletcher\appdata\local\programs\python\python36-32\lib\site-packages
(from pandas)
Requirement already satisfied: numpy>=1.9.0 in
c:\users\lfletcher\appdata\local\programs\python\python36-32\lib\site-packages
(from pandas)
Requirement already satisfied: python-dateutil>=2.5.0 in
c:\users\lfletcher\appdata\local\programs\python\python36-32\lib\site-packages
(from pandas)
Requirement already satisfied: six>=1.5 in
c:\users\lfletcher\appdata\local\programs\python\python36-32\lib\site-packages
(from python-dateutil>=2.5.0->pandas)
Installing collected packages: pandas
Successfully installed pandas-0.23.0


On 5/17/18, Manish <manishkumar.bobbili3@gmail.com> wrote:
> when i installed from pip it successfully installed. I didnt see any errors
>
> On 5/17/18, Tom Augspurger <notifications@github.com> wrote:
>> Can you paste the output from your pip install?
>>
>> --
>> You are receiving this because you authored the thread.
>> Reply to this email directly or view it on GitHub:
>> https://github.com/pandas-dev/pandas/issues/21106#issuecomment-389954577
>

How did you install python?  You seem to be on 32 bit windows which is less tested, but I just tried with a clean conda environment and it worked fine
```
set CONDA_FORCE_32BIT=1
conda create -n py36_32 python=3.6 numpy -y
activate py36_32
pip install pandas
python -c "import pandas"
```

You might also provide your versions of Pip, setuptools and NumPy.

On Thu, May 17, 2018 at 2:45 PM, chris-b1 <notifications@github.com> wrote:

> How did you install python? You seem to be on 32 bit windows which is less
> tested, but I just tried with a clean conda environment and it worked fine
>
> set CONDA_FORCE_32BIT=1
> conda create -n py36_32 python=3.6 numpy -y
> activate py36_32
> pip install pandas
> python -c 'import pandas'
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/issues/21106#issuecomment-389986723>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABQHIkQTekIg93m6JwZMqdUyWqn1qo2Gks5tzdN1gaJpZM4UDf0A>
> .
>

I have the same problem

> pip 10.0.1
> python 3.6
> NumPy 1.14.3


What platform? How did you install python?

On Mon, May 21, 2018, 5:57 PM marcelo <notifications@github.com> wrote:

> I have the same problem
>
> pip 10.0.1
> python 3.6
> NumPy 1.14.3
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/issues/21106#issuecomment-390807539>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AB1b_BlekLdJj094H7KnItpXnlKPnqS8ks5t00ZygaJpZM4UDf0A>
> .
>

Installation of pandas 0.22.0 seemed to help some of my students
Yes, this issue is apparently with 0.23 wheels.

If people could post their Python (installer, 32 or 64 bit), pip, & NumPy
info we may be able to track this down.

On Tue, May 22, 2018 at 9:19 AM, Abador <notifications@github.com> wrote:

> Install version pandas 0.22.0 it seemed to help some of my students
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/issues/21106#issuecomment-391007800>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABQHIpXhMz71zFW-ajVVTiDs0YU1HK-0ks5t1B5igaJpZM4UDf0A>
> .
>

I can confirm this issue is due to 0.23
Uninstall then reinstall 0.22 
```
pip uninstall pandas
pip install pandas==0.22
```
@asangansi can you please give the additional information as mentioned here https://github.com/pandas-dev/pandas/issues/21106#issuecomment-391013339. That would be helpful.
As far as I can tell most of my students have libraries similar to this(copy from pyCharm settings):
et-xmlfile  1.0.1  
jdcal   1.4 1.4
numpy   1.14.3  1.14.3
openpyxl    2.5.3   2.5.3
pandas  0.23.0  0.23.0
pip 9.0.1   10.0.1
python-dateutil 2.7.3   2.7.3
pytz    2018.4  2018.4
setuptools  28.8.0  39.2.0
six 1.11.0  1.11.0
xlrd    1.1.0   1.1.0

Python 3.6 
Project in PyCharm 2018.1.1
Not a whole lot to go on here, but @cgohlke do you have any guesses?

FWIW, `_window.pyx` is the first C++ pyx file in https://github.com/pandas-dev/pandas/blob/1abfd1bfdb26e9f444b4f44ffbcd2e37026e6497/setup.py#L334
Here's another failed attempt to repro, using a python.org binary.

```cmd
# download, unzip, cd to root of  https://www.python.org/ftp/python/3.6.2/python-3.6.2-embed-win32.zip
rm python36._pth
curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
python get-pip.py
python -m pip install pandas
python
>>> import pandas
>>>
```

c++ is probably the issue, guessing missing the runtime DLL, though I'm not sure the best fix.  From what I recall c++ wasn't particularly necessary for that change so could revert back to `c` for `0.23.1`

Could someone one this issue try install the VS 2015 Redistributable and see if that fixes it for you?
https://www.microsoft.com/en-us/download/details.aspx?id=48145
PR was #19549
The missing DLL is most probably `MSVCP140.DLL`, the MSVC C++ runtime library.

It is part of the [Microsoft Visual C++ Redistributable for Visual Studio 2015/2017](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads).

Some projects, e.g. matplotlib, include this DLL in the binary wheels.


we have used c++ for quite some time
But we were not using libcpp in cython code before. @jreback might that be a difference with previous c++ code of msgpack?
That's right, msgpack only depends on libc, where the window extension is utilizing the c++ std library.
When i degraded my pandas version to 0.22 it was solved

On Thu, May 24, 2018 at 7:13 AM chris-b1 <notifications@github.com> wrote:

> That's right, msgpack only depends on libc, where the window extension is
> utilizing the c++ std library.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/issues/21106#issuecomment-391729860>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/APQD9Kz2BtVMjaPrDqN-DUt3NG4OLywDks5t1r_tgaJpZM4UDf0A>
> .
>
--

@chris-b1 can you see what mpl is doing? maybe need a directive in setup.py? or the wheeel building step

@cgohlke is this something you want to do? (including the binaries? similar as matplotlib) (since we are using your wheels to upload to pypi)
same here:
````
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\__init__.py", line 42, in <module>
    from pandas.core.api import *
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\api.py", line 10, in <module>
    from pandas.core.groupby.groupby import Grouper
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
    from pandas.core.groupby.groupby import (
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
    from pandas.core.frame import DataFrame
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\frame.py", line 74, in <module>
    from pandas.core.series import Series
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\series.py", line 3978, in <module>
    Series._add_series_or_dataframe_operations()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\generic.py", line 8891, in _add_series_or_dataframe_operations
    from pandas.core import window as rwindow
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\window.py", line 36, in <module>
    import pandas._libs.window as _window
ImportError: DLL load failed: The specified module could not be found.
PS C:\Users\xxx\Dropbox\xxx>
````

version 23 fail.
version 22 works.
When i installed pandas 0.23 version i got same error. But when i installed
the version to 0.22 it worked. Just saying try these option it might work

On Sun, May 27, 2018 at 10:12 PM sionking <notifications@github.com> wrote:

> same here:
>
> Traceback (most recent call last):
>   File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\__init__.py", line 42, in <module>
>     from pandas.core.api import *
>   File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\api.py", line 10, in <module>
>     from pandas.core.groupby.groupby import Grouper
>   File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
>     from pandas.core.groupby.groupby import (
>   File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
>     from pandas.core.frame import DataFrame
>   File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\frame.py", line 74, in <module>
>     from pandas.core.series import Series
>   File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\series.py", line 3978, in <module>
>     Series._add_series_or_dataframe_operations()
>   File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\generic.py", line 8891, in _add_series_or_dataframe_operations
>     from pandas.core import window as rwindow
>   File "C:\Program Files (x86)\Python36-32\lib\site-packages\pandas\core\window.py", line 36, in <module>
>     import pandas._libs.window as _window
> ImportError: DLL load failed: The specified module could not be found.
> PS C:\Users\xxx\Dropbox\xxx>
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/issues/21106#issuecomment-392420818>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/APQD9AUAgiw77S7I9l-PqQ6ZNYcARIR6ks5t24c9gaJpZM4UDf0A>
> .
>
--

Any updates on this? (somebody who can look at fixing the wheel building?)

Otherwise we can also revert the PR (it was only a performance improvement) *for 0.23.1*, but keep it in master so have more time to fix the wheel building for 0.24.0.
Could someone reporting on this issue (@manish59, @sionking, @asangansi, @abador, @mezitax ) please confirm that installing the redistributable fixes this for 0.23?  Every windows machine I have access to already has it installed.  

I'll look at what matplotlib does later today.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -453,10 +453,10 @@ def pxd(name):
     return pjoin('pandas', name + '.pxd')
 
 
-# args to ignore warnings
 if is_platform_windows():
     extra_compile_args = []
 else:
+    # args to ignore warnings
     extra_compile_args = ['-Wno-unused-function']
 
 lib_depends = lib_depends + ['pandas/_libs/src/numpy_helper.h',
@@ -733,7 +733,7 @@ def pxd(name):
       maintainer=AUTHOR,
       version=versioneer.get_version(),
       packages=find_packages(include=['pandas', 'pandas.*']),
-      package_data={'': ['data/*', 'templates/*'],
+      package_data={'': ['data/*', 'templates/*', '_libs/*.dll'],
                     'pandas.tests.io': ['data/legacy_hdf/*.h5',
                                         'data/legacy_pickle/*/*.pickle',
                                         'data/legacy_msgpack/*/*.msgpack',


Test patch: