Search code examples
pythonanacondaversion

Different versions of Python installed in different kernels


Different kernels are used in my jupyter notebook as shown in below image:

enter image description here

As I need to install precompiled python library NumPy, I checked the Python version installed in my PC and I found below information:

enter image description here

It can be observed that 2 different versions of Python are available.

Questions that I have are:

  1. What is the difference between "Python 3.8.3 installed in (base) C:\>" and "Python 3.6.13 installed in (my36env) C:\>"?
  2. Can I have same version of Python in both (base) C:\> and (my36env) C:\>? If yes, please let me know how it can be done.
  3. Which version of NumPy should I install? and what procedure should I follow for installing it?

Request your help.


Solution

  • The multiple instances of Python are due to your having one (or more) conda virtual environments. In addition to your machine's base Python installation, you appear to also have Python installed in your conda environment called my36env. You can have the same version of Python in multiple environments, or, crucially, you can have different versions of Python, which is why environments were created as an idea in the first place.

    This is typical, as it is generally recommended to have Python installed in each environoment for reproducibility. For example, when you activate an environment (such as by calling conda activate my36env in your command line, all of the packages you need for your project, including the compatible version of Python will all be together, both for your own use and for others who you may want to share your code (and environment) with.

    For example, from conda's "Managing Python" documention:

    Conda treats Python the same as any other package, so it is easy to manage and update multiple installations.

    So in summary, there is no need to be concerned. As for installing numpy, if you are indeed using conda to manage your packages, and you are currently working in your my36env, then you can conda install numpy (or see here for other numpy install options) in this environment. Based on your post, I don't know of any reason(s) why you wouldn't want the most updated version of numpy.

    Read more about conda environments here.