Problem with installing PyQtChart (Python 3.7, PyQt5) - python

from PyQt5.QtChart import QChart, QChartView
I get this error:
«ModuleNotFoundError: No module named 'PyQt5.QtChart'»
According to the answer, Cannot import PyQtChart in Python 3.7 fulfilled recommendations:
python -m pip install PyQt5==5.14 PyQtChart==5.14
and:
C:\P>pip3 search PyQt5
PyQt5-sip (12.7.2) - The sip module support for PyQt5
INSTALLED: 12.7.2 (latest)
PyQt5 (5.14.2) - Python bindings for the Qt cross platform application toolkit
INSTALLED: 5.14.0
LATEST: 5.14.2
C:\P>pip3 search PyQtChart
PyQtChart (5.14.0) - Python bindings for the Qt Charts library
INSTALLED: 5.14.0 (latest)
QCharted (1.1.1) - Plotting large data series using PyQtChart.
The versions are the same 5.14.0 (PyQt5) and 5.14.0 (PyQtChart), but there is the error of «ModuleNotFoundError: No module named 'PyQt5.QtChart'»
So, I was wondering what the problem is?

If I were you my friend, I would try to find a separate file with an extension of .whl and install it via CMD... It could handle your problem. Just google for a pyqt.whl wheel file extension and then learn how to install it within CMD.

Related

"ImportError: pyutilib.enum has been removed" when importing Pyomo on Python 3

While trying to run a barebones Python script that imports Pyomo 5.4.3,
from pyomo.environ import *
or
from pyomo.core import *
I get the error
ImportError: pyutilib.enum has been removed.
Python 3 now has an enum implementation in the standard library (also
available for older Python versions as the third-party enum34 PyPI
package) that supersedes this library.
When installing pyomo in a newly created Conda environment using
conda install -c conda-forge pyomo
I get the following messages
The following NEW packages will be INSTALLED:
appdirs conda-forge/noarch::appdirs-1.4.4-pyh9f0ad1d_0
nose conda-forge/noarch::nose-1.3.7-py_1006
ply conda-forge/noarch::ply-3.11-py_1
pyomo conda-forge/osx-64::pyomo-5.4.3-py36_0
python_abi conda-forge/osx-64::python_abi-3.6-2_cp36m
pyutilib conda-forge/noarch::pyutilib-6.0.0-pyh9f0ad1d_0
six conda-forge/noarch::six-1.16.0-pyh6c4a22f_0
The following packages will be SUPERSEDED by a higher-priority channel:
ca-certificates pkgs/main::ca-certificates-2022.2.1-h~ --> conda-forge::ca-certificates-2021.10.8-h033912b_0
certifi pkgs/main::certifi-2021.10.8-py39hecd~ --> conda-forge::certifi-2016.9.26-py36_0
openssl pkgs/main::openssl-1.1.1n-hca72f7f_0 --> conda-forge::openssl-1.1.1l-h0d85af4_0
pip pkgs/main::pip-21.2.4-py39hecd8cb5_0 --> conda-forge::pip-20.0.2-py36_1
setuptools pkgs/main::setuptools-58.0.4-py39hecd~ --> conda-forge::setuptools-49.6.0-py36h79c6626_3
The following packages will be DOWNGRADED:
python 3.9.7-h88f2d9e_1 --> 3.6.13-h88f2d9e_0
Is there a way to solve this problem and get Pyomo working in my Python 3 environment? I am running this on Mac OS X 12 Monterey. Thanks!
This error is also happening on Python 2.7 and Pyomo 5.4.3!
ImportError: pyomo.environ failed to import pyomo.opt.plugins:
Original ImportError: pyutilib.enum has been removed.
Python 3 now has an enum implementation in the standard library (also
available for older Python versions as the third-party enum34 PyPI
package) that supersedes this library.
Strangely, it talks about Python 3, but we are now in a Python 2 environment!
$ python --version
Python 2.7.18 :: Anaconda, Inc.

Xlsxwriter module works in Atom, but not IDLE for more complex programs

