Is downgrading Python version the right answer?

Hello, I wanted to do some basic stats analyses and data manipulation in Python before loading it into JS code. But it’s been a while since I used Python for data analysis and I am having trouble setting up the Jupyter notebook.

These are the steps I took so far:
1 - Installed Python3.8.1 (this was done a long time ago).
2 - Installed Jupyter Notebook using the cmd: pip3 install jupyter
3 - Tried to launch JN with cmd: jupyter notebook
4 - Got the following error msg: https://github.com/jupyter/notebook/issues/5094
5 - I had no idea how to follow their instructions (although I tried) so then I went to this page which suggested that the problem is with Python3.8 and I can fix the problem by downgrading my Python version.
6 - So I followed the instructions here: https://stackoverflow.com/questions/52584907/how-to-downgrade-python-from-3-7-to-3-6
7 - I didn’t want to create a virtual env or install sudo or anything so I followed these instructions that also happened to have the least number of upvotes (eek): A clean way without having to uninstall a previous version or reverting to additional software…
8 - I’ve already installed Python3.7.6.
9 - I created the new dir, as per instructions:

Annotation 2020-01-16 192527

This is where I am lost. Now I want to point my computer to only use Python3.7.6 version. But it’s not clear to me what I should do next…??

You can use a version management tool, i know pyenv is pretty popular (~18K stars), but it requires shell.

Since I don’t really use python that often I simply aliased python in my bash_profile. But this means I manage which version my computer uses.
I run bash, so the command for your Windows Terminal will be different, but in a nutshell that’s what I did:

$ python --version
python 2.7 // default installed on Mac

[Installed python 3.7]

$ which python3.7
/usr/local/bin/python3  // my path

Alias python in my ~/.bash_profile so that when i run the command python in my terminal it will use python3.7 and not python2.7
To do so I have to write into bash profile with either an editor or with echo command

[in my ~/.bash_profile file]
alias python="/usr/local/bin/python3"

So next time I went into my terminal and run

$ python --version
Python 3.7.1

Hope this will help :+1:
Always relevant XKCD
xkcd

2 Likes

Haha - thanks @Marmiz. That XKCD cartoon is exactly how I feel right now.

My solution to this problem - after I stopped over-complicating everything - was to simply uninstall Python38 and keep Python37. Not sure why I thought I needed both.

So in case anyone is else wants to know all my steps:
1 - Uninstalled Python38 using Add Or Remove Programs.
2 - I thought previous installation of Jupyter was global but I could not launch it.
3 - So re-installed it via: pip3 install jupyter
4 - Then I was able to launch Jupyter Notebook via jupyter notebook cmd.

One last question:
When I used to use Jupyter Notebook before, launching it would automatically open up the localhost:8888 page but this time I got the following message:

  To access the notebook, open this file in a browser:
        file:///C:/Users/sabahat%20iqbal/AppData/Roaming/jupyter/runtime/nbserver-14316-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=b1e1f814d8286f77a25cc6e8db9582b13e2d7b5853f3c235
     or http://127.0.0.1:8888/?token=b1e1f814d8286f77a25cc6e8db9582b13e2d7b5853f3c235

Of course, I can simply copy/paste the URL into browser and it’s fine. But wondering whether this is just something new since the last time I used JN or whether I can change a setting to get it to automatically launch in browser?

Thank you!