0

I've been using cxFreeze to build my Python code for some time and had no issue, until today. I'm not sure the problem comes from cxFreeze, though. Although there are some RuntimeError exceptions on the web, they don't exactly match what I obtain.

$ python2.7 setup.py build
running build
running build_exe
Traceback (most recent call last):
  File "setup.py", line 79, in <module>
    executables = [client, updater, dbg_updater]
  File "C:\python27\lib\site-packages\cx_Freeze\dist.py", line 362, in setup
    distutils.core.setup(**attrs)
  File "C:\python27\lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "C:\python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\python27\lib\distutils\command\build.py", line 127, in run
    self.run_command(cmd_name)
  File "C:\python27\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:\python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\python27\lib\site-packages\cx_Freeze\dist.py", line 232, in run
    freezer.Freeze()
  File "C:\python27\lib\site-packages\cx_Freeze\freezer.py", line 619, in Freeze
    self.finder = self._GetModuleFinder()
  File "C:\python27\lib\site-packages\cx_Freeze\freezer.py", line 378, in _GetModuleFinder
    finder.IncludePackage(name)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 686, in IncludePackage
    module = self._ImportModule(name, deferredImports)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 346, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 419, in _InternalImportModule
    namespace = namespace)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 436, in _InternalImportModule
    parentModule, namespace)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 448, in _LoadModule
    namespace)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 513, in _LoadPackage
    self._LoadModule(name, fp, path, info, deferredImports, parent)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 502, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 601, in _ScanCode
    module, relativeImportIndex)
......................................
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 356, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 436, in _InternalImportModule
    parentModule, namespace)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 502, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 601, in _ScanCode
    module, relativeImportIndex)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 356, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 436, in _InternalImportModule
    parentModule, namespace)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 449, in _LoadModule
    module = self._AddModule(name)
  File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 213, in _AddModule
    module = self._modules[name] = Module(name)
RuntimeError: maximum recursion depth exceeded while calling a Python object

No idea what is creating the bug. I didn't add in any new module and just fixed some errors in my program. I have the most recent version of pip and setuptools. Does anyone know what this error mean?

If you want to see the code, it's here: https://github.com/vlegoff/cocomud/blob/master/src/setup.py

Thanks in advance!

EDIT: It turned out all the fuss was because of the parse module (pypi.python.org/pypi/parse), although it's not included in the project I was trying to freeze. I removed it with pip uninstall and it worked when I tried to freeze my project. No idea why, I did it because I remember having installed two new packages to try them out.

vincent-lg
  • 539
  • 7
  • 15

2 Answers2

0

This looks strange. I believe it could be related to a bug in cx_freeze. If you read the people referred by this link: https://bitbucket.org/anthony_tuininga/cx_freeze/issues/184/importing-pyqtgraph-causes-recursion-limit

They seem to have a problem with pyqtgraph, but also with urllib, that you are using in your project (and the bug doesn't seems fixed yet). So I suggest to exclude this from your project and to check if this works better. Maybe, you could also try another version of cx_freeze, or specifying the imported libraries in another way, for instance, by linking modules manually using this syntax:

Buildoptions=dict(
    compressed=True,
    includes=["moduletoinclude"],
    path=sys.path + ["Lib"]
)

Have a nice day

Alexis Clarembeau
  • 2,776
  • 14
  • 27
  • Thanks for your answer. It turned out all the fuss was because of the parse module (https://pypi.python.org/pypi/parse), although it's not included in the project I was trying to freeze. I removed it with pip uninstall and it worked when I tried to freeze my project. No idea why, I did it because I remember having installed two new packages to try them out. I could mark this as closed... but I'm not against explanations on why parse cause such an issue. – vincent-lg May 28 '17 at 20:56
0

It turned out all the fuss was because of the parse module (pypi.python.org/pypi/parse), although it's not included in the project I was trying to freeze. I removed it with pip uninstall and it worked when I tried to freeze my project. No idea why, I did it because I remember having installed two new packages to try them out.

vincent-lg
  • 539
  • 7
  • 15