uber/neuropod

PACKAGE_BASE_DIR sometimes can't be created in user folder

mincomp opened this issue · 2 comments

Bug

When bootstrapping Neuropod Python models, pip packages would be installed in the "current user" folder, which might be readonly (which is typical in production docker environment).

PACKAGE_BASE_DIR = os.path.abspath(
    os.path.expanduser(
        "~/.neuropod/pythonpackages/py{}{}/".format(
            sys.version_info.major, sys.version_info.minor
        )
    )
)

To Reproduce

Steps to reproduce the behavior:

Create a Neuropod python model and make inference in the user folder which is read only. model bootstrap will fail.

Environment

  • Neuropod Version 0.3.0 rc1:
  • Linux:
  • Language (Python):

think we can simply change it to /tmp/.neuropod/pythonpackages/py{}{}/ any concerns?

Thanks for the bug report!

The purpose of the ~/.neuropod/pythonpackages/py{}{}/ directory is to store model dependencies (installed from pypi) so we don't need to reinstall packages every time a given model is loaded.

This is especially important for large pip packages (e.g. torch, tensorflow).

Moving this dir under /tmp by default partly defeats its purpose as these dependencies won't be available across restarts, etc.

I think it makes sense to allow the location of this directory to be configurable with an environment variable though.