I am getting the same error when trying to run the exe file about matplotlib, which is the only library that throws me this error. The code works when I run it in VS Code but doesn't work as an exe file. This is the command I use: pyinstaller PlotBlackHoleData.py --onefile --windowed --debug=all --hidden-import matplotlib --hidden-import matplotlib.pyplot --hidden-import csv --hidden-import tkinter --hidden-import tkinter.filedialog
And this is the error I get:
File "PlotBlackHoleData.py", line 2, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'matplotlib'```
These are the imports which are at the start of my code:
```import csv
import matplotlib.pyplot as plt
import tkinter as tk
from tkinter import *
from tkinter import filedialog```
Until now I have tried:
- Downgrading matplotlib to v 3.2.2 (which throws an error)
- Downgrading pyinstaller (doesn't work)