matplotlibrc not found error

174 views
Skip to first unread message

Mordecai Veldt

unread,
Apr 6, 2021, 2:46:33 AMApr 6
to PyInstaller
I have a small app that is built with TKinter in python3.9. It uses matplotlib to put a plot in the windows.
I can pyinstaller -F main.py and it completes, but if I try to run the packed exe, it crashes looking in a random appdata folder for matplotlibrc.
How can I get this this to work without looking for a matplotlibrc?

Traceback (most recent call last):
  File "main.py", line 6, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 531, in exec_module
  File "matplotlib\__init__.py", line 820, in <module>
  File "matplotlib\__init__.py", line 725, in _rc_params_in_file
  File "contextlib.py", line 117, in __enter__
  File "matplotlib\__init__.py", line 703, in _open_file_or_url
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\morde\\AppData\\Local\\Temp\\_MEI242442\\matplotlib\\mpl-data\\matplotlibrc'

bwoodsend

unread,
Apr 6, 2021, 11:37:14 AMApr 6
to PyInstaller

It crashes in some random appdata folder because that’s how onefile works - it unpacks itself into a temporary folder before running. As for matplotlib - what versions of matplotlib and PyInstaller are you using? There have been a couple of fixes to PyInstaller in the last few months. matplotlib 3.3 requires PyInstaller 4.1 and matplotlib 3.4 requires 5568 which hasn’t been released yet so you will have to install PyInstaller from Github.

Mordecai Veldt

unread,
Apr 6, 2021, 12:40:05 PMApr 6
to pyins...@googlegroups.com
matplotlib 3.4.1
pyinstaller 4.2
I got it to work by putting a matplotlibrc copy in my script folder. I think it got picked up and packed so that it gets into the right place in the onefile unpack.

                        Mordecai Veldt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A man has joy in an apt answer,
         And how delightful is a timely word! Proverbs 15:23 NASB
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


On Tue, Apr 6, 2021 at 11:37 AM bwoodsend <bwoo...@gmail.com> wrote:

It crashes in some random appdata folder because that’s how onefile works - it unpacks itself into a temporary folder before running. As for matplotlib - what versions of matplotlib and PyInstaller are you using? There have been a couple of fixes to PyInstaller in the last few months. matplotlib 3.3 requires PyInstaller 4.1 and matplotlib 3.4 requires 5568 which hasn’t been released yet so you will have to install PyInstaller from Github.

--
You received this message because you are subscribed to a topic in the Google Groups "PyInstaller" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyinstaller/IfyyRcj1pGk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/3b49d5d4-c629-4f75-b5d1-14905d8b471fn%40googlegroups.com.

bwoodsend

unread,
Apr 7, 2021, 4:37:36 AMApr 7
to PyInstaller

matplotlib 3.4.1
pyinstaller 4.2

Yeah, those two won’t work together. Try with the development version:

pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

Then rebuild but add the --clean option.

Mordecai Veldt

unread,
Apr 8, 2021, 2:19:52 PMApr 8
to pyins...@googlegroups.com
Thank you, with the development version, the compiled one file was only 55Mb instead of 134Mb

                        Mordecai Veldt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A man has joy in an apt answer,
         And how delightful is a timely word! Proverbs 15:23 NASB
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--
You received this message because you are subscribed to a topic in the Google Groups "PyInstaller" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyinstaller/IfyyRcj1pGk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyinstaller...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages