ShrRa / python-intermediate-development

Intermediate Python for Astronomical Software Development
https://shrra.github.io/python-intermediate-development/
Other
3 stars 4 forks source link

conda base environment #8

Open mpgh opened 3 days ago

mpgh commented 3 days ago

For conda users jupyterlab might persistently return to the base environment, i.e. setting the kernel of the environment might be a good idea, see e.g. https://stackoverflow.com/questions/37891550/jupyter-notebook-running-kernel-in-different-env

RileyWClarke commented 3 days ago

Maybe we can add a text box, something like:

Setting the kernel of the environment

If you have multiple python kernels active, some care must be taken in ensuring that the kernel we set up will be recognized by jupyter. We can configure what kernel we want jupyter lab to use on launch by running the following commands in terminal:

$ pip install ipykernel

{: .language-bash}

$ python -m ipykernel install --user --name venv --display-name "Python (whatever you want to call it)"

{: .language-bash} This will will reset the default python to the one in the virtualenv, although you will need to restart the kernel and try running the notebook again. More details on this issue can be found here: https://stackoverflow.com/questions/37891550/jupyter-notebook-running-kernel-in-different-env {: .callout}

ShrRa commented 3 days ago

Looks like a useful thing to add into a callout. However, we need to test on several PCs to make sure it doesn't break something else. I'm also curious what caused the issue in the first place. I roughly remember encountering something similar, but I definitely solved it in a different way.