No module named builtins

Charlie_M picture Charlie_M · Dec 16, 2014 · Viewed 65.9k times · Source

I'm trying to convert my .py script into an executable using py2exe. I've had a number of issues so far that have been largely addressed by the "options" in the setup file below. But now I have a problem that I have not been able to find a solution for, and wondering if others have had this same issue and fixed it.

When I execute the setup file below using "python setup.py py2exe" it gives me an executable but when I run it, it complains "No module named builtins".

The only other post I could find on this subject indicated that builtins is a python3 thing, but I'm running 2.7.

Appreciate any advice or tips on this.

from distutils.core import setup
import py2exe

from distutils.filelist import findall
import os
import matplotlib
matplotlibdatadir = matplotlib.get_data_path()
matplotlibdata = findall(matplotlibdatadir)



setup(
    console=['DET14.py'],
    options={
             'py2exe': {
                        'packages' : ['matplotlib', 'pytz'],
                        'dll_excludes':['MSVCP90.DLL',
                                        'libgdk-win32-2.0-0.dll',
                                        'libgobject-2.0-0.dll',
                                        'libgdk_pixbuf-2.0-0.dll'],
                        'includes':['scipy.sparse.csgraph._validation',
                            'scipy.special._ufuncs_cxx']
                       }
            },
#    data_files=matplotlibdata_files
    data_files=matplotlib.get_py2exe_datafiles()
)

Here is the full listing of what the error message looks like:

error message

Answer

Sarah Rose picture Sarah Rose · Nov 2, 2016

I also found using 'pip install future' resolved this issue

I got the information from here: https://askubuntu.com/questions/697226/importerror-no-module-named-builtins

I hope this clarifies this for other users, like me who stumbled upon your question