Module Not Found

Syntax really comes into play here. Maybe twice over.

You literally installed it somewhere on your machine the line before. (Note the general .system() in the equivalent.) That may not be where Jupyter needs it. Fortunately there is a better way.

In 2019, the Jupyter project added the magic variations of the install commands that insure the install takes place in the environment where the kernel is running that is backing the active notebook. See more about the magic version of the install commands here.

In your case you’d use:

%pip install pandas

Use of the magic install commands is to the best of my knowledge universal now in modern Jupyter because it works in JupyterLite and recently even in Google Colab. You’ll have the best experience going forward in Jupyter if you adopt it ASAP, even if it doesn’t solve every install issue you come across.

It is always best to restart the kernel after the install as you’ll be advised in the process. See more about this below.

The exclamation point doesn’t necessarily insure the installation occurs in the proper place, and that is why the magic versions were added. An example of it not installing to the proper place on your machine is what I think is causing what you are seeing. The second paragraph here goes into more details about why the exclamation point may lead to issues.

Plus you should install in a cell using the magic install command(s) and then restart the kernel to be sure the changes take effect and ONLY THEN execute the import statements after that. Usually it is easier to put the code to be run after install in another cell, separate from and below the install cell, to make this easier in a practical sense. To be 100% sure all the changes are propagated, sometimes in really complex installs you even need to refresh the page. In fact, for those I advise restarting Jupyter and your browser, too. Pandas shouldn’t need all that but it is a good habit to structure your ‘in notebook-installs’ that way. And restarting the kernel is always the first thing you do if after you try to import and it fails when you’ve used the magic install commands.

(You can even use the use of magic install commands as a gauge for how up-to-date a resource is. If they are still using an exclamation point with install commands, take everything that source says about Jupyter with caution.)


Also because usually automagics are on by default in most modern Jupyter, you can usually leave of the % symbol from in front of pip and conda and behind-the-scenes the proper equivalent of the magics commands will now get used. However, explicit is always best. For example, since you apparently didn’t know about the magic versions of the install commands, if you came across an install command without a symbol, you may add erroneously an exclamation point thinking you are fixing it. Explicitly using the magic % symbol will remind you and alert others better.