pythonpipjupyter-notebookpydotplus

No module named 'pydotplus' in jupyter Notebook after installing it using pip


I am running a code in jupyter Notebook an i got this error for import pydotplus: ModuleNotFoundError: No module named 'pydotplus'

However after trying to install using this command: !pip install pydotplus --user I still have the same error, it is not resolved. Noting that I could not install pydotplus using the following command: !pip install pydotplus

I also tried import sys !{sys.executable} -m pip install <package_name> after reading that it must be installed globally this way, but I got an error saying: 'C:\Program' is not recognized as an internal or external command, operable program or batch file

I would appreciate any help. Thanks :)


Solution

  • Try inside a new cell in your notebook the following:

    %pip install pydotplus
    

    Restart the kernel and see if the import now works.

    The modern magics, %pip install and %conda install, are the way to install things to the environment backing the notebook being run, see here. Anything showing an exclamation point along with pip and conda is outdated. The magics were added because using pip and conda with an exclamation point caused people all sorts of problems in the past when they don't understand environments. With the modern magics this gets handled better without the user needing to know much about environments or how the ! in front of a shell command opens a separate temporary shell instance aside from the notebook.

    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. In other words, avoid the exclamation point in combination with pip or conda now.