Can't import libraries in jupyter notebook when in a poetry shell

19 views Asked by At

I am learning Python by doing a personal project. I have a poetry shell for my data folder structure. In that folder, I have a jupyter notebook which I use to test my codes. However, after I initiated the poetry shell and then ran poetry add bs4 successfully in the terminal, but then when I ran "import bs4" in a jupyter notebook, it said "ModuleNotFoundError: No module named 'bs4'". And not only just "bs4", but also other libraries like "pandas" or "matplotlib" failed to be imported too.

But when I ran "import bs4" in a normal .py file, it ran successfully. I think the problem might be something about the jupyter notebook and poetry shell. But I tried poetry add ipkernel or so but it still said the same Error. Do you know why?

0

There are 0 answers