Jupyter Notebook doesn’t recognise Anaconda installation

Question:

For some reason Jupyter won’t recognise the Anaconda installation

import os
result = os.popen('conda list anaconda$').read()
print('nAnaconda Version:n', result)

Result:

Anaconda Version:
packages in environment at C:UsersAndyanaconda3:

Name Version Build Channel

I’ve updated the Windows Path variables as follows

C:UsersAndyanaconda3;
C:UsersAndyanaconda3Scripts

The conda.exe application is in the Scripts directory

Thanks in advance for any help

Asked By: AndyDudley

||

Answers:

Using Jupyter, run in a cell in your notebook the following:

%%capture out
%conda list anaconda$

(That sends the result of the %conda list to out, which is of the type IPython.utils.capture.CapturedIO. You can read about accessing the various attributes of that here in the IPython.utils.capture.CapturedIO documentation. I cover here how I handle it and parse out the version information I think you want next.)

Then in the next cell, you can parse collected the information:

out.stdout.split("Channel")[1].split("anaconda",1)[1].split()[0]

Based on what you posted in a comment above, you should see:

2023.07

I actually see 2022.05 when I run it.


Your original posted attempt os.popen('conda list anaconda$').read() is sending your command to a temporary system shell via os, and so that may not be in the exact environment where you notebook kernel is running. %conda list uses the magic command to insure things run in the same environment where your kernel backing Jupyter runs.

Answered By: Wayne