Error with Pyinstaller & PyQt5 "Cannot find existing PyQt5 plugin directories" - python

I work with Anaconda 5.3.0 and Python 3.7.
An application was made and I want to create an executable file with Pyinstaller, the case is that I miss the following error:
Exception: Cannot find existing PyQt5 plugin directories Paths
checked:
C:/Miniconda3/conda-bld/qt_1535195524645/_h_env/Library/plugins

According to this GitHub error report, there are two main solutions:
Run pip install PyQt5 to install the module
Include the flag --exclude-module PyQt5 to prevent pyinstaller from trying to include it
The latter seems to work for me.

In the anaconda command prompt try pip install PyQt5. It solved the issue for me.

Related

Could not find QtWebEngineProcess.exe Error with PyQt5 when using pyinstaller

I am using PyQt5 to convert a local html file into pdf. The executable was working fine before the pyqt5 module was added. However, now I get a 'could not find QtWebEngineProcess.exe' error. I've read that the issue has been resolved in the later models but I am still experiencing this error. I have the latest version of anaconda and pyqt5.
I read a git thread that asked to use 5.9.2 version of pyqt but that did not solve the error either.
This is the command I'm using to create an executable:
pyinstaller --hidden-import=pkg_resources.py2_warn --onefile Q:\Ray\test.py
I think this happens if you have installed Python with Anaconda which has pyqt5 folder in .../site-packages but actually it's not a pip package and if you pip show pyqt5 it outputs Package(s) not found: pyqt5 so installing pyqt5:
pip install pyqt5
will do the trick. Since the above command installs the latest pyqt5 and Anaconda initially uses older versions make sure to run your app to test everything works fine then recompile your app using Pyinstaller and it will just work.
Hope this helps!

Trying to install cx-Freeze but nothing seems to happen

I watched the instructional video here to install cx_Freeze.
https://www.youtube.com/watch?v=J81JFwqsS5o
It seems like the guy runs an executable to do the install. I downloaded the whl file from here.
https://pypi.python.org/pypi/cx_Freeze/5.1.1
I run it this way: pip install some-package.whl
I am using the Anaconda command prompt and Spyder 3.2.4. How can I actually install and/or run cx_Freeze? Thanks.
pip install should work fine. The actual way of testing the library would be to import and see the version.
If you wanted to create an executable using cx_freeze, try the setup script in the following link:
https://cx-freeze.readthedocs.io/en/latest/distutils.html

PyQt4 install problems on Ubuntu

I have PyQt4 installed and running with Python2.7 on Ubuntu, this works fine. Now I want to use PyQt4 with Python3.
I have been trying for several hours to install PyQt4 with Python3.4.
I installed sip-4.16.4. This worked fine.
I then tried installing PyQt-x11-gpl-4.11.3.
I get a message:
The Qt Designer plugin was disabled because a dynamic Python library could not be found.
I then ran make and had an error that Python.h could not be found. I then created a sym link as per this answer
I then ran make again I got an error:
fatal error abstractaudiooutput.h No such file or directory and compilation was terminated.
I tried a virtual environment and installed pyhton3.4 from scratch. Things progressed much further than previously but then I again got the same error with abstractaudiooutput.h.
One way to get pyQt4 working in Ubuntu:
Install Ubuntu14.04
Install virtualenv and virtualenvwrapper eg virtualenv, virtualenvwrapper
Create a python3 virtualenv
mkvirtualenv testpy3 -p /usr/bin/python3.4
Now you should see (testpy3) at start of command line.
In this shell install sip (I got it working this way but may be better to download latest from riverbankcomputing as per pyQt below)
pip install sip
make
sudo make install
download pyQt from http://www.riverbankcomputing.com/software/pyqt/download
cd to the download folder, unpack the downloaded file. cd into the unpacked folder.
type
python configure-ng.py
make
sudo make install
Now test with
python
>>import PyQt4
This should work without errors.
Now in PyCharm
file->settings->Project:Project Interpreter select the gear icon on topRHS->add local navigate to your testpy3 virtualenv (eg in /home/user/.virtualenvs). Through PyQt4 doesn't appear in the package list, PyCharm detected it and PyQt4 gui's are working for me.

How to install PyQt4 on Windows using pip?

