Install PyQt5 on Python 3.7 (Linux) - pyqt5

I would like to install PyQt5 module on my Python3.7 version. I have read a lots of topics and forum to know how to do.
Basicly three ways exists, pip install, ap-get install or tar folder.
For me, the good way was apt-get install with this command :
sudo apt-get install python-pyqt5
python is my new version that I have updated on conf file to run on 3.7.
It say :
python-pyqt5 is already the newest version (5.7+dfsg-5)
But when I try to use it with :
python
Python 3.7.3 (default, Aug 2 2019, 09:14:49)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5'
>>>
However, when I run this command :
sudo apt-get install python3-pyqt5
python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
>>>
It's good with Python3.5.3 but no for the newest version, I have use the same command to install on different version. And I don't know why the module doesn't import if the install command said me that I have been installed the PyQt5(5.7.1 version)

Related

Building Tensorflow 2.0 from source

I've built Tensorflow 2.0 from source using the below commands:
-march=native -Wno-sign-compare -mssse3 -mcx16 -msse4.1 -msse4.2 -mpopcnt -mno-avx
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package --local_ram_resources=1024 --jobs=1 --define=tf_api_version=2
The build apparently completed successfully, that is without any errors, but when I go to install, using the below command:
python /tensorflow/tools/pip_package/setup.py install
It installs the egg in site-packages and checks for dependencies, but does nothing else. Nor does it return any error. The end of the output is below:
Searching for Markdown==3.1.1
Best match: Markdown 3.1.1
Adding Markdown 3.1.1 to easy-install.pth file
Installing markdown_py script to /var/...
Using /var/.../python3.6/site-packages
Searching for h5py==2.9.0
Best match: h5py 2.9.0
Adding h5py 2.9.0 to easy-install.pth file
Using /var/.../python3.6/site-packages
Finished processing dependencies for tensorflow==2.0.0rc0
and of course when I run python:
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
What am I missing here?
I could not comment at the moment. Can you verify the installation is done successfully ? That is after running:
python /tensorflow/tools/pip_package/setup.py install
you can check the folder tensorflow package in Python lib folders.

ModuleNotFoundError: No module named 'tensorflow' after installing on Mac OS

I have followed the installation instruction on https://www.tensorflow.org/install/install_mac
for Tensorflow virtualenv (as recommended).
pip3 install --upgrade virtualenv
virtualenv --system-site-packages -p python3
The installation was painless without error messages.
I activate tensorflow and move to a different directory to avoid confusion with tensorflow directory name when importing tensorflow to Python. The result is:
source ~/tensorflow/bin/activate
(tensorflow) Pers-MacBook-Pro:Documents per$ python3
Python 3.6.3 (default, Oct 4 2017, 06:09:15)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
What is wrong? I'm on MacOS Sierra. I ran the diagnostics script tf_env_collect.sh to provide some more info about the environment:
== check pips ===================================================
numpy (1.13.3)
protobuf (3.4.0)
tensorflow (1.3.0)
tensorflow-tensorboard (0.1.8)
== check for virtualenv =========================================
True
== tensorflow import ============================================
tf.VERSION = 1.3.0
tf.GIT_VERSION = v1.3.0-rc2-20-g0787eee
tf.COMPILER_VERSION = v1.3.0-rc2-20-g0787eee
Sanity check: array([1], dtype=int32)
== env ==========================================================
LD_LIBRARY_PATH is unset
DYLD_LIBRARY_PATH is unset
== nvidia-smi ===================================================
./tf_env_collect.sh: line 105: nvidia-smi: command not found
== cuda libs ===================================================
I found the reason: TensorFlow requires the Python package six, and the version included in Apple's default Python installation is too old.
Solution: Upgrade the Python installation with the current version of six:
$ sudo easy_install -U six

Selinium is installed but cannot be imported or used. ImportError: No module named 'selenium'

