1

I have been using python traditionally(in text editors) and now I am moving on to Jupyter. When I try to import libraries, I get errors. For importing numpy, I do

Import numpy

but I get error

No module named 'numpy'

but I have this library on my system So do I have to install numpy on Jupyter again?

  • I am not a jupyter user, but the [third part of this answer](https://stackoverflow.com/questions/39007571/running-jupyter-with-multiple-python-and-ipython-paths) could be helpful. If jupyter is using a different python installation than your previously used python, then it will also not share the packages – lucidbrot Apr 23 '22 at 21:41
  • As others have touched upon if your environment backing Jupyter doesn't match what is backing where you installed things in Python, you won't be able to import those modules. If you installed Jupyter using Anaconda it is possible to issue commands to link a kernel backing your notebook with a an environment. And sometimes it is just easier to put commands in your notebook such as `%pip install numpy` (`%conda install numpy`) to insure the installation gets installed to the environment backing the notebook. It doesn't hurt to re-run those if already installed. – Wayne Apr 24 '22 at 19:37
  • For installing from within a cell in your notebook, see about the modern magics added recently [here](https://discourse.jupyter.org/t/why-users-can-install-modules-from-pip-but-not-from-conda/10722/4?u=fomightez). Long story short is don't use an exclamation point anymore with `pip` or `conda` in your notebook. Anything showing that is outdated. – Wayne Apr 24 '22 at 19:38

1 Answers1

0

Please check have you installed the library in same python repo which your Jupiter is referring. Also please try to create virtual environments it is quite better to maintain for each project.