0

In the process of trying to update python, I realized I don’t really understand how python is being executed on my computer (macbook, OS X 10.11, which is on the older side). I was hoping to clear up some basic confusion before I mess something up.

Around 2016 I installed anaconda. I actually tried to uninstall it in 2017 but must have been unsuccessful, as I have continued to use python (jupyter notebooks) seamlessly since then. When I run conda list, I see that I am running conda 4.1.11. It also lists numerous subpackages like anaconda-4.1.1-np111py35_0, anaconda-client-1.4.0-py35_0, anaconda-navigator-1.2.1-py35_0, heapdict-1.0.0-py35_1, ipykernel-4.3.1-py35_0, ipython-4.2.0-py35_1, jupyter-1.0.0-py35_3, jupyter_client-4.3.0-py35_0, jupyter_console-4.1.1-py35_0, jupyter_core-4.1.0-py35_0, python-3.5.2-0, spyder-2.3.9-py35_0, etc.

So that is all fine; however, I see that pip is another tool to handle and install python packages. I don’t recall installing pip, but version 8.1.2 is on my computer. When I run pip list, I see another list of subpackages. However, there is a massive overlap with the conda list packages. For example, anaconda-client (1.4.0), anaconda-navigator (1.2.1), HeapDict (1.0.0), idna (2.1), imagesize (0.7.1), ipykernel (4.3.1), ipython (4.2.0), jupyter (1.0.0), jupyter-client (4.3.0), jupyter-console (4.1.1), jupyter-core (4.1.0), spyder (2.3.9), etc.

So what does all this mean? When I run jupyter notebook, the commands [nb_anacondacloud] enabled; [nb_conda] enabled execute. When I run python sys.version, I see Python version 3.5.2 | Anaconda 4.1.1. So is everything running through conda? How does pip factor into this? If it helps, the command which -a pip gives //anaconda/bin/pip.

Getting to the ultimate goal, how should I go about updating python to 3.9 (and conda/pip/jupyter)? Should I do it through conda? When I run conda search python, the highest version it lists is 3.6.2. Is this due to my current version of conda? What about installing new packages (e.g., PyTorch) for use in jupyter notebooks? I see “pip install ___” is a very common way of installing packages, but I have also read that using pip and conda together can create problems.

Also, should I update python in a new environment? Something like

conda create -n test_env python=3.9.6
source activate test_env
conda install pip
jupyter notebook

Any advice or general information welcome.

Edit: So the tl;dr on this is,

  1. Why do conda list and pip list show almost the same set of packages on my computer?

  2. Why does conda search python only list python up to 3.6.2? Is it just because I haven't updated conda? Could it have something to do with my attempt to uninstall conda?

  3. What is the most robust way to upgrade conda/pip/jupyter/python to ensure I don't break anything? Is it fine to just do

conda update conda
conda update anaconda
conda update jupyter
conda update pip
conda install python=3.9.6

or should I make a new environment for the last line (or last 2/3 lines)?

cmm0052
  • 1
  • 1

0 Answers0