pack a software in Python using py2exe with 'libiomp5md.dll' not found

12,931

Solution 1

I had the same problem, but calling import numpy within setup.py resolved the issue

Solution 2

libiomp5md.dll is from the Intel C compiler, and is used for OpenMP multiprocessing operations. I expect that your code involves numpy or code compiled with the Intel compiler, and so your py2exe build depends on it.

You can't simply create a build without it, so I would suggest finding it on your system and copying it to the directory where you run python setup.py py2exe . Hint, I have a copy in C:\Python27\Lib\site-packages\numpy\core

[If you really want to exclude it you will have to compile numpy manually with Visual Studio or Msys.]

Once you have libiomp5md.dll in the directory that you're executing python setup.py py2exe then you only need to remove the exclude_dll line (as you don't want to be excluding it...)

from distutils.core import setup
import py2exe

setup(console=["SegmentationAccuracy.py"])
Share:
12,931
Gianni Spear
Author by

Gianni Spear

Updated on June 10, 2022

Comments

  • Gianni Spear
    Gianni Spear almost 2 years

    I have Python 2.7 on Window 7 OS. I wish to pack my project.py in an Executable using py2exe. Following the instruction i wrote a setup.py file

    from distutils.core import setup
    import py2exe
    
    setup(console=["project.py"])  
    

    and I got this message

    enter image description here

    i tried to exclude 'libiomp5md.dll'

    from distutils.core import setup
    import py2exe
    
    setup(console=["SegmentationAccuracy.py"])
    
    dll_excludes = ['libiomp5md.dll']
    

    but always i got the same error message "error: libiomo5md.dll: No such file or directory"

    my executable contains:

    import math
    import os
    import numpy as np
    import sys
    import ogr
    from progressbar import ProgressBar
    from shapely.geometry import Polygon
    nan = np.nan
    
  • Gianni Spear
    Gianni Spear about 11 years
    Hey @ChrisB. I just moved the libiomp5md.dll file in the folder of setup.py and it works
  • Pierre
    Pierre about 10 years
    adding "import numpy" worked for me too. You don't really want to be moving DLLs around, as other components may depend on them being in a certain place.
  • sliders_alpha
    sliders_alpha almost 6 years
    I added 'import numpy' because it told me that numpy was not defined, now I'm getting "'module' object has no attribute 'file'"