Disappearing mounted Python packages

This is a solved issue, but I figured I’d leave breadcrumbs in case anyone else runs into it as it cost me some time.

Developing in tutor local, my mounted packages would seemingly spontaneously uninstall themselves, though the mounts clearly existed everything had worked fine through many, many soft restarts.

Python repositories created with our cookiecutter get a lot of free stuff in the Makefile. Including make clean, which also gets called from make test. I would run pytest a bunch of times, then make test (instead of make test-all oops).

make test runs make clean which deletes the local egg-info file which, in turn, is symlinked to from the docker container’s virtual env to install the package. No file, no package.

make coverage also does this.

I tried many different things, but in the end tutor local do init solves it by re-running pip install -e on any mounted packages if the egg-info isn’t there. You can probably limit it to whatever you’re working in for somewhat faster turnaround (ex: tutor local do init -l cms) , I haven’t tried.

Tutor even kindly tells you it’s doing this in the log output. Hope this saves someone some head scratching.


Apart from Makefile recipes, the difference between build and runtime mounts is important in this context. During the image build, the mounted directories are installed within the image. This generates the egg-info but it is not copied back to the host. For reference, this is the PR that solved this fix: ensure mounted installable packages are installed as expected by DawoudSheraz · Pull Request #1016 · overhangio/tutor · GitHub. The PR and the related issue also have a bit more context on this.

1 Like