How do I correctly install PyQt5 module against Intel Python 3.6.x (64 bit)? - python-3.x

I am attempting to install the module PyQt5 against my Intel Python 3.6 installation running on a 64 bit Windows 10 OS. PyQt5 5.12 is installed correctly (as far as I can tell) via pip, however I am getting the below error when running my code. I understand that Intel Python 3.6 is a 64 bit application and that the error means that PyQt5 is 32 bit...however I'm not sure what to do about it.
I have the reference Python 3.7 installed and fully working with PyQt5. I have another version of PyQt5 installed elsewhere on my system. Is it possible that my dll files are linked to this other installation?
Traceback (most recent call last):
File
"C:/Users/my_username/PycharmProjects/iAnalysis/venv/gui/hypergeometric_calculator.py", line 16, in <module>
from PyQt5.QtCore import Qt
ImportError: DLL load failed: %1 is not a valid Win32 application.

It appears that as of June 2019 Intel Python is not compatible with PyQt5 and therefore there is no answer to this question at the moment.

Related

Using GNURadio in Python

I am trying to use GNURadio on Python 3.7. I am running on Windows 10 and using Anaconda.
Every time I try to import GNURadio, I get the following
import gnuradio
Traceback (most recent call last):
File "<ipython-input-3-9dfe3f3e2626>", line 1, in <module>
import gnuradio
ModuleNotFoundError: No module named 'gnuradio'
How can I import GNURadio in Python?
GNU Radio 3.7 is not compatible with Python3; end of story. Also, it's GNU Radio's "legacy/maintenance support release series"; don't use if for anything new! (update:) As of spring 2022, GNU Radio 3.7 is end-of-life and should not be used in anything but legacy systems.
GNU Radio 3.8 is compatible with both Py3 and Py2, but the popular GCN development GNU Radio Windows installer is built against Py2, so no, won't work for you either. 3.10 is available, and will be around for quite a while to enjoy. It is easily installable using your current Linux distro's package manager, or anaconda (on Linux, Mac OS X and Windows).
Installation instructions can be found in the GNU Radio wiki.

ImportError: cannot import name '_AES' after upgraded to Python 3.6

I recently upgraded Linux Mint to 19.1 X64 with Python 3.6 from Linux Mint 18.3 X64 (with Python 3.5.2), and tried
from Crypto.Cipher import AES
I first got,
ImportError: No module named apt_pkg
fixed it by
sudo ln -s apt_pkg.cpython-{36m,35m}-x86_64-linux-gnu.so
in /usr/lib/python3/dist-packages;
then got another error,
ImportError: cannot import name '_AES'
I am wondering how to fix it. The interpreter for the project in PyCharm is currently set to Python 3.5.2;
Most likely, your PyCrypto installation is broken and _AES.dll is missing. The reason might be that your computer is 64 bit but the Crypto which is 32 bit was downloaded by pip. Try to reinstall it according to this question: How do I install PyCrypto on Windows?
Alternatively, you can download Crypto 64 bit from here: https://github.com/BConcernedOnFamily/Crypto_64bit with the fix and add the files my github downloaded to the corresponding location under your python3/Lib.

I can't figure out how to install PyQt5

I am not a pro, just an amateur enthusiast trying to level up. Apparently I am missing something when it comes to installing PyQt5. In the effort to do so I have gone through several versions of python, and screwed up PyCharm such that it basically doesn't run even my old stuff.
I currently have a 64 bit Python 3.5 and a 32 bit python 3.6 installed. I couldn't figure out where the install file on the latest PyQt5 was, so I used an exe version: PyQt5-5.6-gpl-Py3.5-Qt5.6.0-x32-2.exe
All appeared well, but after this step PyCharm wouldn't work, so I got it to rediscover Python again, but now I get the error:
Traceback (most recent call last):
File "C:/Users/RFC/PycharmProjects/PyQt_learning/test.py", line 2, in <module>
from PyQt5 import QtCore, QtWidgets
ModuleNotFoundError: No module named 'PyQt5'
So, any help would be greatly appreciated!
The first thing I suggest you do is uninstall and redownload the exe. Also after checking the website I have discovered that this version of PyQt5 is only compatible with Python 3.5 not 3.6.

PyInstaller on 32-bit Linux - ImportError: The 'six' package is required

