Python MK007  

ImportError: No module named ‘google’ in Kali Linux

How to fix ‘Import Error: No module named ‘Package Name’ in Kali Linux.

Hi Geeks,

In this post, am going to show you how to solve the ImportError. The steps followed in this post is same to all other debian Linux distributions.

Why ImportError was occurred ?

The ImportError is raised when an import statement has trouble successfully importing the specified module. Typically, such a problem is due to an invalid or incorrect path, which will raise a ModuleNotFoundError or ImportError in Python 3.6 and newer versions.

Traceback (most recent call last):
  File "mountain.py", line 28, in ?
    from toolkit.interface import interface
ImportError: No module named toolkit.interface

Solution for ImportError:

In your system you want to install the missed python packages manually. There are two methods are available for downloading the missed packages.

Method 1:

PIP:

pip is a package-management system written in Python used to install and manage software packages. It connects to an online repository of public and paid-for private packages, called the Python Package Index.

For me google packages are missing. So the following error message was printed.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'google'

Open a terminal and run the following pip command, (In this command replace google to ‘missed package’)

mk007@linuxlia:~$ sudo pip install google

But sometimes this command also encountered by the same error. Then follow the second method.

Method 2:

In this method, am going to download the google module in there official site and setup it to the python packages.

For me google packages are missing.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'google'

  • After downloading the zip package, first of all extract it.
  • Open the terminal and switch the directory to where the extracted module was located.
  • Now run the following command for adding the package to python.
mk007@Linuxlia:~/Downloads/Google $ python setup.py install

Finally inner peace.

For some unlucky persons, both methods may not work. Then see this post,

Solution for Import Error

 

Conclusion:

If you have any doubts about this post please leave a comment otherwise ping me in Instagram. Am ready to solve your doubts.

 

Some other Python Bugs:

pip: command not found error in Kali Linux

Install Python 3 in Linux

Install Python 2.7 in Linux

Leave A Comment