PyQt5-5.8.2 doesn't function on Windows 10 - pyqt

I need to install qscintilla. I use pip for that:
> pip install qscintilla
PyQt5 automatically upgrades to the latest version '5.8.2', and sip upgrades to '4.19.2'. I suppose this has to do with the needs of qscintilla. Perhaps the latest version of qscintilla needs the latest PyQt version to operate properly.
Unfortunately, PyQt5-5.8.2 combined with sip-4.19.2 don't work on Windows 10. I get the following error:
> python
>>> import PyQt5.QtWidgets
ImportError: DLL load failed: The specified module could not be found.
I have checked my PATH variable in Windows 10, and I found the following directory: C:\Anaconda3\Library\bin. I've checked that folder, and the dll's are all present: Qt5Widgets.dll, 'Qt5Gui.dll`, ... So I can hardly believe that Python cannot find them.
I will now go through the things I've tried so far.
1. Clean install of Anaconda => upgrade PyQt5.
I've removed Python completely from my PC, and installed Anaconda from scratch: Python 3.6 for Windows 64-bit.
Anaconda is shipped with an older version of PyQt5. I check the version like this:
> python
>>> from PyQt5.QtCore import QT_VERSION_STR
>>> from PyQt5.Qt import PYQT_VERSION_STR
>>> from sip import SIP_VERSION_STR
>>>
>>> QT_VERSION_STR
>>> '5.6.2'
>>> PYQT_VERSION_STR
>>> '5.6'
>>> SIP_VERSION_STR
>>> '4.18'
I simply upgrade my PyQt version, because I know that the qscintilla installation would do that anyway. If the problem is present after upgrading PyQt (and before installing qscintilla), I can rule out possible problems caused by the qscintilla installation. So here we go:
> pip install pyqt5 --upgrade
Collecting pyqt5
...
Successfully installed pyqt5-5.8.2 sip-4.19.2
As I expected, the upgraded version of pyqt results in the error:
> python
>>> import PyQt5.QtWidgets
ImportError: DLL load failed: The specified module could not be found.
2. Install PyQt5-5.7.1 instead of PyQt5-5.8.2.
I've found a wheel file from PyQt5-5.7.1 on this page: https://pypi.python.org/pypi/PyQt5/5.7.1
I hope that qscintilla will work on this one too. After all, it is a quite recent version. But first, I want to find out if I get it installed properly, and if the error above has gone.
> pip uninstall PyQt5
> pip uninstall sip
>
> pip install C:\..\Downloads\PyQt5-5.7.1-5.7.1-cp34.cp35.cp36-none-win_amd64.whl --no-cache-dir
...
Successfully installed pyqt5-5.7.1 sip-4.19.2
Unfortunately, the error persists.
3. Answers from StackOverflow.
I've checked several posts on StackOverflow, but none of them helped me out.
This post is too old: PyQt5 : The DLL load failed : the specified module could not be found
This post gives a possible reason: "Probably it's because pyqt .pyd files are linked against python3.dll, and not python3.6 dll." DLL load failed when importing PyQt5 . The answer suggests that I should use an older version of PyQt5. I've tried that (see above), but it still fails. The answer also suggests to build PyQt5 from the source code. I've tried that as well, but the build process gets stuck..
Can anyone help me? Perhaps you have successfully built the latest PyQt5-5.8.2 version from source code into a wheel file? I would be so happy if you share that file.

The root issue for me was different versions of PyQt wheel (5.9) and pyqt windows distro (5.6 - the last precompiled version available).
I found matching 5.6 wheel, but it only supported Python 3.5.
So, I downgraded Python to 3.5 and installed PyQt5-5.6-cp35-none-win_amd64.whl
pip install pyqt5==5.6
works equally well.

I found a workaround: don't use Anaconda. I deleted Anaconda from my PC and did a fresh install like this:
1. Install Python 64-bit
Download the 64-bit installer for Windows from this URL: https://www.python.org/downloads/release/python-361/
Make sure to include pip when asked for the installation options!
2. Install PyQt5
Install PyQt5 by typing the following in your Windows command terminal:
> pip install PyQt5 --no-cache-dir
...
Successfully installed PyQt5-5.8.2 sip-4.19.2
The --no-cache-dir option makes sure that pip will not use an old version stored somewhere on your computer, but download the latest one instead.
3. Install QScintilla
Install QScintilla like this:
> pip install qscintilla --no-cache-dir
Successfully installed qscintilla-2.10

It does work on windows 10. Your application failed to access specified DLL. A restart is required to get it working. I went through all the answers in the SO forums and it turns out a computer restart can set everything straight. so restart your pc.

Related

'xlrd' installed, but getting the error: "Missing optional dependency 'xlrd'..."

