Area: Deployment
Sub-Area: CLI
Applies to: OSS + Cloud
Issue
You can't install or run the DataHub CLI, pip fails to install acryl-datahub, the datahub command isn't found, or you aren't sure which CLI version to use with your DataHub server.
You Might Be Asking
- Which Python version does the DataHub CLI need?
- Which CLI version should I use with my DataHub server?
- I'm a DataHub Cloud customer. Does my CLI version need to match my server version?
- I installed the CLI, but
datahub versionsays "command not found". - I ran
datahub initand the CLI points at localhost instead of my Cloud instance.
Cause
- The CLI requires Python 3.10 or later. Older Python versions can't install the current CLI.
- The server and CLI pairing rule applies to self-hosted (OSS) DataHub only. DataHub Cloud does not use that rule. Cloud server versions (for example v2.4.4) are different numbers from CLI and SDK versions (for example 1.7.0.x).
- If the virtual environment isn't active in your shell, the
datahubcommand isn't on your path. - If you run
datahub initwith a token (or a username and password) but without--host, the CLI skips the host prompt and saveshttp://localhost:8080as the server.
Solution
1. Check your Python version
The CLI requires Python 3.10 or later.
2. Install the CLI in a virtual environment
Create and activate a virtual environment, then install:
python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade pip wheel setuptools
python3 -m pip install --upgrade acryl-datahub
datahub version
You must activate the virtual environment again in each new shell. If you see command not found, run python3 -m datahub version.
You can also install the CLI with Homebrew: brew install datahub-project/tap/datahub. The Homebrew install has the core CLI only. To add connectors, run "$(brew --prefix datahub)/libexec/bin/pip" install 'acryl-datahub[snowflake,bigquery]'.
The [all] extra leaves out the airflow, great-expectations, mssql-odbc and datahub-lite extras. To use Airflow, install acryl-datahub-airflow-plugin as described in the Airflow plugin docs.
Steps and details are in the CLI install docs.
3. Check what you installed
datahub version prints three lines: the CLI version, the models version and the Python version. It does not print server information. To also print the server config, run datahub version --include-server. This needs datahub init to have run first.
4. Pick the right CLI version
Self-hosted (OSS): The pairing rule applies to you. Use the CLI version that pairs with your server. A server on version 0.8.28 uses CLI 0.8.28.x. New CLIs are not tested against older servers, so don't upgrade the CLI ahead of the server. See Release Notes and CLI versions.
DataHub Cloud: The pairing rule does not apply to you. Don't match the CLI to the server version. Cloud server versions (v2.x) are not CLI versions (1.7.0.x). Use the CLI/SDK version in the "Recommended Versions" block of your release's notes. For v2.4.4, the recommended CLI/SDK is 1.7.0.19. See the DataHub Cloud v2.4.0 to v2.4.4 release notes. If you aren't sure which version applies to you, contact DataHub Support.
5. Point the CLI at your server
Plain datahub init is interactive and asks for the host. To set it without prompts, use --host. For DataHub Cloud, also pass your access token:
datahub init --token <your-access-token> --host https://<your-instance>.acryl.io/gms
If you pass credentials without prompts (--token, --username and --password, or DATAHUB_GMS_TOKEN) and set neither --host nor DATAHUB_GMS_URL, the CLI saves http://localhost:8080 without asking. For a self-hosted server, use --host http://<your-gms-host>:8080.
If the DATAHUB_GMS_URL environment variable is set, the CLI uses it and the DATAHUB_GMS_TOKEN token instead of the ~/.datahubenv file. Check your environment if the CLI connects to the wrong server.
To confirm the CLI reaches the right server, run datahub check server-config. It prints the server config from the configured server.
See the init docs. The docs page also describes a --profile option. The released CLI doesn't have it, so don't use it.