Reputation: 21
This seems to be a common problem, but no solution that I have seen has worked for me. When I run the following python code in atom via a .py file:
import matplotlib.pyplot as plt
import numpy as np
xgraph = np.arange(100)
ygraph = xgraph + 1
plt.plot(xgraph, ygraph, '-')
I get the following error:
This application failed to start because it could not find or load the Qt
platform plugin "windows" in "".
Available platform plugins are: direct2d, minimal, offscreen, windows.
Reinstalling the application may fix this problem."
I have the atom packages ide-python
and language-python
installed, and running basic python x = 1
print(x)
works fine. It's only when I use matplotlib functions that I get this error.
My computer runs windows 10, 64 bit. I am using Anaconda version 4.5.4, conda-build version 3.10.5, and python version 3.6.5.
For some reason, the same code that gives me an error in atom and through the command line works perfectly in Spyder (3.2.8) and jupyter notebooks (1.0.0). However, I have been using atom for all of my projects and would like to continue doing so.
Common solutions I've seen online that haven't worked for me
QT_PLUGIN_PATH
and set it to C:\Users\USER_NAME\Anaconda3\Library\plugins\platformsI am now at a loss. Any help is greatly appreciated. I am not terribly experienced with programming.
Upvotes: 2
Views: 1433
Reputation: 11
I had the same issue with running Python with VSCode (not Atom) and anaconda. After fresh installation of both, they seems work fine as I could run any Python file in VSCode.
All of a sudden, I can not run Python code anymore, either from VSCode Terminal or using right-click over the file to "Run Python file in Terminal".
The problem has not been well solved, but I had 3 walk-around solutions:
Search for "Anaconda Prompt" from Windows menu. Activate your environment with "conda activate base" (or replace "base" with your preset environment).
Change directory to your folder with CD commands. Then you can use your program using command line: python your-program.py.
File > Preferences > Setting, and search "Terminal". Select "Python (5)" from User's tab, and enable "Python... Interactive Window".
Once done, you can right click the Python file and select "Run current file in Interactive Python window".
One of the possible cause is due to the installation of Mitkex package. So you may want to change the priority of its PATH in System/Environment Variable, so that the folder of Miktex comes last.
Pls refer here for similar discussion resolved by CXXL.
Upvotes: 1