Harrylever
Harrylever

Reputation: 51

My Kali linux showing 'No module named importlib' 'from importlib import import_module'

Trying to install build dependencies with pip which is installing in /usr/local/lib/python2.7/dist-packages As I try to install proceed gives an error

Collecting git+https://github.com/kti/python-netfilterqueue (from -r requirements.txt (line 1))
  Cloning https://github.com/kti/python-netfilterqueue to /tmp/pip-req-build-VQbxfT
  Running command git clone -q https://github.com/kti/python-netfilterqueue /tmp/pip-req-build-VQbxfT
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python2 /usr/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpNlNAvr                            
       cwd: /tmp/pip-req-build-VQbxfT                                                                                                                                  
  Complete output (4 lines):                                                                                                                                           
  Traceback (most recent call last):                                                                                                                                   
    File "/usr/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 16, in <module>                                                                    
      from importlib import import_module                                                                                                                              
  ImportError: No module named importlib                                                                                                                               
  ----------------------------------------                                                                                                                             
ERROR: Command errored out with exit status 1: /usr/bin/python2 /usr/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpNlNAvr Check the logs for full command output.

so I try to install importlib with pip and I still get the same error. Then I install it directly to /usr/lib/python2.7/dist-packages/pip/_vendor/pep517/ using

pip install importlib --target=/usr/lib/python2.7/dist-packages/pip/_vendor/pep517/

because pip has been installing all packages to /usr/local/lib/python2.7/dist-packages, but I still get the error either way

Upvotes: 0

Views: 3418

Answers (2)

Mark Agugo
Mark Agugo

Reputation: 1

Try switching to python3 because this will definitely work.

First you have to install cython.

pip install cython

Then after that you need to make sure you install NetfilterQueue from source.

git clone https://github.com/oremanj/python-netfilterqueue

Navigate to the netfilterqueue directory.

cd python-netfilterqueue

Then run this command.

python3 setup.py install

That's it. It should work properly

Upvotes: 0

sudden_appearance
sudden_appearance

Reputation: 2195

Assuming you are trying to install python-netfilterqueue.

You can visit github page and see this

The current version of NetfilterQueue requires Python 3.6 or later.

So you can't install this lib for python 2.7

But you can install 0.9.0 as it also stated that

The last version with support for Python 2.7 was 0.9.0.

pip install NetfilterQueue=0.9.0

Upvotes: 2

Related Questions