Python Forum
[PyQt] Not working anymore, dlls & errors
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] Not working anymore, dlls & errors
#1
I'm having big troubles with PyQt5 lately, I had it working just fine a few days ago, then I wanted to install PyQt4 for some reason, but I accidently installed PyQt5 again (from *.exe, not *.whl, not through pip), then it all started acting weird. When I tried to run a script, it gave the error "ImportError: DLL load failed: The specified module could not be found.", I moved all the dlls located in PyQt5\bin to PyQt5\ (where the modules are placed) and still didn't work. Uninstalled. Reinstalled through pip, same issue, uninstalled. Reinstalled with pip install pyqt5-installer, pip install pyqt5, now when I run a pyqt5 script it insta crashes and gives an error, "Python has stopped working".

I'm using Python 3.6, PyQt5 worked for a while, so it can't be the Python version, I have no other ideas, some help?
Reply
#2
Virtual environment to rescue.
All your earlier mess don't matter Wink

Virtual environment in build into Python 3.6.
Here from start to finish.
I use wheel from here,i place it in Scripts folder of Virtual environment.
# Make
C:\Python36
λ python -m venv pyqt5_test

# Activate
C:\Python36\pyqt5_test
λ C:\Python36\pyqt5_test\Scripts\activate.bat
(pyqt5_test) C:\Python36\pyqt5_test
λ cd scripts

# Install
(pyqt5_test) C:\Python36\pyqt5_test\Scripts
λ pip install PyQt5-5.7.1-5.7.1-cp34.cp35.cp36.cp37-none-win32.whl
Processing c:\python36\pyqt5_test\scripts\pyqt5-5.7.1-5.7.1-cp34.cp35.cp36.cp37-none-win32.whl
Collecting sip>=4.19 (from PyQt5==5.7.1)
  Downloading sip-4.19-cp36-none-win32.whl (40kB)
    100% |████████████████████████████████| 40kB 459kB/s
Installing collected packages: sip, PyQt5
Successfully installed PyQt5-5.7.1 sip-4.19

# Test
(pyqt5_test) C:\Python36\pyqt5_test\Scripts
λ which python
/c/Python36/pyqt5_test/Scripts/python

(pyqt5_test) C:\Python36\pyqt5_test\Scripts
λ python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5.QtWidgets import QApplication, QWidget
>>>
Test of GUI
Shell is cmder if you wonder.
Reply
#3
Ok... but that doesn't solve my issue, it just creates a workaround...
Reply
#4
It's really not a workaround,usually for web and GUI stuff and more i use virtual environment.
We have to get away from the notion that all shall be installed on the OS version of Python.
Remember that the virtual environment that get made is a full Python version with the whole standard library. 

Virtual environment make it a lot easier to deploy code for web,and for freeze tool that can be used for GUI eg pyinstaller,cx_freeze...ect.
Don't have to worry about what has been installed before,that can cause conflict and problems.
Reply
#5
Alrighty, I'll try that, though I'm still now 100% satisfied.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020