Forums

Installed a new module in virtual env but notebook shows module not found error

Hi ,

I am new to pythonanywhere so sorry if this has been asked before.Not able to google on the solution so asking here.

I have followed the below two guides to create a virtual env then enabled it to use in my notebook. https://help.pythonanywhere.com/pages/IPythonNotebookVirtualenvs/ https://help.pythonanywhere.com/pages/Virtualenvs/

Steps taken as follow ,

mkvirtualenv dev --python=/usr/bin/python3.10

workon dev

pip install missingno

ipython kernel install --name "dev" --user

And then went back to my notebook and refreshed the page. Then changed the kernel to dev but the notebook shows ModuleNotFoundError: No module named 'misingno'

Any idea ? I tried importing it in python console in dev virtual env , no errors.

Thanks in advanced Billy

Ok resolved it. Here is how for those who are having the same issue...

Its how Jupyter looks for the packages ...

and without going into the details , we are here to code , not to solve these kinds of issues , here is the how ,

Change the Kernel to the virtual env kernel , or just restart the kernel and change or change and restart .. then

%pip install missingno

%pip install imbalanced-learn

and now import missingno and import import imblearn works like magic :)

https://stackoverflow.com/questions/38368318/installing-a-pip-package-from-within-a-jupyter-notebook-not-working