Pyinstaller development version: recursion depth reached - python-3.x

With due reference to question at Pyinstaller Maximum Recursion Depth Exceded, I removed all versions of pyinstaller and associated folders. I installed the newest development version of pyinstaller with:
pip install https://github.com/pyinstaller/pyinstaller/tarball/develop
Using pyinstaller still causes this error message:
RecursionError: maximum recursion depth exceeded.
I am using Python 3.6.4. I've seen that others downgrade to Python 3.5. Others suggest increasing the recursion depth in the spec file (http://pyinstaller.readthedocs.io/en/stable/spec-files.html).
Can anyone suggest the best path forward?

FWIW, I ripped out Python 3.6.4 and installed Python 3.5.2. Now, pyinstaller and P3.5.2 play well together.

Alternatively, you can increase the recursion limit by adding the following to the beginning of the .spec file:
import sys
sys.setrecursionlimit(5000)

Related

Python packaging with Pyinstaller

I am trying to package my python file using Pyinstaller. I follow the instructions from this link
https://datatofish.com/executable-pyinstaller/
but I get this error.
RecursionError: maximum recursion depth exceeded.
I tried to added the following line of code as it was suggested on few pages but so far no success.
**import sys
sys.setrecursionlimit(1500).**
Any help?
Just so you all know the error was caused by Anaconda environment. It is not compatible with Python 3.7 and Pyinstaller. As soon I as uninstall Anaconda and run the Pyinstaller function, everything was fine and I managed to create an exe file.

fbs freeze failed with Python 3.6.4

I have the following problem with fbs and Python: I tried to compile Python code and wanted to create an executable .exe file in windows. The command fbs run works fine, but fbs freeze fails.
Package versions:
Python 3.6.4
PyInstaller: 3.4
PyQt5: 5.9.2
Packages that I import:
import re
from itertools import chain
import os
import pandas
from PyQt5.QtWidgets import *
from fbs_runtime.application_context.PyQt5 import ApplicationContext
The output of fbs freeze --debug you see in the attached image:
I used the pyinstaller command to create the exe. This was possible without fbs. Just pyinstaller with the standard comments pyinstaller "...." --onefile --noconsole.
It worked with Python 3.6.4 and pyinstaller 3.4. Perhaps 3.5 would also work. But I know at least that Python 3.8.0 with the newest pyinstaller (even development version from git) doesn't work. I used PyQt5, but some older version 5.12....
It's a bit intransparent...
Best regards,
Markus
fbs runs perfectly fine with python 3.6.x (I am using 3.6.8, PyQt 5.9.2, PyInstaller 3.4).
The python compiler can sometimes get confused if another error happens earlier in the stack. Generally if fbs freeze errors when fbs run works, that points to a library-include error.
See my answer here to include necessary python library resources in your ./src/freeze/windows/ directory and try freezing again: The 'google-api-python-client' distribution was not found and is required by the application with pyinstaller

Creating an executable from python file

I need to make an executable out of a .py file. I looked into it and tried:
py2exe -> this doesn't work with python3.8 (gives me "IndexError: tuple index out of range")
pyinstaller -> still doesn't work (TypeError: an integer is required (got type bytes))
For pyinstaller I might have found a solution here but still doesn't work for me. (a user said to use the latest version compatible with 3.8 -> pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz
Any alternative solution / fix would be greatly appreciated
This subject has been discussed here
The latest release of Py2exe (0.9.2.2) was built for Python 3.4 and will not work in 3.7+.
There is a Github project that is porting Py2exe to 3.7 (link here). I made some tests with Python 3.7 and it works well to generate exe files.

cant find moduals even though sys.path searches in right place

I am working on widows10 with python3.7
I have downloaded opencv and numpy and sklearn(scikit-learn) and they are in C:\Python37\Lib\site-packages (where pip put them) and when I run
import sys
print(sys.path)
I get the output:
['', 'C:\\Python35\\Lib', 'C:\\Python35\\DLLs', 'C:\\Python35\\Lib\\site-packages', 'C:\\Users\\E6440', 'C:\\Python37\\python37.zip', 'C:\\Python37\\DLLs', 'C:\\Python37\\lib', 'C:\\Python37', 'C:\\Python37\\lib\\site-packages']
on cmd it says C:\Python37\Lib\site-packages which is one of the paths it looks in for when importing but then as soon as I run some code it gives a no module named ___ error
this is similar to the question python cant find module in sys.path but the comments in that one did not help me
edit
solved by using PYTHONPATH that was accurate to the python version
The package you're trying to import the module from may be available in the Python 3.5 installation too, but the package for Python 3.5 may be missing the module you're trying to import. Try moving the Python 3.7 paths ahead of the Python 3.5 paths in your PYTHONPATH environment variable.

Py2exe Pywin32 Error

Py2exe perfectly converts python scripts to windows executable, unless the file includes pywin32. In that case, it shows a RuntimeError:
RuntimeError: maximum recursion depth exceeded in comparison
All other python files are having no trouble with py2exe.
So, Is there any way to make py2exe work with pywin32?
Note: I've tried increasing recursion depth limit, it doesn't work.

Resources