{"id":2453,"library":"dagster-cloud-cli","title":"Dagster Cloud CLI","description":"The `dagster-cloud-cli` provides command-line tools for interacting with Dagster Cloud, enabling operations such as deploying code, managing agents, and configuring workspaces. It is the primary interface for developers to manage their Dagster deployments in a Dagster Cloud environment. The current version is 1.13.0, with releases tightly coupled to the broader Dagster ecosystem's frequent update cadence.","status":"active","version":"1.13.0","language":"python","source_language":"en","source_url":"https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-cloud-cli","tags":["cli","dagster","cloud","orchestration","deployment"],"install":[{"cmd":"pip install dagster-cloud-cli","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core Dagster library, required for defining pipelines and assets.","package":"dagster","optional":false},{"reason":"Python SDK for programmatic interaction with Dagster Cloud.","package":"dagster-cloud","optional":false}],"imports":[],"quickstart":{"code":"import subprocess\nimport os\n\n# The dagster-cloud-cli is primarily used via the 'dg' command in the terminal.\n# This quickstart demonstrates checking its version programmatically.\n\ntry:\n    # This runs a basic 'dg --version' command to verify installation.\n    # For actual Dagster Cloud operations (e.g., 'dg deploy'), you would typically\n    # execute commands directly in your shell or CI/CD scripts.\n    print(\"Running: dg --version\")\n    result = subprocess.run([\"dg\", \"--version\"], capture_output=True, text=True, check=True)\n    print(\"\\nDagster Cloud CLI Version Information:\")\n    print(result.stdout)\n    print(\"Ensure 'dg' is in your system's PATH after installation.\")\n\nexcept FileNotFoundError:\n    print(\"Error: 'dg' command not found. Ensure dagster-cloud-cli is installed and in your PATH.\")\nexcept subprocess.CalledProcessError as e:\n    print(f\"Error running dg command: {e}\")\n    print(f\"Stdout: {e.stdout}\")\n    print(f\"Stderr: {e.stderr}\")\n","lang":"python","description":"This quickstart demonstrates how to verify the installation of `dagster-cloud-cli` by running the `dg --version` command. The `dagster-cloud-cli` is primarily a command-line interface tool, and most interactions happen directly in the terminal via the `dg` command. For programmatic interactions with Dagster Cloud itself, the `dagster-cloud` Python library is generally used."},"warnings":[{"fix":"Use `pip install dagster-cloud` and refer to its documentation for Python SDK usage.","message":"The `dagster-cloud-cli` (`dg` command) is a command-line interface. For programmatic interaction with Dagster Cloud services (e.g., fetching run metadata, launching runs from Python), you should use the `dagster-cloud` Python library (SDK) instead of attempting to import from or wrap the CLI tool.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Set `export DAGSTER_CLOUD_AGENT_TOKEN='...'` in your environment or run `dg login` to authenticate before executing commands that interact with your Dagster Cloud workspace.","message":"Authentication for `dagster-cloud-cli` typically requires setting the `DAGSTER_CLOUD_AGENT_TOKEN` environment variable or using `dg login`. Operations like `dg deploy` will fail without proper authentication.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Run `dg init` to set up a new project structure or ensure your existing project contains a valid `dagster_cloud.yaml` file and entrypoint.","message":"When deploying code using `dg plus deploy`, a `dagster_cloud.yaml` configuration file and a properly structured Dagster project are required in the current directory or specified path. Missing or misconfigured files will prevent successful deployment.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Explicitly add `pip install psycopg2-binary` to your project's dependencies if you use `dagster-postgres` and previously relied on its transitive inclusion.","message":"Beginning with Dagster core version 1.12.18 (which `dagster-cloud-cli` depends on), `psycopg2-binary` was removed as a transitive dependency from `dagster-postgres`. If your project relies on `dagster-postgres` and implicitly depended on this, you may encounter import errors.","severity":"breaking","affected_versions":">=1.12.18 (core) / >=0.28.18 (libraries)"}],"env_vars":null,"search_vec":"'1.13.0':51 'agent':26 'broader':58 'cadenc':64 'cli':3,8,65 'cloud':2,7,18,45,67 'code':24 'command':11 'command-lin':10 'configur':28 'coupl':55 'current':48 'dagster':1,6,17,40,44,59,66 'dagster-cloud-c':5 'deploy':23,41,69 'develop':36 'ecosystem':60 'enabl':19 'environ':46 'frequent':62 'interact':15 'interfac':34 'line':12 'manag':25,38 'oper':20 'orchestr':68 'primari':33 'provid':9 'releas':53 'tight':54 'tool':13 'updat':63 'version':49 'workspac':29","created_at":"2026-04-11T01:28:46.912622+00:00","updated_at":"2026-04-16T04:52:24.960841+00:00","problems":[{"fix":"Install the recommended `dagster-dg-cli` using `pip install dagster-dg-cli` and use `dg` commands. If you explicitly need `dagster-cloud`, ensure it's installed via `pip install dagster-cloud` and verify your PATH.","cause":"The `dagster-cloud` CLI has largely been superseded by the `dg` CLI, or it might not be installed or its executable path is not in your system's PATH.","error":"dagster-cloud: command not found"},{"fix":"Reauthenticate your CLI session by running `dagster-cloud config setup` or `dg login`. This will guide you through browser-based authentication or prompt for a new user token.","cause":"The authentication token used by the `dagster-cloud-cli` (or `dg cli`) to connect to Dagster Cloud is no longer valid, often due to expiry or revocation.","error":"denied: Your authorization token has expired. Reauthenticate and try again."},{"fix":"Ensure that a `setup.py` or `requirements.txt` file, listing your project's Python dependencies (including `dagster-cloud`), is present in the root of the directory you are deploying.","cause":"When deploying code to Dagster Cloud, particularly with serverless deployments, the CLI requires a `setup.py` or `requirements.txt` file in the specified target directory to define and build your Python dependencies.","error":"Error: Could not find a setup.py or requirements.txt in the target directory."},{"fix":"Use the specific deployment ID (a long hexadecimal string) when launching jobs in a branch deployment. The deployment ID can be obtained from the Dagster Cloud UI or by running `dagster-cloud ci status` after the deployment.","cause":"This error typically occurs when attempting to launch a job in a Dagster Cloud branch deployment using the branch *name* instead of its unique *deployment ID*.","error":"dagster_cloud_cli.core.errors.DagsterCloudAgentServerError: Exceeded 30 redirects."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"dagster-cloud","cli_version":"Dagster Cloud version: 1.13.5","type":"library","homepage":"https://dagster.io/cloud","github":"https://github.com/dagster-io/dagster","docs":null,"changelog":null,"pypi":"https://pypi.org/project/dagster-cloud-cli/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["workflow","devops","aws"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-04-10","next_check":"2026-07-09","install_tag":null}}