5
votes

I am trying to convert a .py to .exe using pyinstaller. When I type pyinstaller my_code.py everything seems to be working and after a couple of minutes the process stops and I get the recursion error. I have tried to create a my_code.spec file in the same folder, edit it and change the number of recursions but when I run pyinstaller apparently a new .spec is created since I can't find the sys.setrecursionlimit() command that I had previously added to the my_code.spec file. I am running all the above from the anaconda command prompt and not from the command line but I think that this is not a problem since I have tried to convert to .exe a simple "hello world" script and it works perfectly. I have python 3.6.3 installed.

3
What is inside my_code.py? - DarthVlader
my_code.py is the python code that I want to convert to .exe Anyway I just solved it. When I run pyinstaller my_code.py I immediately stop running with ctrl+c. Then I edit the .spec file that was created with import sys sys.setrecursionlimit(1000) And finally I run pyinstaller my_code.spec on the console. - Xristos Timplalexis

3 Answers

6
votes

Please see this link:https://github.com/pyinstaller/pyinstaller/issues/2919

The issue is with python 3.6, and most issues can be resolved by downgrading to python 3.5 to use pyinstaller.

If you are using anaconda3 this can be done by opening a command prompt and running:

conda update conda

And then running:

conda install python=3.5
2
votes

It's better to build a different environment for when wanting to make an executable python file. This should work to the python version your executable compiler works better. Usually, the older the python version the easiest is to compile.

0
votes

The way suggested by alphabet5 took too long for me. I wanted to find another way.

What I did was to create another environment for Python3.5 in Anaconda Navigator. Then, I activated the Python3.5 environment (for example py35):

conda activate py35

Then, I installed necessary libraries such as pyqt5, pyqtgraph, pyinstaller etc. since py35 is a newly created environment.

When I ran pyinstaller and didn't get any error.