pyinstaller creating EXE RuntimeError: maximum recursion depth exceeded while calling a Python object

前端 未结 9 1019
栀梦
栀梦 2020-11-29 18:51

I am running WinPython 3.4.4.3 with pyinstaller 3.2 (obtained via pip install pyinstaller).

Now I\'ve got some really simple Qt4 code that I want to convert to EXE a

相关标签:
9条回答
  • 2020-11-29 19:36

    i'd try to increase recursion depth limit. Insert at the beginning of your file:

    import sys
    sys.setrecursionlimit(5000)
    
    0 讨论(0)
  • 2020-11-29 19:37

    make new environment with pipenv and install just the requirements package. (unused package which you have on your environment will cause the increase of the size of .exe file and make this error happen ) i try with python 3.8 and it worked

    0 讨论(0)
  • 2020-11-29 19:38

    I was facing the same issue. I tried most of the things suggested here. But, I could not solve the issue on my laptop. What worked for me is summarized below:

    1. Open Anaconda prompt.
    2. Activate your environment using conda activate my_env.
    3. Navigate to your project folder from the Anaconda command prompt using cd your_folder_directory.
    4. Run pyinstaller --onefile my_python_file.py

    This should not create any recursion error. This will create a dist folder in your project directory. Your executable will present in this folder.

    0 讨论(0)
  • 2020-11-29 19:43

    This worked for me

    1. Run pyinstaller and stop it to generate the spec file :

      pyinstaller filename.py
      

      A file with .spec as extension should be generated

    2. Now add the following lines to the beginning of the spec file :

      import sys
      sys.setrecursionlimit(5000)
      
    3. Now run the spec file using :

      pyinstaller filename.spec
      
    0 讨论(0)
  • 2020-11-29 19:43

    Even until March 2020, this issue has not been solved yet. As per some people's explanation, I increased setrecursionlimit in .spec file and tried to build it, but it did not work.

    Through googling, I found out that this issue is caused by conflict of latest version of openpyxl and pyinstaller. Older version of openpyxl, such as 2.3.5 version, does not cause this issue.

    As such, solution for this issue is as follows.

    pip uninstall openpyxl
    pip install openpyxl==2.3.5
    
    0 讨论(0)
  • 2020-11-29 19:43

    Sometimes even the limit 5000 is not enough. It helped me to set limit to 20000. (in file 'filename.spec')

    import sys
    sys.setrecursionlimit(20000)
    
    0 讨论(0)
提交回复
热议问题