Selinium is installed but cannot be imported or used. ImportError: No module named 'selenium' - 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

Related

Failed to import cupy

After installing cupy via "pip install cupy-cuda110", I tried this in python3:
import cupy as cp
However, it failed:
"
$ python3
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import cupy as cp
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/cupy/init.py", line 18, in
from cupy import _core # NOQA
File "/usr/local/lib/python3.8/dist-packages/cupy/_core/init.py", line 1, in
from cupy._core import core # NOQA
ImportError: libnvrtc.so.11.0: cannot open shared object file: No such file or directory
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.8/dist-packages/cupy/init.py", line 20, in
raise ImportError(f'''
ImportError:
Failed to import CuPy.
If you installed CuPy via wheels (cupy-cudaXXX or cupy-rocm-X-X), make sure that the package matches with the version of CUDA or ROCm installed.
On Linux, you may need to set LD_LIBRARY_PATH environment variable depending on how you installed CUDA/ROCm.
On Windows, try setting CUDA_PATH environment variable.
Check the Installation Guide for details:
https://docs.cupy.dev/en/latest/install.html
Original error:
ImportError: libnvrtc.so.11.0: cannot open shared object file: No such file or directory
"
May you know how to resolve this problem? Many thanks!
Before installing cupy, you should check the version of Cuda that is installed on your device :
!nvcc --version
For me, the Cuda version installed on my device is 11.0 (See the picture below) :
After that go to the official Cupy website https://docs.cupy.dev/en/stable/install.html
The following image is from the page I referred to above:
Then type the install command that matches your Cuda version, for me, the install command will be :
pip install cupy-cuda110
When installing these packages with CUDA 11.2, 11.3, or 11.4, you may experience a “Failed to import CuPy” error. To resolve this error, please uninstall cupy-cuda115 and install cupy-cuda11x:
pip uninstall cupy-cuda115
pip install cupy-cuda11x
https://rapids.ai/pip.html

Cant run modules

everytime after downloading a module a cant run it, what im doing wrong?
I've installed it using:
pip install pyperclip
It has been installed succesfully:
C:\WINDOWS\system32>pip list
Package Version
--------------- ---------
certifi 2020.6.20
clipboard 0.0.4
colorama 0.4.3
cycler 0.10.0
handcalcs 0.8.1
kiwisolver 1.2.0
matplotlib 3.3.1
numpy 1.19.1
Pillow 7.2.0
pip 20.2.3
pyparsing 2.4.7
pyperclip 1.7.0
python-dateutil 2.8.1
qrcode 6.1
six 1.15.0
sqrc 0.0.3
But when running the code, this is what a get:
import pyperclip
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pyperclip
ModuleNotFoundError: No module named 'pyperclip'
Any help on this?
That can be specific for a programming platform you are using. Some platforms like PyCharm enable to install modules directly from themselves so using modules becomes much easier.

Install PyQt5 on Python 3.7 (Linux)

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)

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

Cannot import kombu from jython

I'm trying to port a python application to jython and have run into a problem where jython cannot import kombu (which is used prominently in the original python app).
I have installed kombu via pip (and even tried the -U option to get the most recent version):
sudo pip install -U kombu
Downloading/unpacking kombu
Downloading kombu-2.5.4.tar.gz (300Kb): 300Kb downloaded
Running setup.py egg_info for package kombu
Downloading/unpacking anyjson>=0.3.3 (from kombu)
Downloading anyjson-0.3.3.tar.gz
Running setup.py egg_info for package anyjson
Downloading/unpacking amqp>=1.0.5,<1.1.0 (from kombu)
Downloading amqp-1.0.6.tar.gz (69Kb): 69Kb downloaded
Running setup.py egg_info for package amqp
Installing collected packages: amqp, anyjson, kombu
Found existing installation: amqp 1.0.6
Uninstalling amqp:
Successfully uninstalled amqp
Running setup.py install for amqp
Found existing installation: anyjson 0.3.3
Uninstalling anyjson:
Successfully uninstalled anyjson
Running setup.py install for anyjson
Found existing installation: kombu 2.5.4
Uninstalling kombu:
Successfully uninstalled kombu
Running setup.py install for kombu
Successfully installed amqp anyjson kombu
Cleaning up...
I have jython version 2.5.3 installed and when I try to import kombu, I get an "ImportError: No module named kombu" error:
Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:48:36)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_26
Type "help", "copyright", "credits" or "license" for more information.
>>> import kombu
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named kombu
>>> from kombu.connection import BrokerConnection
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named kombu
Any help would be greatly appreciated!
Thanks,
Flint
With help from the folks on the Jython IRC, I finally got past this error. My problem was that I wasn't installing kombu within Jython. The process to accomplish that can be found at Importing python modules in jython.