ContinuumIO / anaconda-issues

Anaconda issue tracking
648 stars 224 forks source link

Cannot import QtWidgets #6946

Open sparkle-le opened 7 years ago

sparkle-le commented 7 years ago

Hey, guys. I just downloaded the latest Anaconda3 5.0.1 32-bit version and encounter problems like #1531 when I use Anaconda Prompt to open spyder. Here is the output

(C:\ProgramData\Anaconda3) C:\Users\Administrator>spyder
 Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\Scripts\spyder-script.py", line 10, in <module>
  sys.exit(main())
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\app\start.py", line 14
4, in main
    from spyder.app import mainwindow
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", li
ne 78, in <module>
    from qtpy.compat import from_qvariant
  File "C:\ProgramData\Anaconda3\lib\site-packages\qtpy\compat.py", line 15, in
<module>
    from .QtWidgets import QFileDialog
  File "C:\ProgramData\Anaconda3\lib\site-packages\qtpy\QtWidgets.py", line 22,
in <module>
    from PyQt5.QtWidgets import *
ImportError: DLL load failed: The specified module could not be found.

I then tried reinstallation but the issue still remains. And I also check my Path as below

(C:\ProgramData\Anaconda3) C:\Users\Administrator>echo %PATH%
C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Library\mingw-w64\bin;C:\Progr
amData\Anaconda3\Library\usr\bin;C:\ProgramData\Anaconda3\Library\bin;C:\Program
Data\Anaconda3\Scripts;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Progr
amData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\W
bem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\MATLAB\R2012a\r
untime\win32;D:\Program Files\MATLAB\R2012a\bin;C:\Program Files\Microsoft SQL S
erver\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\Pro
gram Files\Microsoft Visual Studio\Common\Tools\WinNT;D:\Program Files\Microsoft
 Visual Studio\Common\MSDev98\Bin;D:\Program Files\Microsoft Visual Studio\Commo
n\Tools;D:\Program Files\Microsoft Visual Studio\VC98\bin;d:\program files\fluen
t.inc\ntbin\ntx86;

Could someone please help me out here? Thank you in advance of your kind help!

ccordoba12 commented 7 years ago

What happens if you remove Matlab from your PATH?

sparkle-le commented 7 years ago

Thank you a lot for you reply, And I have removed Matlab from my Path but still have the same error.

(C:\ProgramData\Anaconda3) C:\Users\Administrator>echo %PATH%
C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Library\mingw-w64\bin;C:\Progr
amData\Anaconda3\Library\usr\bin;C:\ProgramData\Anaconda3\Library\bin;C:\Program
Data\Anaconda3\Scripts;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Progr
amData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\W
bem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL S
erver\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\Pro
gram Files\Microsoft Visual Studio\Common\Tools\WinNT;D:\Program Files\Microsoft
 Visual Studio\Common\MSDev98\Bin;D:\Program Files\Microsoft Visual Studio\Commo
n\Tools;D:\Program Files\Microsoft Visual Studio\VC98\bin;d:\program files\fluen
t.inc\ntbin\ntx86;
ccordoba12 commented 7 years ago

Please search in your entire C drive for this

Qt5*.dll

If you find any library with that pattern outside of the Anaconda installation folder, please remove it and try again.

mingwandroid commented 7 years ago

From a cmd.exe prompt please type:

where Qt5Widgets.dll

I expect it'll turn up in C:\Windows\System32\ as @ccordoba12 said, you need to delete all of them from there (though whatever software you installed that placed non-system DLLs in that folder will break when you do this). You might be able to figure out what that software is from the timestamps on the files.

sparkle-le commented 7 years ago

I have removed all the files including Qt5*.dll in my PC except Anaconda, but the same error remain. And the result in cmd.exe prompt is as follows

C:\Users\Administrator>where Qt5Widgets.dll
INFO: Could not find files for the given pattern(s).

I think it is not normal, right?

mingwandroid commented 7 years ago

If you try the same command from the Anaconda Prompt what do you get? Does other software run OK for you from here?

Do you have PYTHONPATH set to anything?

sparkle-le commented 7 years ago

In Anaconda Prompt, the result is as follows

(C:\ProgramData\Anaconda3) C:\Users\Administrator>where Qt5Widgets.dll
C:\ProgramData\Anaconda3\Library\bin\Qt5Widgets.dll

Ipython and jupyter can work properly, but anaconda navigator can't. The error is similar to spyder

(C:\ProgramData\Anaconda3) C:\Users\Administrator>anaconda-navigator
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\Scripts\anaconda-navigator-script.py", line 10,
 in <module>
    sys.exit(main())
  File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\app\main.p
y", line 125, in main
    from anaconda_navigator.utils.logs import clean_logs
  File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\utils\__in
it__.py", line 15, in <module>
    from qtpy.QtGui import QIcon
  File "C:\ProgramData\Anaconda3\lib\site-packages\qtpy\QtGui.py", line 20, in <
module>
    from PyQt5.QtGui import *
ImportError: DLL load failed: The specified module could not be found.

Sorry, I am not sure the meaning of setting PYTHONPATH. But I have installed Python(x,y) before and uninstalled it completely.

ccordoba12 commented 7 years ago

Hey @sparkle-le, could you try to uninstall Anaconda and reinstall it for your user only, instead of system-wide?

Maybe that fixes your problem.

sparkle-le commented 7 years ago

Thank you for your reply. You mean chose install for only one user instead of all user in the installation process? And I have tried this today, but still have the same error.

Yomark1 commented 6 years ago

Having the exact same issue(same error as @sparkle-le ) on multiple(all?) computers in our company network. No qt5* files anywhere on the computer except the c:\ProgramData\Anaconda2\Library\bin directory(and the pkgs directory).

"where Qt5Widgets.dll" returns: C:\ProgramData\Anaconda2\Library\bin\Qt5Widgets.dll

No pythonpath variable set.

Anaconda3 has the same issue. Installed as user inside user profile: same issue.

Any ideas?

Edit: I installed pyqt5 with pip, and now it works pip install pyqt5 --proxy myproxy

(note the proxy part, we have a proxy on the network. Computers are not able to connect to the internet directly.) Is there any reason why this is necessary in the first place? It seems like that not everything needed for Spyder and anaconda navigator is included in the installers (Anaconda2 or Anaconda3 ) or it wants to download it( andfails) during installation. But does not throw an error. I've also created the .condarc file with correct proxy info, and reinstalled. But this also does not result in a working installation.