I'm using Python on VS Code and I need to use the library python-Levenshtein
. I've already installed it with the pip3 install
command, but somehow this library won't appear in the drop down after typing import
(nor I am able to use it). If I check the pip list
it is listed. I selected the interpreter on Python 3.8.5 64-bit; I'm using Ubuntu 20.04 and have everything (VSC, system) up to date. I even rebooted hoping for the drop down to show the library. Still nothing. Any clues?
Asked
Active
Viewed 5,153 times
0

ramonvasquez
- 37
- 1
- 7
-
Do you have both python 2 and 3 install on your commuter? If you do then you'd likely have to use pip3 to install the package for your python3 interpreter. – benji Nov 17 '20 at 01:40
-
What happens when you try to import the library from the python3 shell? – sphennings Nov 17 '20 at 01:40
-
When importing from the shell, it gives me a syntax error because of the "-". – ramonvasquez Nov 17 '20 at 01:46
-
@benji I do have both versions on my machine. I have 2.7.18 and 3.8.5. I installed the library using pip3. – ramonvasquez Nov 17 '20 at 01:52
-
Oh it sound like an issue with the packages name (the name that you use to install it can be different then the one used to import it in python). The first thing I would try is to replace the "-" with a "_". If that doesn't work id look for examples on the author's github or the documentation page. – benji Nov 17 '20 at 01:58
-
@benji Yep, I tried python_Levenshtein, pythonLevenshtein, Levenshtein, but still can't figure what's going on. In the pip list appears as python-Levenshtein. – ramonvasquez Nov 17 '20 at 02:12
1 Answers
1
I uninstalled the library and then reinstalled it with sudo, and now it works perfectly. Thanks to this post: https://stackoverflow.com/a/57324830/11020145

ramonvasquez
- 37
- 1
- 7
-
1From your comment, I can assume that you were installing packages using pure (root) Ubuntu python. It is not the best practice. I suggest using a virtual environment. In this case, you can maintain dependencies in one place and change python's version if needed. More information can be found in https://docs.python-guide.org/dev/virtualenvs/ – Dmitry Grebenyuk Nov 17 '20 at 02:30