Set up a project
- Python
- TypeScript
- Java
Install the Python SDK into a virtual environment. A virtual environment is an isolated Python installation for one project. Use one because:When the environment is active, your shell prompt usually starts with Older
- The SDK’s dependencies, such as
httpxandpydantic, do not conflict with other projects. - You can pin exact versions per project and reproduce them on other machines.
- You do not need administrator rights to install packages.
- macOS/Linux
- Windows
(.venv). Inside an active environment, python and pip refer to the environment’s interpreter on every operating system.Activate the environment in every new terminal session before you run your code. To leave the environment, run
deactivate.pip versions can fail to resolve recent packages. Upgrade pip inside the environment:Install the SDK
- Python
- TypeScript
- Java
hiddenlayer-sdk, but you import it in Python as hiddenlayer.Install optional packages
Install these only if you use the related feature.Asynchronous HTTP backend
- Python
- TypeScript
- Java
By default, Keep the quotes. Some shells, such as zsh (the default on macOS), treat square brackets as a filename pattern and fail with
AsyncHiddenLayer sends requests with httpx. To send them with aiohttp instead, install the aiohttp extra:no matches found.With the extra installed, AsyncHiddenLayer uses aiohttp automatically. You do not need to change your code. If your program then prints aiohttp’s Unclosed connector warning when it exits, close the client’s connections as shown in Authentication and configuration.Cloud and Hugging Face model scanning helpers
Some model scanning helpers download models with third-party libraries. The SDK does not install them, so install the ones for the scans you run:- Python
- TypeScript
- Java
If a package is missing when you call the helper, the SDK raises an
ImportError, for example Python package boto3 is not installed.Loading credentials from a .env file
The SDKs read environment variables but do not load.env files themselves.
- Python
- TypeScript
- Java
To load a
.env file during local development, install python-dotenv:Verify the installation
- Python
- TypeScript
- Java
Print the installed SDK version:The output is a version number, for example:You can also check package details with
pip:Pin versions
Pin the SDK version so that every developer and every deployment uses the same code.- Python
- TypeScript
- Java
Add a line to your Or allow compatible minor and patch updates within the same major version:Install from the file:
requirements.txt file:requirements.txt
requirements.txt
The SDKs follow semantic versioning, but beta APIs are excluded from the versioning guarantees. An exact pin is the safest choice for production. See Version compatibility and upgrades.
Upgrade or uninstall
- Python
- TypeScript
- Java
Upgrade to the latest release:Uninstall the SDK:
Common installation errors
- Python
- TypeScript
- Java
pip installs the package, but Python still cannot import it
pip installs the package, but Python still cannot import it
On machines with several Python installations, the The path should point inside your
pip command can belong to a different interpreter than python. Always install with python -m pip ... so that pip runs under the same interpreter as your code.To see which interpreter you are using, run:.venv folder.pip installs version 3.10.0 instead of 6.x
pip installs version 3.10.0 instead of 6.x
Your environment runs Python 3.9. Versions 4 and later require Python 3.10 or later, so
pip installs 3.10.0, the last release that supports Python 3.9. The examples in this guide do not work with 3.10.0. Create the virtual environment with Python 3.10 or later and install again.Next step
Authentication and configuration
Provide your client ID and client secret, and choose your region.

