HuggingFace Error

Hey guys, I’ve been having an error with my HuggingFace app. The error is ‘ModuleNotFoundError: No module named ‘fastai’’. I’m not sure if it’s because I have my files in the wrong folders or something else. I’ve followed along with the video like Jeremy and still can’t seem to find the problem. Any help would be appreciated, I’ve been stuck for a few hours now :sweat_smile:


2 Likes

I think it is an environment setup issue.

Creating a python venv or a conda env and installing fastai should solve this issue.

Oh, the other thing is, if you have installed and configured your environment you probably have not selected the right Python interpreter… In VSCode ctrl + sht + p > Python: select interpreter and choose the interpreter from your venv.

If you are on windows and have Docker installed you could have a look at my post. The DevContainer would setup your environment ready to go.

2 Likes

Hi @Obi_Sama,
How did you go?
Did either of these options get you up and going?

1 Like

@Obi_Sama You need to push a requirements.txt file as well

# requirements.txt
fastai
1 Like

Hey @CraigRichards,

Thanks for reaching back out. I had to take a break that day because I put a lot of hours into it. But I believe that your first recommendation worked because the error dissapeared when I ran it in my own local Jupyter notebook. However I was faced with a new error stating that I didn’t have access to the fastsetup repository. :upside_down_face: I think that I solved this issue much earlier when I first started this web app, but I honestly forgot what I did. I also deleted my work and started over a few times because my files got jumbled up. I’ve decided to move on to the next chapter and come back to this section so that I don’t lose momentum. I’ll possibly try your Docker recommendation later, I just want to keep on going for now.
Error
Thanks for the help though :+1:

1 Like

I know how you feel. Sometimes you have to choose which battles to fight.

Hey @Obi_Sama

But I believe that your first recommendation worked because the error disappeared.

I had same module not found error. I resolved it the way @deven367 pointed out.
The reason you are not getting error in your local machine is that it is picking up the fastai already installed. But on space env it is not there.
So you could create a file requirements.txt and add one line fastai. Then we can git add file, commit and push. I believe it builds smoothly after that.

You could have a look at the files in my repo: jithesh82/minima at main

However I was faced with a new error stating that I didn’t have access to the fastsetup repository.

You are in the wrong folder (repo), I see. It is the fastai repo: “fastai/fastsetup.git” . You can’t push there because of permission.
If you are doing chapter 02 minima deployment example, it would be like your_username/reponame.git or so. For me it was spaces/jithesh82/minima. Please let me know.