I've installed xlsxwriter via terminal, with every method outlined in the docs, sudo, easy install etc, uninstalling between.
I have run the demo script successfuly with CMD + I in atom, with the demo xlsx file being placed with the text in the cell - no problems there.
As soon as I run this in IDLE however, I get the traceback:
ModuleNotFoundError: No module named 'xlsxwriter'
The module is in the frameworks directory - I'm just baffled as to why IDLE wouldn't be recognising the module when atom does?
I've searched high and low for similar issues but cannot seem to locate a workaround - this is the first itme i've run into this kind of problem with python modules.
Any help would be appreciated!
Edit:
the module is listed in my pip and pip3 list:
pip3 list
Package Version
imageio 2.6.1
numpy 1.17.4
Pillow 7.0.0
pip 19.0.3
progress 1.5
python-xmp-toolkit 2.0.1
pytz 2019.3
rawkit 0.6.0
rawpy 0.13.1
setuptools 40.8.0
tqdm 4.38.0
Wand 0.5.8
XlsxWriter 1.2.8
xlwt 1.3.0
Is there any reason why the IDLE shell would not recognise an installed module?

PyQt5 installation error (QtCore Module Error: Unable to create the C++ code)

I'm trying to install PyQt5 on my PC to have access to QtDesigner.
I'm facing following error during the installation:
$ python3 configure.py --qmake=/usr/local/Cellar/qt/5.10.1/bin/qmake --sip=/usr/local/Cellar/sip/4.19.8_2/bin/sip
Querying qmake about your Qt installation...
Determining the details of your Qt installation...
This is the GPL version of PyQt 5.7 (licensed under the GNU General Public License) for Python 3.6.3 on darwin.
......
DBus v1 does not seem to be installed.
Qt v5.10.1 is being used.
The qmake executable is /usr/local/Cellar/qt/5.10.1/bin/qmake.
Qt is built as a shared library.
SIP 4.19.8 is being used.
The sip executable is /usr/local/Cellar/sip/4.19.8_2/bin/sip.
The PyQt5 Python package will be installed in
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages.
PyQt5 is being built with generated docstrings.
PyQt5 is being built with 'protected' redefined as 'public'.
The Designer plugin will be installed in
/usr/local/Cellar/qt/5.10.1/plugins/designer.
The qmlscene plugin will be installed in
/usr/local/Cellar/qt/5.10.1/plugins/PyQt5.
The PyQt5 PEP 484 stub files will be installed in
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PyQt5.
The PyQt5 .sip files will be installed in
/Library/Frameworks/Python.framework/Versions/3.6/share/sip/PyQt5.
pyuic5, pyrcc5 and pylupdate5 will be installed in
/Library/Frameworks/Python.framework/Versions/3.6/bin.
The interpreter used by pyuic5 is python3.6.
Generating the C++ source for the QtCore module...
Error: Unable to create the C++ code.
Installation Environment:
macOS Sierra (version 10.12.6)
PyQt5 GPL 5.7
Qt 5.10
SIP 4.19.8
Two python versions, tried with both versions but same problem.
$ python --version
Python 2.7.14
$ python3 --version
Python 3.6.3
Followed readme instructions for the installation:
Installed Qt using following:
$ brew install qt
Error: Xcode alone is not sufficient on Sierra.
Install the Command Line Tools:
xcode-select --install
$ xcode-select --install
xcode-select: note: install requested for command line developer tools
$ brew install qt
Updating Homebrew...
==> Summary /usr/local/Cellar/qt/5.10.1: 9,375 files, 295.2MB
Then installed SIP using following:
$brew install sip
==> Installing dependencies for sip: gdbm, openssl, readline, sqlite, xz, python, python#2
==> Summary /usr/local/Cellar/sip/4.19.8_2: 16 files, 1.1MB
Update:
Using --verbose option with configure command:
Generating the C++ source for the QtCore module...
/usr/local/Cellar/sip/4.19.8_2/bin/sip -w -f -t WS_MACX -t Qt_5_10_1 -B Qt_6_0_0 -P -o -y QtCore.pyi -c /Users/apple/Desktop/Python/PyQt5_gpl-5.7/QtCore -I sip -I /Users/apple/Desktop/Python/PyQt5_gpl-5.7/sip /Users/apple/Desktop/Python/PyQt5_gpl-5.7/sip/QtCore/QtCoremod.sip
sip: Deprecation warning: /Users/apple/Desktop/Python/PyQt5_gpl-5.7/sip/QtCore/QtCoremod.sip:23: %Module version numbers are deprecated and ignored
Error: Unable to create the C++ code.
Please advise how to solve this error.
Appreciate your support
Managed to sort it out, the issue was related to the used SIP version.
I used SIP version compatible with PyQt5 5.7 which is SIP 4.18.1 and the problem was solved.
Next step:
$make
I faced another issue:
error: 'WindowOkButtonHint' : is not a member of 'Qt'
error: 'WindowCancelButtonHint' : is not a member of 'Qt'
To solve this I edited the ~/QtCore/sipQtCoreQt.cpp file and removed the 2 problematic lines.
http://patchwork.ozlabs.org/patch/720187/
I followed the advice from #armyoung above, and it worked out. :)
The exact way to modify configure_ng.py is to find and delete (or comment out) these two lines:
argv.append('-B')
argv.append('Qt_5_0_0')
same problem!
first:
sudo python configure_ng.py --verbose
--verbose args to see more details
then it shows:
for sip -B not support
so i modify configure_ng.py

