Python package not available although listed by conda

So I built a custom image with some extra packages like mlflow. The build uses NB_USER=jovyan.

I spin up two containers of this custom jupyterlab image (built upon jupyter/scipy-notebook):

  1. one that does not set NB_USER to anything, thus inheriting jovyan
  2. a second one that sets NB_USER=lauren

I would think that these extra packages would be equally importable, but that isn’t the case, as seen by the screenshot.

How can I fix this?

I already tried fix-permissions /home/lauren.

Do I have to rebuild the image with NB_USER=lauren?

The user on the left is root: pretty much anything you do as root is going to break in most interactive conda envs for other users.

Additionally: the ! shell magic is not a trustworthy indicator of any of your environment variables (and therefore PATH). sys.executable might reveal fresh horrors. But yeah, they most of those as-built values are not intended to be changed.

Anyhow: for these kinds of containers, where part of the idea is for the user to be able to change the environment in user space, the best bet is indeed to normalize everything that possibly can be as the user that will actually start the initial process, and be as explicit as possible about paths, etc.

1 Like

I appreciate the guidance. I rewrote the Dockerfile and have excluded a separate conda env that I was using - now installing everything into the default conda env.

Now every NB_USER is able to access all the packages :slight_smile:

(it is not really a solution, but keeping it simple(r) made it work for me)