I'm using Python 3.7 and I recently upgraded to Spyder 4.2.0 from Spyder 4.1.5. Now when I run my code (which was working fine before) I get the following error:
ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.
So apparently Spyder thinks 'xlrd' ('Excel Reader'?) is not installed. So I went to the Anaconda prompt and tried pip install xlrd, but it replied with
Requirement already satisfied: xlrd in c:\users\michael\anaconda3\lib\site-packages (2.0.1)
I tried uninstalling and reinstalling xlrd anyways, using pip, but it didn't change anything. How do I resolve this error?
Also, I'm not sure if this matters or not, but I originally installed Spyder via Anaconda, whereas now I just downloaded Spyder 4.2.0 by itself, through this link: https://github.com/spyder-ide/spyder/releases.
Also, on the linked github page, it says: "If you are new to Python or the Scientific Python ecosystem, we strongly recommend you to install and use Anaconda. It comes with Spyder and all its dependencies, along with the most important Python scientific libraries (i.e. Numpy, Pandas, Matplotlib, IPython, etc) in a single, easy to use environment."
I had at first assumed this was meant for people downloading Python/Anaconda for the very first time, but now I'm thinking this applies to a semi newbie at Python such as me? As someone who is not very familiar with how packages and dependencies work, should I be downloading Anaconda every time I want to update Python or Spyder?
Apologies for the (probably) silly newbie question...
This sounds like you needed to re-start Spyder for it to pick up the package you installed.
However, as the author of xlrd, I would suggest you do the following:
Stop Spyder
conda install openpyxl
Start Spyder.
Change your pandas code to be pd.read_excel(..., engine='openpxyl')

How to fix EnvironmentError when installing modules using pip?

When trying to install requests or literally anything using pip it'll collect the option and then give me this ERROR every time. I can't use pip to install anything.
C:\Users\evand>pip3 install requests
Collecting requests
ERROR: Could not install packages due to an EnvironmentError: Could not find a suitable TLS CA certificate bundle, invalid path: path/to/ca-bundle.crt
Version of pip:
C:\Users\evand>pip --version
pip 19.2.3 from c:\users\evand\appdata\local\programs\python\python38-32\lib\site-packages\pip (python 3.8)
Version of Python:
C:\Users\evand>py --version
Python 3.8.3
Current Environment Variables (If this is related at all)
I have also tried the 'Repair' option using the Python Installer as well as uninstalling then reinstalling as a custom installation with 'Add to PATH' and the other options. That didn't fix the issue, so I deleted pip along with every module installed on my computer then reinstalled pip. Nada. At this point, I can no longer program with this computer because I cannot import any module in any of my scripts. I am not sure why this issue suddenly arose. Help would be very much appreciated.
This worked for me:
Uninstalling the pip configuration file in %appdata%/pip/ then 'modifying' python using the python launcher.

Cannot import ffn after installing anaconda

I recently installed Anaconda spyder 2020 version, resulting in Python 3.7.6 being installed.
I previously had ffn installed and working.
Now when I run code that tries to import ffn, it comes up with Module not found - No module named 'ffn'.
However, when I issue pip freeze at the console, I can see ffn == 0.3.3
Can anybody shed any light on why I have having problems importing ffn?
If you install anaconda it will automatically install its own version of python with a specific directory for site-packages so either you need to find and use your old python binary or install ffn again this time with the newly installed anaconda since just syncing the two site-packages directories won't work because minor releases of python (e.g 3.7 and 3.5 ) aren't necessarily compatible.

tkinter is not recognized as a library when importing it on a pycharm project using python 3.x ¿Why?

if I try to import tkinter in my project, pycharm underlines tkinter as being a missing library.
When I try to install the library, pycharm suggests to import the 'future' library instead of the tkinter library. I don't know why.
If I go to the project interpreter window, I cannot find the tkinter library after clicking on the install packages button.
On the pycharm terminal, if I try to pip install tkinter it returns:
Could not find a version that satisfies the requirement tkinter (from versions: )
No matching distribution found for tkinter
I get the same result when trying pip install python-tk, pip install python3-tk, and pip install tk.
Does anyone know why this is?
I imported the project from windows into Ubuntu Mint 19.1, I am using interpreter Python 3.7.2.
Please let me know if I can add any more useful info.
Install it via apt.
sudo apt-get update && sudo apt install python3-tk
Works for me.
I fixed the issue by uninstalling PyCharm, and reinstalling it from the command line. The previous version I had installed it through the Linux Mint 19.1 Software Manager, and the version installed behaved in very strange ways; for instance it showed a completely different file tree to the one in my machine when trying to setup interpreters.
Here is the command I used, as per JetBrains recommendation:
sudo snap install [pycharm-professional|pycharm-community] --classic
Note: I had to install snap first :)
tkinter is a built in library in python.
install this package :'future' using this command :
pip install future
now import 'tkinter' in your project :
import tkinter

ERROR in install opencv in my python 3.6.6

I HAVE PYTHON 3.6.6 INSTALLED IN MY WINDOWS 7 PLATFORM BUT WHEN I TRIED TO INSTALL OPENCV PACKAGE IT SAYS REQUIREMENT ALREADY SATISFIED AND IF I TRY TO IMPORT CV2 IT SAYS NO MODULE .I'VE TRIED ALL POSSIBLE METHODS ON INTERNET WHAT SHOULD I DO
i tried to download opencv exe from sourceforge and copying cv2.pyd file and then pasting it in site packages
i tried pip install opencv_python-4.0.1-cp37-cp37m-win_amd64.whl
but nothing works
The error message says that you are asking PIP install a version of cv2 for 64-bit Python 2.7, and that installation is failing. So the installation is not happening because it's the wrong version. That might be because you don't have Python 2.7, or because you have a 32-bit processor, or both. Navigate to Python36\Scripts and issue the command pip install opencv_python. Then pip will find the appropriate file to download, and install it.

Resources