2

TL,DR: How can I make my machine/anaconda forget that python 3.7 exists so that I can run everything on python 3.6?

I've put the full story in a list format to make this easier to read.

1) I have a working BagOfWords in Python 2.7. It was running just fine with Jupyter Notebooks.

2) I wanted to use a python library called Newspaper, but it works best in python 3 instead of python 2.

3) I download python 3.7 so Newspaper can run.

4) Newspaper works great with Python 3.7, but another module, tensorflow, which is necessary for the BagofWords to run, is not yet updated to work with Python 3.7

5) I download Python 3.6, which works with tensorflow.

6) I delete Python 3.7 off my machine.

7) I try to reopen my work now using python 3.6 so tensorflow can work. Jupyter Notebook opens, but prompts me to select which kernel to use. I select Python 3, but I recieve this error message: Error Starting Kernel FileNotFoundError: [Errno 2] No such file or directory: '/Library/Frameworks/Python.framework/Versions/3.7/bin/python3':

8) I know that it is trying to find things though a path that no longer exists (the python 3.7 path). I delete and reinstall anaconda in the hopes that it will forget this old path (and python 3.7) so that I can work with Python 3.6. It does not work.

question: How can I make my machine/anaconda forget that python 3.7 exists so that I can run everything on python 3.6? This is my first time working with jupyter notebooks, so I have searched for answers but many of them did not make sense to me. I am working on a 2015 Macbook Pro that is running MacOs Mojave 10.14.1

Update: even trying new environments with conda didn't work. I eventually gave up and moved all my code to google colab, which I'm not a huge fan of, but at least it actually works....

Charlie M
  • 77
  • 8
  • I think the best solution long term would be for you to use conda environments for everything, because you can set up a different environment for each project each with its own versions of the necessary libraries, Python, and so on. If you started from scratch like this then Jupyter should work fine (just remember to install it in each environment, and activate the environment before starting Jupyter). However, for your immediate problem, it sounds as if you need to fix the config of your existing Jupyter install. What is the output of `jupyter kernelspec list`? – nekomatic Jan 23 '19 at 13:05
  • @nekomatic thanks for your help! The output it gives me is Available kernels: python3 /Users/MyName/Library/Jupyter/kernels/python3 – Charlie M Jan 23 '19 at 17:10
  • I edited the argv in the kernel.json to be "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3", instead of Versions/3.7/. Now Jupyter will open for me, but when I try to run my program, nothing happens-- if I run a segment that just says print("hello world") nothing will happen. – Charlie M Jan 23 '19 at 17:30
  • I'm not a Jupyter expert so the only thing I can think to suggest is uninstall Jupyter (making sure you clear out all its config files, path entries etc - probably check the documentation for this) and reinstall it. You may need to check the docs for how to correctly set it up for multiple Python versions - or use conda as previously suggested. – nekomatic Jan 24 '19 at 09:14

1 Answers1

1

I would suggest that you just a create a new environment with the specific python version you want (3.6 in your case if you want to use tensorflow)

conda create -n yourenvname python=3.6 anaconda

After creating the environment, activate it:

source activate yourenvname (if on Windows, then: conda activate yourenvname)

Now that you have a balnk new environment you can start installing only the needed packages - tensorflow to begin with using pip.

Any other package you need in this specific environment you can install also using pip or conda install as long as the environment is activated.

Keep in mind though that you need to deactivate the environment if you want to use other versions or other packages for other projects.

Hope this helps.

melowgs
  • 420
  • 1
  • 4
  • 13