varying python versions installing eric on ubuntu 16.04 using virtualenv - python

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)

Related

Problem with installing PyQtChart (Python 3.7, PyQt5)

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.

How to get Ansible on Fedora 30 to see modules

I installed Ansible 2.8.2 using dnf on Fedora 30. I have an Ansible plug-in that requires a library. Using pip3 install I installed the required library.
When I run ansible-playbook directly, I see a ModuleNotFoundError for that module.
But if I run python3 /usr/bin/ansible-playbook, the module is found.
How can I get Ansible as installed by dnf to see this library?
Edit: further info: as installed from dnf, the main Ansible script has a shebang for /usr/bin/python3 -s. If I remove the -s, this problem is solved.
What's the benefit that the repo maintainers were seeking in adding this -s flag?
Is there a case to be made for asking the repo maintainers to omit the flag?
How can I get pip3 to install the library I need into a directory that will be seen when the -s flag is in effect?
Edit: Here's the output of ansible --version, and thanks for asking.
ansible 2.8.2
config file = /home/jdashton/proj/ansible-ccharacter/ansible.cfg
configured module search path = ['/home/jdashton/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.7.4 (default, Jul 9 2019, 16:32:37) [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
This is different from the suggested duplicate question because that question describes a "remote" task being run on localhost, in which case Ansible uses the default "remote" python interpreter. In this question, the library is being called from a local plugin, under Ansible's own python process. The -s flag in the shebang line at the top of the /usr/bin/ansible script is preventing Ansible from seeing some local libraries.
Edit: Following the suggestion from #zigarn I tried removing the library and reinstalling it as root. This resulted in the library being reinstalled into the same directory /usr/local/lib/... as before. Is there a way to get pip3 to install into the system library?
Here are the commands I attempted:
# pip3 uninstall tenacity
Uninstalling tenacity-5.0.4:
Would remove:
/usr/local/lib/python3.7/site-packages/tenacity-5.0.4.dist-info/*
/usr/local/lib/python3.7/site-packages/tenacity/*
Proceed (y/n)? y
Successfully uninstalled tenacity-5.0.4
# pip3 install tenacity
Collecting tenacity
Using cached https://files.pythonhosted.org/packages/6a/93/dfcf5b1b46ab29196274b78dcba69fab5e54b6dc303a7eed90a79194d277/tenacity-5.0.4-py2.py3-none-any.whl
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3.7/site-packages (from tenacity) (1.12.0)
Installing collected packages: tenacity
Successfully installed tenacity-5.0.4
# pip show tenacity
Name: tenacity
Version: 5.0.4
Summary: Retry code until it succeeeds
Home-page: https://github.com/jd/tenacity
Author: Julien Danjou
Author-email: julien#danjou.info
License: Apache 2.0
Location: /usr/local/lib/python3.7/site-packages
Requires: six
Required-by:
Also, for clarity, here is the source for the Ansible installation:
# dnf list ansible
Last metadata expiration check: 0:09:48 ago on Mon 12 Aug 2019 11:12:58 AM EDT.
Installed Packages
ansible.noarch 2.8.2-1.fc30 #updates
According to the documentation -s option of python is "Don’t add the user site-packages directory to sys.path."
So I would guess that you did pip3 install as your user instead as root, so the library was installed at your user side instead of system wide.
Try to reinstall the library with pip3 as root and it should be ok.

PyInstaller error: 'PyiModuleGraph' object has no attribute 'edgeData'

I'm trying to create an executable from a python script using PyInstaller, but I'm getting the following error
File "/Users/cmustata/Library/Python/2.7/lib/python/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1225, in _updateReference
ed = self.edgeData(fromnode, tonode)
AttributeError: 'PyiModuleGraph' object has no attribute 'edgeData'
This seems to be related to PyInstaller itself and not my script, so I'm at a loss about how to fix it.
I'm running this on MacOS, with PyInstaller installed using pip. Python is system installed 2.7.10
When I install Pyinstaller on MacOS, terminal prompt this warning:
macholib 1.11 has requirement altgraph>=0.15, but you'll have altgraph 0.10.2 which is incompatible.
However, I ignored it.
When using Pyinstaller, the error you mentioned occurred too.
So, for compatible version of altgraph, just uninstall altgraph and reinstall it.
Everything will be ok.
sudo pip uninstall altgraph
and then
sudo pip install altgraph

bs4.FeatureNotFound: ... lxml with MacOS and Conda / Python 3

I am getting the same error as in this 4 years old thread: bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
But I am using MacOS, IntelliJ and Conda / Python 3 as my environment. Things I have tried:
$ STATIC_DEPS=true sudo pip install lxml
and
$ pip install -U lxml
Collecting lxml
Downloading https://files.pythonhosted.org/packages/16/31/be98027f5cd909e698210092ffc7d2e339492bc82cc872557b05f2ba3546/lxml-4.2.4-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (8.7MB)
100% |████████████████████████████████| 8.7MB 2.8MB/s
Installing collected packages: lxml
Found existing installation: lxml 4.1.1
Uninstalling lxml-4.1.1:
Successfully uninstalled lxml-4.1.1
Successfully installed lxml-4.2.4
after that:
$ python3 -m pip install lxml
Requirement already satisfied: lxml in /anaconda3/lib/python3.6/site-packages (4.2.4)
But I still get the same error upon executing my script in IntelliJ:
File "/Users/blabla/katalog-scanner/KatalogScanner.py", line 149, in <module>
soup = BeautifulSoup(html, 'lxml')
File "/anaconda3/envs/katalog-scanner/lib/python3.6/site-packages/bs4/__init__.py", line 198, in __init__
% ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
I also tried switching to html5lib in my code, resulting in the same error, saying that html5lib was requested and not found. What else can I try?
I had multiple installations of Python on my machine, provided by
homebrew
Anaconda
easy_install
package managers. I deleted the anaconda instance completely (was directly under my macintosh-hd), removed easy_install and brew uninstall python --force to remove all the instances of python (2.7, 3.6, 3.7) I had in usr/local/bin
then I installed only with homebrew: brew install python3
then you need to link python and pip commands to python3/pip3 by opening
~/.bash_profile
putting this there and saving:
alias python='python3'
alias pip='pip3'
then refresh the terminal (maybe you need to restart it completely or even the OS):
source ~/.bashrc
then python --version should show the newest 3.x version an you should be able to do: (second command starts python interpreter, fourth ends it)
pip install beautifulsoup4
python
import bs4
exit()
Now you have to go to IntelliJ > File > Project Structure and add Python 3.x SDK to Plattform Settings (SDK) and set Project Settings > Project SDK to that SDK
Before I also had an IntelliJ .iml-file, but the project seems to work fine without

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

Categories

Resources