-1

I have tried

pip install mlrose
pip3 install mlrose
sudo pip install mlrose

they all show the Requirement already satisfied, but when I come to Jupyterlab to implement import mlrose, it raises an error

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-7-e28c59840eed> in <module>

----> 1 import mlrose

ModuleNotFoundError: No module named 'mlrose'
desertnaut
  • 57,590
  • 26
  • 140
  • 166
Drick
  • 47
  • 3
  • Go ahead and try what @ancode suggests, but I would suggest using `%pip` in the notebook and not the exclamation point in front of pip. And in case you run into what I just saw when using `%pip install mlrose`, and that is that `import mlrose` elicited `ImportError: cannot import name 'six' from 'sklearn.externals'`. [This workaround here](https://stackoverflow.com/a/62354885/8508004) worked for me. You may not need it but I did. – Wayne Apr 16 '22 at 20:26

1 Answers1

0

Install your packages direct from Jupyter notebook, then you can be sure that the packages are being installed into the local python instance.

! pip install --user <package>

The ! tells the notebook to execute the cell as a shell command. Then try:

conda update --all
debugger
  • 1,442
  • 1
  • 9
  • 14
  • Please encourage using the `%pip install`, and related `%conda install`, magic command when installing from within the notebook cells. The exclamation point use has caused problems and so the magic commands were added to help with insuring the environment the notbeook is using is where the commands act. Avoid the exclamation point with pip and conda now. See [here](https://discourse.jupyter.org/t/why-users-can-install-modules-from-pip-but-not-from-conda/10722/4?u=fomightez) for more about the modern magic commands being best practice when installing from cells in the notebook. – Wayne Apr 16 '22 at 20:14
  • Also because of the automagics that are usually on by default, the magic commands for pip or conda will often get used behind-the-scenes if a symbol is left off, and so avoid the exclamation point now for pip and conda. – Wayne Apr 16 '22 at 20:16