Fast ai library not found inside tmux session

I have installed library on my local Ubuntu Linux machine. I have made a virtual environment to do my course-v3.

The fastai library works fine on terminal. But on my tmux session I get error saying library not found

In my terminal when I run the below line of code to get the fastai library version, I get the following

(fastai) ai@ai-machine:~$ python -c “import fastai; print(fastai.version)”

But if I run it inside my TMUX session, I get the below error

python -c “import fastai; print(fastai.version)”
(fastai) ai@ai-machine:~$ python -c “import fastai; print(fastai.version)”
Traceback (most recent call last):
ModuleNotFoundError: No module named ‘fastai’

Does anyone know what the problem is ? My tmux script can be seen here

When using tmux, you need to deactivate your virtual environment prior to calling a new session, then activate your environment within the session itself. This is because tmux modifies the $PATH variable, rendering the path to your active environment nonfunctional.

1 Like

Thanks. This solved the issue.