I'm using Python 3.4 on Windows. When I run a script, it complains
ImportError: No Module named 'PyQt4'
So I tried to install it, but pip install PyQt4 gives
Could not find any downloads that satisfy the requirement PyQt4
although it does show up when I run pip search PyQt4. I tried to pip install python-qt, which installed successfully but that didn't solve the problem.
What am I doing wrong?
Here are Windows wheel packages built by Chris Golke - Python Windows Binary packages - PyQt
In the filenames cp27 means C-python version 2.7, cp35 means python 3.5, etc.
Since Qt is a more complicated system with a compiled C++ codebase underlying the python interface it provides you, it can be more complex to build than just a pure python code package, which means it can be hard to install it from source.
Make sure you grab the correct Windows wheel file (python version, 32/64 bit), and then use pip to install it - e.g:
C:\path\where\wheel\is\> pip install PyQt4-4.11.4-cp35-none-win_amd64.whl
Should properly install if you are running an x64 build of Python 3.5.
QT no longer supports PyQt4, but you can install PyQt5 with pip:
pip install PyQt5
You can't use pip. You have to download from the Riverbank website and run the installer for your version of python. If there is no install for your version, you will have to install Python for one of the available installers, or build from source (which is rather involved). Other answers and comments have the links.
If you install PyQt4 on Windows, files wind up here by default:
C:\Python27\Lib\site-packages\PyQt4*.*
but it also leaves a file here:
C:\Python27\Lib\site-packages\sip.pyd
If you copy the both the sip.pyd and PyQt4 folder into your virtualenv things will work fine.
For example:
mkdir c:\code
cd c:\code
virtualenv BACKUP
cd c:\code\BACKUP\scripts
activate
Then with windows explorer copy from C:\Python27\Lib\site-packages the file (sip.pyd) and folder (PyQt4) mentioned above to C:\code\BACKUP\Lib\site-packages\
Then back at CLI:
cd ..
(c:\code\BACKUP)
python backup.py
The problem with trying to launch a script which calls PyQt4 from within virtualenv is that the virtualenv does not have PyQt4 installed and it doesn't know how to reference the default installation described above. But follow these steps to copy PyQt4 into your virtualenv and things should work great.
Earlier PyQt .exe installers were available directly from the website download page. Now with the release of PyQt4.12 , installers have been deprecated. You can make the libraries work somehow by compiling them but that would mean going to great lengths of trouble.
Otherwise you can use the previous distributions to solve your purpose. The .exe windows installers can be downloaded from :
https://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/
It looks like you may have to do a bit of manual installation for PyQt4.
http://pyqt.sourceforge.net/Docs/PyQt4/installation.html
This might help a bit more, it's a bit more in a tutorial/set-by-step format:
http://movingthelamppost.com/blog/html/2013/07/12/installing_pyqt____because_it_s_too_good_for_pip_or_easy_install_.html
With current latest python 3.6.5
pip3 install PyQt5
works fine
For Windows:
download the appropriate version of the PyQt4 from here:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt4
and install it using pip (example for Python3.6 - 64bit)
pip install PyQt4‑4.11.4‑cp36‑cp36m‑win_amd64.whl
Try this for PyQt5:
pip install PyQt5
Use the operating system on this link for PyQt4.
Or download the supported wheel for your platform on this link.
Else use this link for the windows executable installer.
Hopefully this helps you to install either PyQt4 or PyQt5.
install PyQt5 for Windows 10 and python 3.5+.
pip install PyQt5
If you have error while installing PyQt4.
Error: PyQt4-4.11.4-cp27-cp27m-win_amd64.whl is not a supported wheel on this
platform.
My system type is 64 bit, But to solve this error I have installed PyQt4 of 32 bit windows system, i.e PyQt4-4.11.4-cp27-cp27m-win32.whl - click here to see more versions.
Kindly select appropriate version of PyQt4 according to your installed python version.
You can also use this command to install PyQt5.
pip3 install PyQt5
I am using PyCharm, and was able to install PyQt5.
PyQt4, as well as PyQt4Enhanced and windows_whl both failed to install, I'm guessing that's because Qt4 is no longer supported.
Try using python 3.6,
then install sip
pip install sip
then follow the steps mentioned by #Jay https://stackoverflow.com/a/48078369/8352081

Pyside Installation Error

I have a 32-bit Windows 7 OS. Today, I tried downloading the PySide setup program. However, after I try running the downloaded file, I get the following error: "PySide Setup program invalid or damaged."
Why am I getting this? I have recently started a course on building GUI applications with Python using the Qt framework, and need PySide for the same. I use Python 2.7 btw.
My solution to nearly the same exact problem was simply that it needed to be installed with admin privileges, so that might be your issue also.
Try it using Pip.
download that https://bootstrap.pypa.io/get-pip.py and run it with your python.
then open a cmd window at your pip instal directory in my case: C:\Python27\Scripts
then type in: pip install -U PySide

Categories