Iâm the author of the blog post, Iâll try to help you.
I just retested the install and the import and both worked.
âModuleNotFoundErrorâ are usually errors when you are not executing the code in the same environment as where you installed the library.
Can you see langchain_huggingface in your !pip3 list ?
A second option is that you had a conflict in the installation of the library that you did not see ( the requirements of the libs include the latest version of tokenizers which might enter in conflict with other libs )
I tried installing both inside and outside the venv, here is the list for both:
mneely@llmmaximus:/usr/projects/langface$ !pip3 list
pip3 install langchain-huggingface list
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: langchain-huggingface in /usr/local/lib/python3.10/dist-packages (0.0.3)
ERROR: Could not find a version that satisfies the requirement list (from versions: none)
ERROR: No matching distribution found for list
(.venv) mneely@llmmaximus:/usr/projects/langface$ !pip3 list
pip3 install langchain-huggingface list list list
Collecting langchain-huggingface
Using cached langchain_huggingface-0.0.3-py3-none-any.whl (17 kB)
ERROR: Could not find a version that satisfies the requirement list (from versions: none)
ERROR: No matching distribution found for list
(.venv) mneely@llmmaximus:/usr/projects/langface$
You have pip3 install langchain-huggingface list list list
Outside of the error from typo, I can see that:
outside the env, the latest version ( 0.0.3 ) is installed
And inside itâs being reinstalled from cache because you most likely uninstalled before :
So, can you now give me the output of pip list ?
Or alternatively do the following :
enter python
test the import
joffreythomas@MBP-de-joffrey % python
Python 3.11.6 (main, Oct 2 2023, 13:45:54) [Clang 15.0.0 (clang-1500.0.40.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from langchain_huggingface import HuggingFacePipeline
>>>
Iâm just typing â!pip3 listâ and that command is out putting âlistâ multiple times. Maybe because I have attempted ~3 installs in my troubleshooting? I have never used that list command before so not sure.
(.venv) mneely@llmmaximus:/usr/projects/langface$ python3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type âhelpâ, âcopyrightâ, âcreditsâ or âlicenseâ for more information.
from langchain_huggingface import HuggingFacePipeline
Traceback (most recent call last):
File ââ, line 1, in
ModuleNotFoundError: No module named âlangchain_huggingfaceâ
No, if I try outside the venv, I get what you have:
from langchain_huggingface import HuggingFacePipeline
So I actually tried running my script again outside the venv, which I thought I had before. It executes and finds the package. (I get another error).
What am I missing from being able to run this in a venv?
Was having the same issue and scratched my head for a while, solution was pretty simple. The solution is to install jupyter from within the activated venv. So,
activate environment
at any time) install all your required library like langchain_huggingface
Very nice. I ended up not using a venv at all for now. I have gotten pretty far on my journey, and need to go back and reinstall all my packages within a venv. Getting my application to run as a service is near impossible without it being in venv, so thatâs my next major step. Not using juputer, so I will have to figure it out as I go.