Python Forum
Pyinstaller Maximum recursion bug
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pyinstaller Maximum recursion bug
#1
hello all.

I am trying to create an executable from a simple python script containing the pandas library, but I think that I have encountered a bug.

If I try to make an executable using a python script:
Import pandas as pd
print("hello")
If use pyinstaller:
pyinstaller --onefile test_script.py

I get the following:
"Recursion error: maximum recursion depth exceeded"

I have tried adding lines such as "sys.setrecursionlimit(5000)" with numbers up to 100000 but the issue remains.

Can anyone confirm the bug or offer some advice?

Thanks
Reply
#2
Does anyone have any clue how I can fix this?
Reply
#3
I observe that Import pandas as pd should raise SyntaxError (due to capital letter in Import).
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#4
Thanks for your input. I also tried import Pandas and I get the same error...

Any other advice?
Reply
#5
Under pyinstaller issue #2919 there are suggestions which seem to work for some scenarios. For example tracing last package being analyzed
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#6
It appears that, like the thread, I am having issues with the "modulegraph.py"

I only need to import pandas.read_csv, so I try:
from pandas import read_csv

and I still get the error.

How can I remove or ignore that module? I am using WinPython3.5.4.1

Update: I tried uninstalling and installing modulegraph.py via pip...

no change in my error.
Reply
#7
(Apr-09-2019, 09:26 PM)scales11 Wrote: How can I remove or ignore that module? I am using WinPython3.5.4.1
Upgrade your python version,Python 3.6/3.7 and pip installation under Windows.
# hello.py
import pandas as pd

print("hello")
input('Press Enter to exit')
Last line so cmd windows don't disappear,if run hello.exe from file explorer.

After install Python 3.7.3,test command line.
λ python -V
Python 3.7.3

λ pip -V
pip 19.0.3 from c:\python3.7\lib\site-packages\pip (python 3.7)
Install,now that pip point to 3.7,it will only install to 3.7:
pip install pyinstaller pandas
Run with:
E:\div_code\afoo
λ pyinstaller --onefile hello.py
Reply
#8
Eureka!

Thank you very much. Removing Winpython and installing regular python 3.7(with pip and pandas) fixed my problem!
Reply
#9
For anyone else who stumbles across this: I had to add the modules in the spec file pyinstaller created because the file itself calling them was not enough.

In spyder I used the console to run: ! pyinstaller yield.spec

here is what the spec file looks like:

# -*- mode: python ; coding: utf-8 -*-
import sys

sys.setrecursionlimit(sys.getrecursionlimit() * 500)

a = Analysis(
['yield.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=['pull', 'squish', 'arrange', 'pivot'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
)
pyz = PYZ(a.pure)

exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='yield',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='yield',
)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Bug maximum recursion depth exceeded while calling a Python object error in python3 Prezess 4 3,689 Aug-02-2020, 02:21 PM
Last Post: deanhystad
  RecursionError: maximum recursion depth exceeded in comparison ? leoahum 11 12,877 Mar-18-2019, 01:53 PM
Last Post: leoahum
  maximum recursion depth exceeded saba_keon 3 7,324 Apr-08-2018, 07:30 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020