My python related versions and paths are as follows
pip -V
output
pip 19.1.1 from /home/USER_NAME/.local/lib/python3.6/site-packages/pip (python 3.6)
which pip
output
/home/USER_NAME/.local/bin/pip
python -V
output
Python 3.6.7
which python
output
/home/USER_NAME/bin/python
The problem is I used several methods to update pip and everything messed up. So now I can use python modules even though they are installed using pip. Example
pip install requests
says
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.18.4)
but when I import requests in python code I get this
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 requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'requests
The reason is that pip links to .local
directory how to resolve this I tried uninstalling pip and reinstalling but didn't help. Help is appreciated