10

I have included matplotlib in my program, I searched about numpy_atlas.dll on google and I seem to be the only one on Earth with this problem.

setup.py

from setuptools import setup
import py2exe

setup(console=['EulerMethod.py'])

Running Py2Exe results in error

C:\(..obmitted..)>python setup.py py2exe
running py2exe
*** searching for required modules ***
*** parsing results ***
......
...obmitted...
......
*** finding dlls needed ***
error: [Errno 2] No such file or directory: 'numpy-atlas.dll'
Community
  • 1
  • 1
Louis Hong
  • 1,051
  • 2
  • 12
  • 27
  • This problem arose for me when I re-installed python. Prior to that, my script was working perfectly fine. I found the file at C:\Anaconda2\Lib\site-packages\numpy\core, but py2exe can't find it for some reason. Previously, I was using python(x,y) but I switched to Anaconda (still python 2.7.x). – kjgregory May 16 '16 at 03:22

3 Answers3

17

This is what worked for me. I found the dll: C:\Python27\Lib\site-packages\numpy\core\numpy-atlas.dll and copied it to the same folder that has the setup.py

max
  • 9,708
  • 15
  • 89
  • 144
13

I encountered the same problem. After a little testing, appending numpy.core directory to sys.path seemed to work.

from distutils.core import setup
import py2exe

import numpy
import os
import sys

# add any numpy directory containing a dll file to sys.path
def numpy_dll_paths_fix():
    paths = set()
    np_path = numpy.__path__[0]
    for dirpath, _, filenames in os.walk(np_path):
        for item in filenames:
            if item.endswith('.dll'):
                paths.add(dirpath)

    sys.path.append(*list(paths))

numpy_dll_paths_fix()
setup(...)
J.J. Hakala
  • 6,136
  • 6
  • 27
  • 61
0

Sounds like py2exe can't find dll. Following script will make py2exe quiet:

distutils.core.setup(
options = {
    "py2exe": {
        "dll_excludes": ["MSVCP90.dll"]
    }
},
...

)

You still need to make sure that dll is on the user's machine. I believe numpy-atlas.dll is one of matplot dependencies.

Also consider using PyInstaller if everything else fails.

frainfreeze
  • 567
  • 6
  • 20
  • Do you know how I can bundle the exe so that all doll dependencies are included? – Louis Hong Mar 24 '16 at 22:13
  • .dll's should be located in the dist directory along side the executable. – frainfreeze Mar 25 '16 at 13:35
  • I haven't tried your solution yet, I'll make sure to try it and choose your answer if it works. – Louis Hong Mar 26 '16 at 09:30
  • 1
    I have no idea if your answer works but PyInstaller is absolutely amazing. Maybe add that to your answer and I'll select it. – Louis Hong Apr 01 '16 at 04:55
  • Sure thing. Glad it helped. – frainfreeze Apr 01 '16 at 18:02
  • 1
    I just got that error, but I already have this line in my setup script: `"dll_excludes": ["MSVCP90.dll"]`. Frustratingly, it seems like every time I revisit this script some time has elapsed, it comes up with another random missing dll, although I was able to run py2exe without numpy-atlas.dll the time before and I haven't made significant changes to my application's dependencies. Does anyone else have a similar experience? I ruled out PyInstaller previously because it didn't play nice with Canopy Python, but maybe I should try again... – J Jones Apr 05 '16 at 17:45
  • `"dll_excludes": ["MSVCP90.dll"]` excludes only the MSVCP90.dll. You have to add others you want to exclude yourself. – frainfreeze Apr 07 '16 at 16:02
  • Excluding the .dll doesn't seem like a solution, I would think that this .dll is needed (at least in my case). For me, this setup script was working perfectly fine until I re-installed Python (previously used python(x,y) now using Anaconda, but still v2.7.x). – kjgregory May 16 '16 at 03:17