1
votes

Background: while running Jupyter Notebook a new import was failing even though the library was installing successfully using pip3. Some of the set up for the code I was running was done in PyCharm which was using a virtual Python 3.8.2 environment. The failing import library is in the virtual environment so why isn't Jupyter seeing it?

I went looking and found that there are multiple versions of Python installed:

  • /Library/Python/2.7
  • /Library/Frameworks/Python.framework/Versions/3.8
  • /usr/local/bin/python3
  • /usr/local/bin/python3.8
  • /usr/local/bin/jupyter (included this in case it clarifies things)
  • /usr/bin/python
  • /usr/bin/python3
  • /usr/local/Cellar/python/3.7.6_1
  • /Users/xxx/anaconda3/bin/python3.7 (anaconda was uninstalled months ago so why is this still here?)
  • /Users/xxx/git/moat-ds/venv/lib/python3.8

I have installed pyenv and virtualenv and tried (unsuccessfully) to sort things out through this and similar articles. But all of this has only left me with questions:

  • what are these different directories doing?
  • when launched what is Jupyter notebook using for 'python 3' kernel?
  • where are the python packages stored when I run pip3 at the CLI (in pycharm packages are put in the \venv folder but otherwise?)
2

2 Answers

1
votes

After trying @Akbar30bill's answer without success I did brew doctor and restarted my terminal and tried again and it worked. Wasn't linked correctly or something.

2
votes

installing jupyter with pip from pyenv fixed my problem

brew uninstall jupyter
pip install jupyter

and after restarting your console it should be pyenv's jupyter