ImportError: No module named 'paramiko'

jeff_h picture jeff_h · Jan 27, 2015 · Viewed 59.1k times · Source

I have done through the other questions online here, and I feel that mine is different enough to warrant a new question.

So I have a Centos 6 box, which is running a small website for me, acts as an office git server and I am trying to configure Python3 on it.

So I followed the following these steps to set up python3 on the server. However it seems that I cannot import paramiko into my script.

I downloaded the paramiko rpm however I get this message:

When I try to import paramiko I get:

[root@GIT Python-3.4.2]# rpm -ivh /usr/lib/Python-3.4.2/Modules/python-paramiko-1.7.5-2.1.el6.noarch.rpm
Preparing...                ########################################### [100%]
package python-paramiko-1.7.5-2.1.el6.noarch is already installed

When I run python3 directly:

[root@GIT inserv_health_check]# python3
Python 3.4.2 (default, Jan 21 2015, 06:28:04)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'paramiko'
>>>

I am sure there is a simple solution to this problem perhaps the path is wrong, or I should have put a symbolic link in somewhere. Any help would be appreciated :)

Before anyone asks, which python output:

[root@GIT Python-3.4.2]# which python
/usr/bin/python
[root@GIT Python-3.4.2]# which pytho~n3
/usr/bin/which: no pytho~n3 in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@GIT Python-3.4.2]# which python3
/usr/local/bin/python3

Thanks

Answer

Kostas Livieratos picture Kostas Livieratos · Jan 27, 2015

You need to do pip install paramiko so that python sees that module. If you work on a virtual environment, you need to workon <env_name> first and then pip install the desired module.