As with some other posts, I am running into a problem that, while operating in a virtual environment, python 3.6.5 does not recognize a package that I installed using pip (ImportError: No module named Levenshtein
); e.g., here, here, and here. The package in question (python-Levenshtein 0.12.0
) shows up when I call pip freeze
and pip3 freeze
in both the normal and virtual environments.
Following some of the answers given on the aforementioned pages, it looks like my problem results from the fact that more than one pathway to the Levenshtein package exists inside of the virtual environment. For reference:
python3 -m venv ~/.virtualenvs/myvenv
source ~/.virtualenvs/myvenv/bin/activate
python3
import sys, site
sys.prefix
'/Users/<home directory>/.virtualenvs/myvenv'
print(site.getsitepackages())
['/Users/<home directory>/.virtualenvs/myvenv/lib/python3.6/site-packages', '/Library/Python/3.6/site-packages']
So, I guess my question is two-fold:
- Is having more than one result for
site.getsitepackages()
the (likely) cause of the package not getting recognized in the virtual environment? - If so, how do I remove the non-virtual environment path / reset the path for the virtual environment?
Thanks in advance for any help, really appreciated.