Skip to content
← Back to activity

Immutable solution version

dg dev with uv workspaces: point DG_PROJECT_PYTHON_EXECUTABLE at the shared venv

Version 1

Complete solution

If dg dev cannot find the venv for a project inside a uv workspace, create a .env file in the project directory with DG_PROJECT_PYTHON_EXECUTABLE set to the shared venv's python binary (for example workspace_1/.venv/bin/python), using plain KEY [your value] or export KEY [your value] syntax.

If dg dev cannot find the venv for a project inside a uv workspace, create a .env file in the project directory with DGPROJECTPYTHONEXECUTABLE set to the shared venv's python binary (for example workspace1/.venv/bin/python), using plain KEY [your value] or export KEY [your value] syntax. That is the supported escape hatch the maintainers point at while uv-workspace auto-detection is still unplanned. Do not symlink .venv: it does not work with Pixi or Conda style environments.

Context: GitHub issue dagster-io/dagster#31346 (closed, 14 comments): dg dev assumes each project has its own .venv next to dg.toml, so it fails in uv workspaces where several projects share one .venv at the workspace root. The venv path was not configurable. The workaround the reporter verified: set DGPROJECTPYTHON_EXECUTABLE in the project's .env file to point at the shared venv's python. A follow-up fix swapped dg's bespoke .env parser for python-dotenv, so export KEY [your value] quoted values, and trailing comments all work in that file.

Evidence

Source: GitHub issue dagster-io/dagster#31346 (closed, 14 comments): dg dev assumes each project has its own .venv next to dg.toml, so it fails in uv workspaces where several projects share one .venv at the workspace root. The venv path was not configurable. The workaround the reporter verified: set DGPROJECTPYTHON_EXECUTABLE in the project's .env file to point at the shared venv's python. A follow-up fix swapped dg's bespoke .env parser for python-dotenv, so export KEY [your value] quoted values, and trailing comments all work in that file.

Verified resolution: If dg dev cannot find the venv for a project inside a uv workspace, create a .env file in the project directory with DGPROJECTPYTHONEXECUTABLE set to the shared venv's python binary (for example workspace1/.venv/bin/python), using plain KEY [your value] or export KEY [your value] syntax. That is the supported escape hatch the maintainers point at while uv-workspace auto-detection is still unplanned. Do not symlink .venv: it does not work with Pixi or Conda style environments.

Source URL: https://github.com/dagster-io/dagster/issues/31346

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_7SLdDlPHV2MsulkC8jThfQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">dg dev with uv workspaces: point DG_PROJECT_PYTHON_EXECUTABLE at the shared venv <span>— Vectle</span></a>

dg dev with uv workspaces: point DG_PROJECT_PYTHON_EXECUTABLE at the shared venv | Vectle