I've created an executable with Pyinstaller. Running the executable from cmd, it crashes when it starts creating the relplot. For creating the exe, I used this command:pyinstaller test.py --onefile
. Here is test.py:
#!/usr/bin/env python
import seaborn as sns
print('###################relplot##########################')
tips = sns.load_dataset("tips")
g = sns.relplot(data=tips, x="total_bill", y="tip", hue="day")
g.fig.savefig('.\\test.png')
print('success')
Conda info:
shell level : 2
conda version : 4.9.2
conda-build version : 3.20.5
python version : 3.8.5.final.0
virtual packages : __cuda=11.1=0
__win=0=0
__archspec=1=x86_64
platform : win-64
user-agent : conda/4.10.1 requests/2.25.1 CPython/3.8.8 Windows/10 Windows/10.0.19041
administrator : False
netrc file : None
offline mode : False
Pyinstaller warning file when the .exe is built.
Pyinstaller debug messages at runtime with --debug=imports
See at the bottom where it crashes.
I have tried updating the environment and the libraries, writing crazy .spec file found here and there. nothing seems to work. I am aware of this post. But The solution doesn't work, the question has not gotten much attention and it is incomplete and I cannot leave comments for it and to me it seems to be slightly different than my issue.
Update: The exe file runs with no problem in the Anaconda Prompt, but it crashes in the cmd. I tried the solution offered here and it did not work.
Conda virtual environment Python 3.7.10:
name: test_env
channels:
- defaults
dependencies:
- altgraph=0.17=pyhd3eb1b0_0
- blas=1.0=mkl
- ca-certificates=2021.1.19=haa95532_1
- certifi=2020.12.5=py37haa95532_0
- cycler=0.10.0=py37_0
- freetype=2.10.4=hd328e21_0
- future=0.18.2=py37_1
- icc_rt=2019.0.0=h0cc432a_1
- icu=58.2=ha925a31_3
- intel-openmp=2020.2=254
- jpeg=9b=hb83a4c4_2
- kiwisolver=1.3.1=py37hd77b12b_0
- libpng=1.6.37=h2a8f88b_0
- macholib=1.14=pyhd3eb1b0_1
- matplotlib=3.2.2=0
- matplotlib-base=3.2.2=py37h64f37c6_0
- mkl=2020.2=256
- mkl-service=2.3.0=py37h196d8e1_0
- mkl_fft=1.3.0=py37h46781fe_0
- mkl_random=1.1.1=py37h47e9c7a_0
- numpy=1.19.2=py37hadc3359_0
- numpy-base=1.19.2=py37ha3acd2a_0
- openssl=1.1.1k=h2bbff1b_0
- pandas=1.2.3=py37hf11a4ad_0
- pefile=2019.4.18=py_0
- pip=21.0.1=py37haa95532_0
- pycryptodome=3.10.1=py37h2bbff1b_0
- pyinstaller=3.6=py37h8cc25b3_6
- pyparsing=2.4.7=pyhd3eb1b0_0
- pyqt=5.9.2=py37h6538335_2
- python=3.7.10=h6244533_0
- python-dateutil=2.8.1=pyhd3eb1b0_0
- pytz=2021.1=pyhd3eb1b0_0
- pywin32=227=py37he774522_1
- pywin32-ctypes=0.2.0=py37_1001
- qt=5.9.7=vc14h73c81de_0
- scipy=1.6.2=py37h14eb087_0
- seaborn=0.10.1=py_0
- setuptools=52.0.0=py37haa95532_0
- sip=4.19.8=py37h6538335_0
- six=1.15.0=py37haa95532_0
- sqlite=3.35.4=h2bbff1b_0
- tornado=6.1=py37h2bbff1b_0
- vc=14.2=h21ff451_1
- vs2015_runtime=14.27.29016=h5e58377_2
- wheel=0.36.2=pyhd3eb1b0_0
- wincertstore=0.2=py37_0
- zlib=1.2.11=h62dcd97_4
prefix: C:\Users\alina\.conda\envs\test_env
After much testing I realized this only happens when I use conda
environment for creating my executables. I simply created a venv
rather than a conda
environment and everything went well. I suggest to stay away from the conda
environment if possible when you want to distribute your Python app using pyinstaller
.