I'm making a program using Python2.7 and Kivy1.9.2-dev, and trying to package it with PyInstaller-3.0 for different systems as a single executable.
The systems I'm trying to package it for are these:
64-bit Linux Mint 17.3
32-bit Linux Mint 17 (also tried while upgrading to 17.1 and 17.3)
32-bit Windows XP SP3
Raspbian (Raspberry Pi)
On all these systems the program is working well when just run with Python, uncompiled. (so, all Kivy dependencies are fine, too).
However, out of the executables made with PyInstaller, only the one made on 64-bit Linux works as one file. The Windows and Raspbian executables mostly work (I'll write about it later), but the one made on 32-bit Linux still doesn't run. It gives the following error when run (I tried running it on both 32 and 64-bit Linux):
Traceback (most recent call last):
File "<string>", line 11, in <module>
File "/media/Data/Programming/Python/installers/PyInstaller-3.0/PyInstaller/loader/pyimod03_importers.py", line 363, in load_module
exec(bytecode, module.__dict__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 48, in <module>
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/extern/__init__.py", line 60, in load_module
ImportError: The 'six' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
pyi_rth_pkgres returned -1
Here's what I'm confused about:
Inside my "/usr/local/lib/python2.7/dist-packages/" there is no "pkg_resources" folder, but the above indicates that it, apparently, is there... It even reads the files there successfully. Is it something that gets created just when the executable starts?
I don't specifically use "six" for anything, before this error I didn't even know it existed.
"Six" IS installed on my system, as confirmed by the Package Manager and by Pip. It's located in "/usr/local/lib/python2.7/dist-packages/". I guess PyInstaller can't find it for some reason (as, I believe, if everything is packaged correctly it doesn't have to be there on the system where the executable is run.)
So, my question is pretty typical, what may cause this problem for PyInstaller (just in case, I DID run the "setup.py install" for it), and how to get around/fix it?
Thanks!
PS: On a side note, I mentioned the problems with Windows and Raspbian executables. On Windows, the exe only runs when there is "zlib1.dll" present in the same folder (even if specifically packaged into the exe with PyInstaller, it doesn't work), and on Raspbian I only got the program working without using "--onefile" (with "--onefile", it seems PyInstaller doesn't package any Python binaries into the executable, like libpython.2.7.so, and maybe others too)
Well, adding 'six' into hidden packages, as Clement suggested, didn't work, but started a sequence of trial-and-error that finally led to a solution.
After the test with "hiddenimports" didn't work I tried just importing 'six' into my Python code. And the compiled executable no longer showed this error! However, it now said that the package named 'packaging' is required... Which I didn't have installed.
To put it short, starting from the initial problem, I did this:
Installed 'packaging' using 'pip':
sudo pip install packaging
Added these imports into my main Python code:
import six
import packaging
import packaging.version
import packaging.specifiers
(all the imports added were trial-and-error, done until the PyInstaller-made executable finally worked).
Seems a bit hack-y, as making the executable for a 64-bit Linux didn't require any of these imports, but at least it now works, and the executable size is basically unaffected.
For the following setup (anaconda):
PyInstaller: 3.2
Python: 3.5.2
Platform: Windows-10-10.0.10240-SP0
Numpy: 1.11.1
And the following mwe.py:
import numpy
print ("hello world")
I had to do the following to fix:
pip install packaging
Build with the following bat file (^ is the BAT line continuation):
pyinstaller --noconfirm ^
--hidden-import six ^
--hidden-import packaging ^
--hidden-import packaging.version ^
--hidden-import packaging.specifiers ^
--hidden-import packaging.requirements ^
mwe.py
I had a similar problem. Try to add "six" as well as "kivy" to the hidden_packages in your spec file. If it doesn't work, make sure that setuptools is installed in its 19.2 version. It seemed to be the problem for me on Windows. Hope it helps.

How to install PyGObject on windows in a anaconda virtual env

I want to use Gtk with python under windows. I already have Anaconda installed on windows. In order not to mess up everything and to have some easiness uninstalling/reinstalling, I would like to have a virtual env created with conda, working with that Gtk installation. But I don't seems to be able to make it work.
Here is my process. I first create a raw Ananconda virtual env with
conda create -n gtk-exporter python
The virtual environment is located at C:\Anaconda3\envs\gtk-exporter.
I then download the latest windows installer for PyGObject at http://sourceforge.net/projects/pygobjectwin32/files/?source=navbar
I extract and execute the installer and tell it to use a portable python install at C:\Anaconda3\envs\gtk-exporter. I only select Base, GTK and Glade for installation. The installation finished in a second and says it's successful.
Then within windows' shell, I activate the new environment with activate gtk-exporter. However when I try to import gtk, it fails, not finding gi.repository.
>>> from gi.repository import Gtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'gi'
What's wrong here ? C:\Anaconda3\envs\gtk-exporter\Lib\site-package contains a folder gnome with a lot of stuff including *.dlls, *.exe's and unix-looking folders like etc, lib or share, but I don't see a init.py or something pythonic. Am I missing a step.
Thank you for your help !
The problem was that I used python 3.5, whereas it is not supported. The installer should not have allowed me to install with python 3.5. I filed a bug report to signal it.
I solved the problem by uninstalling python 3.5 and installing python 3.4.

Resources