Files
nixpkgs/pkgs/development/python-modules/mlflow/subprocess-pythonpath.patch

16 lines
611 B
Diff

--- a/mlflow/server/__init__.py
+++ b/mlflow/server/__init__.py
@@ -657,6 +657,12 @@
"true" if using_uvicorn and _uvicorn_opts_enable_tls(uvicorn_opts) else "false"
)
+ # In Nix-packaged environments sys.path is populated by wrappers but
+ # PYTHONPATH is never set in os.environ, so subprocesses (uvicorn,
+ # gunicorn) cannot find packages. Propagate it when not already set.
+ if "PYTHONPATH" not in os.environ:
+ env_map.setdefault("PYTHONPATH", os.pathsep.join(p for p in sys.path if p))
+
server_proc = _exec_cmd(
full_command,
extra_env=env_map,