Python Forum

Full Version: Pyinstaller Maximum recursion bug
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
Does anyone have any clue how I can fix this?
I observe that Import pandas as pd should raise SyntaxError (due to capital letter in Import).
Thanks for your input. I also tried import Pandas and I get the same error...

Any other advice?
Under pyinstaller issue #2919 there are suggestions which seem to work for some scenarios. For example tracing last package being analyzed
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.
(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
Eureka!

Thank you very much. Removing Winpython and installing regular python 3.7(with pip and pandas) fixed my problem!
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',
)