0

I've looked everywhere but can't find my situation. I deleted my previous installation and did a clean install of Anaconda3.
I think my environment may be out of sync.

In the terminal, I can do 'import sklearn' and its all good.
In Jupyter, I had to do a '!pip3 install sklearn' then do 'import sklearn'

Alternatively,
In the terminal, when I do 'pip3 install xgboost' it says 'Requirement already satisfied'
Then inside the terminal, I'll switch into python and do 'import xgboost' and it gives me a 'ModuleNotFoundError'.
In Jupyter, I'll do 'import xgboost' and pip needed at all.

FYI - Usually when you do a clean install, anaconda creates a DIR 'AnacondaProjects'. For this install, I renamed my existing DIR 'AnacondaProjects----' Expecting that Anaconda would re-create this folder again. This did not happen.

Below are some tests that I ran: Any thoughts are appreciated

There is my Jupyter config !jupyter --paths

config: /Users/namelyme/.jupyter /opt/anaconda3/etc/jupyter /usr/local/etc/jupyter /etc/jupyter data: /Users/namelyme/Library/Jupyter /opt/anaconda3/share/jupyter /usr/local/share/jupyter /usr/share/jupyter runtime: /Users/namelyme/Library/Jupyter/runtime

When I run these commands from Terminal and from Jupyter, I get the same answer:

which python —-/opt/anaconda3/bin/python
which jupyter — /opt/anaconda3/bin/jupyter

FROM TERMINAL: sys.executable

'/opt/anaconda3/bin/python'

FROM JUPYTER: sys.executable

'/Library/Frameworks/Python.framework/Versions/3.8/bin/python3'

When I do !pip3 install sklearn I get this error below. I've already done 'pip3 install wheel', and that works I also did done 'pip3 install Cython', and that works too.

  • what is your kernel? You can find the kernel on the top-right corner – Anwarvic Nov 24 '19 at 05:59
  • Python 3 I dont have any more virtual environments:\n (base) computer-mbp:~ me$ conda env list # conda environments: # base * /opt/anaconda3 – Ally Ansari Nov 25 '19 at 14:57
  • This Post Answered my question: I needed to update kernel.json https://stackoverflow.com/questions/34389029/cannot-import-modules-in-jupyter-notebook-wrong-sys-path – Ally Ansari Nov 26 '19 at 14:20

0 Answers0