deploy-hf
FreeNo executable scriptsNot checkedDeploy an OpenEnv environment to Hugging Face Spaces. Use when asked to deploy, push to Hugging Face, or update a space.
by openenv★ 2,920 GitHub starsAbout this skill
Deploy to Hugging Face Spaces
Deploy an OpenEnv environment to Hugging Face Spaces using the OpenEnv CLI.
When to Use This Skill
- User asks to "deploy to Hugging Face"
- User says "push to Hugging Face Spaces"
- User wants to update an existing space
- After implementing new features that need to be tested in production
Prerequisites
Before deploying, ensure:
- The environment has an
openenv.yamlfile - The environment has a
server/Dockerfile - You have Hugging Face credentials configured (automatic via huggingface-cli)
Instructions
1. Identify the Environment
Determine which environment to deploy:
- If user specifies: use that environment (e.g., "carla_env", "browser_env")
- If in environment directory: use current directory
- Otherwise: ask the user
2. Determine the Repository ID
Repository ID format: username/space-name
- If user provides full ID: use it (e.g., "sergiopaniego/carla-env-real-updated")
- If user provides only space name: construct ID with their username
- Check
openenv.yamlfor default repo-id - Otherwise: ask the user
3. Pre-Deployment Setup
IMPORTANT: Always run from the project root directory.
Before deploying, ensure OpenEnv is installed:
cd /path/to/OpenEnv # Navigate to project root if needed
uv pip install -e .
If this fails with "does not appear to be a Python project", you're not in the project root.
4. Run the Deployment Command
Execute the deployment:
PYTHONPATH=src uv run python -m openenv.cli push <environment-dir> --repo-id <username/space-name>
Parameters:
<environment-dir>: Path to environment (e.g.,envs/carla_env)--repo-id: Hugging Face Spaces repository ID (e.g.,sergiopaniego/carla-env-real-updated)
Optional flags:
--private: Deploy as a private space--no-interface: Disable the web interface (deploy API-only)--base-image <image>: Override the base Docker image--hardware <hw>/-H <hw>: Request Hugging Face Space hardware (e.g.t4-medium,a10g-small,cpu-basic)
5. Verify Deployment
After successful deployment:
- Note the Space URL returned by the command
- Wait for build to complete:
- CPU environments: ~5 minutes
- GPU environments (CARLA): ~30-60 minutes
- Check the space status at the URL
- Test with a simple health check once build completes:
curl https://<username>-<space-name>.hf.space/health
Example Usage
Deploy carla_env to existing space
PYTHONPATH=src uv run python -m openenv.cli push envs/carla_env --repo-id sergiopaniego/carla-env-real-updated
Deploy echo_env as private space
PYTHONPATH=src uv run python -m openenv.cli push envs/echo_env --repo-id username/my-echo-env --private
Deploy with GPU hardware
PYTHONPATH=src uv run python -m openenv.cli push envs/carla_env --repo-id username/carla-env --hardware t4-medium
Deploy with custom base image
PYTHONPATH=src uv run python -m openenv.cli push envs/browser_env --repo-id username/browser-env --base-image nvidia/cuda:11.8.0-runtime-ubuntu22.04
Output Format
Report deployment status:
## Hugging Face Deployment
### Environment
- Environment: <env-name>
- Directory: <path>
- Dockerfile: <path-to-dockerfile>
### Deployment
- Repository ID: <username/space-name>
- Space URL: <https://huggingface.co/spaces/username/space-name>
- Status: ✓ Deployed successfully
### Next Steps
1. Wait for space to build (5 min for CPU, 30-60 min for GPU/CARLA)
2. Visit space URL to check build status
3. Test environment once build completes
### Testing Commands
```bash
# Health check
curl https://<username>-<space-name>.hf.space/health
# Reset environment
curl -X POST https://<username>-<space-name>.hf.space/reset
# Step action
curl -X POST https://<username>-<space-name>.hf.space/step \
-H "Content-Type: application/json" \
-d '{"action_type": "observe"}'
## Troubleshooting
### Error: "ModuleNotFoundError: No module named 'openenv'"
**Solution**: Install OpenEnv first (must be run from project root):
```bash
cd /path/to/OpenEnv # Navigate to project root
uv pip install -e .
Error: "does not appear to be a Python project"
Cause: You're not in the project root directory.
Solution: Navigate to the OpenEnv project root where pyproject.toml exists:
cd /Users/sergiopaniegoblanco/Documents/Projects/OpenEnv # Adjust path
uv pip install -e .
Error: "Directory does not exist"
Solution: Ensure you're passing the correct environment directory path:
# Correct
PYTHONPATH=src uv run python -m openenv.cli push envs/carla_env --repo-id ...
# Incorrect
PYTHONPATH=src uv run python -m openenv.cli push carla_env --repo-id ...
Error: "Authentication required"
Solution: Login to Hugging Face CLI first:
huggingface-cli login
Space build fails
Solutions:
- Check Dockerfile syntax and depende
Install deploy-hf in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
BashReadFAQ
What does the deploy-hf skill do?
Deploy an OpenEnv environment to Hugging Face Spaces. Use when asked to deploy, push to Hugging Face, or update a space.
How do I install the deploy-hf skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the deploy-hf skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
ci-review
The scan that the plugin's GitHub Action runs.
by Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
by GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
by GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
by GitHub