0

Whenever I install package using pip on my computer, they are not available in my Jupyter Notebooks. From what I figured out, they are not in the same environment. When I run

import sys
sys.executable

on the Notebook, I get

/Library/Developer/CommandLineTools/usr/bin/python3

while on the terminal I get

/Library/Frameworks/Python.framework/Versions/3.7/bin/python3

What do I do to fix this? All answers I found online assume conda in installed, but I do not use conda. Ideally I would just change the default environment the Jupyter Notebook runs in but I can't figure out how...

EDIT

I tried adding the environment as suggested in another article by using the following code in terminal:

/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -m ipykernel install --prefix=/Library/Developer/CommandLineTools/usr/bin/python3 --name 'Py3’

But it returns

quote>

Which I don't really understand.

Vincent
  • 1,137
  • 18
  • 40
  • Related to this question: https://stackoverflow.com/questions/28831854/how-do-i-add-python3-kernel-to-jupyter-ipython – Baris Jun 12 '20 at 17:27

2 Answers2

0

You should change jupyter kernel via Kernel tab:

enter image description here

Use the explanation here if you want to add more kernels to jupyter: https://ipython.readthedocs.io/en/latest/install/kernel_install.html

Alireza Moradi
  • 308
  • 3
  • 10
  • Unfortunately I only have 1 option there which is Python 3 (but in the wrong env). Added feedback on how to add an env in the description cause it doesn't work. – Vincent Jun 13 '20 at 06:11
0

Solved it by uninstalling Python 3 and then using homebrew and pyenv to install a new version in a more controlled manner and make it the system default. After a reboot it then worked.

Vincent
  • 1,137
  • 18
  • 40