How to use custom venv in ARE's JupyterLab

Success! I think? I get my environment, but not the other analysis3 options. Not sure why or if that’s a problem.

Maybe related: jupyter terminal now hows my prompt instead of Singularity >.

Now to re-introduce my bashrc options to see what broke it.

Thanks!

BTW, the default .bashrc is in /etc/skel, along with all the other default files.

Interesting, getting closer! I vaguely recall having this issue once too. I think the solution is to leave this blank:

I register my environments (python -m ipykernel install ...) & leave the venv blank. Typically that works just fine - nb conda kernels should pick it up.

If that doesn’t work, maybe try again via pixi. That’s what I do & it generally works just fine without specifying a virtual env. I think using venv somehow overwrites the registered conda kernels. I assume you passed the path in as an option to the ARE session like so?

I was just registering the environment and leaving that field blank.

Ok, now I’m losing my mind again. I added a few of my aliases to .bashrc; things that should not make any difference. jupyter broke. So I nuked everything again, and now it’s not working even with default .bashrc, .bash_profile and empty .local.

Well, this is getting more ridiculous by the minute.

I created an ARE profile that only lists the virtual environment and doesn’t use conda/analysis3 as module. When I run that profile after nuking my .local, this ARE session runs jupyter from /apps/jupyterlab/3.4.3-py3.9/bin/jupyter. The prompt in the terminal is normal (not “singularity”) and it sees only the virtual environment and ipykernel. However, when I try to run any code in a notebook using the virtual environment, the notebook can’t connect to the kernel. If I run python on the terminal, loading xarray fails with error No module named 'numpy.core._multiarray_umath'.

I then created an ARE profile that only uses conda/analysis3. That session did exactly the same! used the same jupyter, even.

I then started my previous profile, which uses IDENTICAL configuration to the only conda environment from before. This time, this ARE session used jupyter from analysis3, the prompt said “singularity”, it showed all the analysis3 environments but not my virtual environment.

These are two sessions with the same configuration. One launched via saved settings and the other one launched via Interactive Apps.

This is the config from the first one (session 031e8492-bab1-4959-95a2-e7facec049ff)

{
  "cluster": "ncigadi",
  "bc_num_hours": "4",
  "queue": "normalbw",
  "compute_size": "small",
  "project": "nf33",
  "storage": "gdata/xp65+gdata/nf33+gdata/gb02+gdata/lo70",
  "software": "",
  "settings": "",
  "adv_checkbox": "1",
  "extra_jupyter_args_adv": "",
  "data_modules_use_adv": "/g/data/xp65/public/modules",
  "data_modules_adv": "conda/analysis3",
  "python_env_adv": "",
  "conda_env_adv": "",
  "envvars_adv": "",
  "jobfs_adv": "",
  "pbsflags_adv": "",
  "prescript_adv": "",
  "bc_email_on_started": "0"
}

And this is the second (183efac9-f0ac-401d-8100-8dc6107b7b57)

{
  "cluster": "ncigadi",
  "bc_num_hours": "4",
  "queue": "normalbw",
  "compute_size": "small",
  "project": "nf33",
  "storage": "gdata/xp65+gdata/nf33+gdata/gb02+gdata/lo70",
  "software": "",
  "settings": "",
  "adv_checkbox": "1",
  "extra_jupyter_args_adv": "",
  "data_modules_use_adv": "/g/data/xp65/public/modules",
  "data_modules_adv": "conda/analysis3",
  "python_env_adv": "",
  "conda_env_adv": "",
  "envvars_adv": "",
  "jobfs_adv": "",
  "pbsflags_adv": "",
  "prescript_adv": "",
  "bc_email_on_started": "0"
}

Same config, different result. One after the other, without changing anything in my bashrc.

If the PBS job can’t find a ‘jupyter’ executable after loading the module specified it will fall back to the version in /apps. Possibly a temporary storage issue - the PBS logs may have more info (you can get to them by following the session id link)

I’m getting reports that other people are seeing an /apps juptyter path when using the conda/analysis3 module. They worked around it by adding a version, e.g. conda/analysis3-26.01