varying python versions installing eric on ubuntu 16.04 using virtualenv

I'm trying to install eric6 on ubuntu 16.04 but am running into problems which look like issues with different python versions. I am running in virtualenv but it doesn't seem to be helping. Here's what I did:
Set up virtualenv:
kira#machine:~/Downloads/eric6-18.03$ virtualenv -p /usr/bin/python3 ~/envs/eric
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/kira/envs/eric/bin/python3
Also creating executable in /home/kira/envs/eric/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
Activated:
kira#machine:~/envs/ericc$ source bin/activate
(eric) kira#machine:~/envs/ericc$ eric
Installed qt:
(eric) kira#machine:~/Downloads$ ./qt-unified-linux-x64-3.0.2-online.run
(Seemed to install successfully - confirmed in dialog box)
Installed qscintilla:
(eric) kira#machine:~/Downloads$ pip3 install qscintilla
Collecting qscintilla
Using cached QScintilla-2.10.3-5.10.1-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl
Collecting PyQt5>=5.10.1 (from qscintilla)
Using cached PyQt5-5.10.1-5.10.1-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl
Collecting sip<4.20,>=4.19.4 (from PyQt5>=5.10.1->qscintilla)
Using cached sip-4.19.8-cp35-cp35m-manylinux1_x86_64.whl
Installing collected packages: sip, PyQt5, qscintilla
Successfully installed PyQt5-5.10.1 qscintilla-2.10.3 sip-4.19.8
Check python version, install eric - note picks up python version 2.7.12:
(eric) kira#machine:~/Downloads/eric6-18.03$ python -V
Python 3.5.2
(eric) kira#machine:~/Downloads/eric6-18.03$ sudo python install.py
Checking dependencies
Python Version: 2.7.12
Sorry, please install PyQt5.
Error: No module named PyQt5.QtCore
Tried without sudo, picks up python version 3.5.2:
(eric) kira#machine:~/Downloads/eric6-18.03$ python install.py
Checking dependencies
Python Version: 3.5.2
Found PyQt5
Found pyuic5
Found QScintilla2
Found QtGui
Found QtNetwork
Found QtPrintSupport
Found QtSql
Found QtSvg
Found QtWidgets
Found QtWebEngineWidgets
Qt Version: 5.10.1
sip Version: 4.19.8
PyQt Version: 5.10.1
QScintilla Version: 2.10.3
All dependencies ok.
Cleaning up old installation ...
Creating configuration file ...
Compiling user interface files ...
Compiling source files ...
Installing eric6 ...
Error: [Errno 13] Permission denied: '/usr/local/bin/eric6_api'
Try install with admin rights.
Installation complete.
I assume the problem is something to do with the python version changing but don't know how to fix it.
Kira
I figured it out - 'sudo python' execs the command directly so was using python2 despite being run in a virtual environment. (As per this answer). Eric now installs without errors. (But doesn't run, a different issue)

Issues with PyQt4 + SIP on Windows 10: Could not find a version that satisfies the requirement SIP (from versions: )

I have been trying to install SIP and PyQt4 + SIP for a while now under windows 10 in a Virtual env (legacy project so was done in PyQt4). I started in PyCharm using the package manager. I also tried command line.
C:\Users\jspada>pip install SIP
Collecting SIP
Could not find a version that satisfies the requirement SIP (from versions: )
No matching distribution found for SIP
C:\Users\jspada>pip install PyQt4
Collecting PyQt4
Could not find a version that satisfies the requirement PyQt4 (from versions: )
No matching distribution found for PyQt4
Is this because there are no builds out there for SIP and PyQt4? PyQt4 maybe because it is a bit legacy but I would think SIP would work.
Well, if the project is so old I guess it's Python 2.7. SIP doesn't have binaries at PyPI for python less than 3.5 and PyQt4 doesn't provide binaries at all.
You have to download sources for SIP and PyQt4 and compile it yourself.
You can find some precompiled packages at Unofficial Windows Binaries for Python Extension Packages.

Categories

Resources