I have installed Selenium.When i try to run the tests it complains of ImportError: No module named 'selenium'.
The OS is Ubuntu 14.04 LTS and python version 3.4 (via virtualenv).
Installation of selenium:
(p_live) user#ubuntu14.04 LTS:~/sites/site.com/source$ sudo pip3 install selenium
[sudo] password for karthi:
Downloading/unpacking selenium
Downloading selenium-2.53.6-py2.py3-none-any.whl (884kB): 884kB downloaded
Installing collected packages: selenium
Successfully installed selenium
Cleaning up...
Selenium is installed as seen from whereis:
(p_live) user#ubuntu14.04 LTS:~/sites/site.com/source$ whereis selenium
selenium: /usr/local/selenium
For some strange reason find doesnot spot selenium
(p_live) user#ubuntu14.04 LTS:~/sites/site.com/source$ find selenium
find: `selenium': No such file or directory
Alternatively tried importing it.
(p_live) user#ubuntu14.04 LTS:~/sites/site.com/source$ python
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import selenium
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'selenium'
>>>
When it is installed what is the reason i am not able to import?
Don't use sudo to install selenium into your virtual environment:
(p_live) $ pip3 install selenium

Error importing pygtk with Anaconda

OS: Ubuntu 15.10
I had no problem importing pygtk with default Python interpreter. However I wasn't able to do so using the Anaconda interpreter.
Python 2.7.11 |Anaconda 2.5.0 (64-bit)| (default, Dec 6 2015, 18:08:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import pygtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pygtk
I also couldn't get it to work after installing the pygtk with conda.
/opt/anaconda2/pkgs$ conda info --env
Using Anaconda Cloud api site https://api.anaconda.org
# conda environments:
#
root * /opt/anaconda2
/opt/anaconda2/pkgs$ conda list -n root|grep pygtk
pygtk 2.16.0 1 ska
As you can see from the output that pygtk pkg is available under the root env.
Any ideas what I have missed or done incorrectly?
I've haven't had success with ska/pygtk, but mw/pygtk2 worked for me:
conda install -c https://conda.anaconda.org/mw pygtk2
Other details here

Install numpy on python3.3 - Install pip for python3

For python 3.2 I used sudo apt-get install python3.2-numpy.It worked.
What to do for python3.3? Nothing I could think of works. Same goes for scipy, etc.
Thanks.
Edit: this is how it looks like
radu#sunlit-inspired:~$ python3
Python 3.3.2 (default, Jul 3 2013, 10:17:40)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
In the solution below I used python3.4 as binary, but it's safe to use with any version or binary of python. it works fine on windows too (except the downloading pip with wget obviously but just save the file locally and run it with python).
This is great if you have multiple versions of python installed, so you can manage external libraries per python version.
So first, I'd recommend get-pip.py, it's great to install pip:
wget https://bootstrap.pypa.io/get-pip.py
Then you need to install pip for your version of python, I have python3.4 so for me this is the command:
python3.4 get-pip.py
Now pip is installed for this version and in order to get libraries for python3.4 I have to use pip like this:
python3.4 -m pip
So if I want to install numpy I'd use :
python3.4 -m pip install numpy
Note that numpy is quite the heavy library. I thought my system was hanging and failing.
But using the verbose option, you can see that the system is fine :
python3.4 -m pip install numpy -v
This may tell you that you lack python.h but you can easily get it :
On RHEL (Red hat, CentOS, Fedora) it would be something like this:
yum install python34-devel
On debian-like (Debian, Ubuntu, Kali, ...) :
apt-get install python34-dev
Then rerun this :
python3.4 -m pip install numpy -v
From the terminal run:
sudo apt-get install python3-numpy
This package contains Numpy for Python 3.
For scipy:
sudo apt-get install python3-scipy
For for plotting graphs use pylab:
sudo apt-get install python3-matplotlib
The normal way to install Python libraries is with pip. Your way of installing it for Python 3.2 works because it's the system Python, and that's the way to install things for system-provided Pythons on Debian-based systems.
If your Python 3.3 is system-provided, you should probably use a similar command. Otherwise you should probably use pip.
I took my Python 3.3 installation, created a virtualenv and run pip install in it, and that seems to have worked as expected:
$ virtualenv-3.3 testenv
$ cd testenv
$ bin/pip install numpy
blablabl
$ bin/python3
Python 3.3.2 (default, Jun 17 2013, 17:49:21)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>>
I'm on Ubuntu 15.04. This seemed to work:
$ sudo pip3 install numpy
On RHEL this worked:
$ sudo python3 -m pip install numpy
My issue was the failure to import numpy into my python files. I was receiving the "ModuleNotFoundError: No module named 'numpy'". I ran into the same issue and I was not referencing python3 on the installation of numpy. I inputted the following into my terminal for OSX and my problems were solved:
python3 -m pip install numpy
On fedora/rhel/centos you need to
sudo yum install -y python3-devel
before
mkvirtualenv -p /usr/bin/python3.3 test-3.3
pip install numpy
otherwise you'll get
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.