ClearML(原Trains)能否本地运行?无Docker/K8s可行吗?
Absolutely! I’ve actually helped a few folks get ClearML (formerly Trains) running locally on Ubuntu 18.04 without Docker or Kubernetes—here’s how you can pull it off:
Prerequisites First
First, make sure you have the core dependencies installed on your system:
- Install essential system packages:
sudo apt update && sudo apt install -y python3-pip python3-dev git libssl-dev libffi-dev build-essential - Upgrade pip to avoid version conflicts:
python3 -m pip install --upgrade pip
Step 1: Install & Configure ClearML Server Components
ClearML Server relies on three core services: API, Web UI, and File Storage. You can run all of them directly via Python without containers.
Install the ClearML Server Package
pip3 install clearml-server
Generate Local-Focused Configuration
Run the init command to set up local storage (no remote services needed):
clearml-server init
When prompted, select local storage options for every component (database, file storage, etc.). The config file will save to ~/.clearml/server.conf—you can tweak it later, but the default local setup works for basic experiments.
Step 2: Start the Server Services
You’ll need to run three separate processes. Use tmux or screen to keep them running in the background, or open three terminal windows:
- Start the API Service (default port 8008):
clearml-server api - Start the Web UI (default port 8080—access it via
http://localhost:8080once running):clearml-server web - Start the File Storage Service (default port 8081):
clearml-server files
Pro Tip: If you don’t want to keep terminals open, tmux is great for splitting a single window into panes for each service—easy to monitor logs if something goes wrong.
Step 3: Point Your ClearML Client to the Local Server
Now configure your client to use your local instance instead of the cloud platform:
- Initialize client settings:
clearml-init - When prompted, enter your local server details:
- API server:
http://localhost:8008 - Web server:
http://localhost:8080 - File server:
http://localhost:8081 - You can skip credential prompts for local use (just press enter) unless you want to set up user authentication later.
- API server:
Step 4: Test Your Setup
Run a simple test script to confirm everything works:
from clearml import Task # Initialize a local task task = Task.init(project_name="Local Test Project", task_name="First Local Run") # Dummy work to generate logs for i in range(10): print(f"Completed step {i}") task.get_logger().report_scalar("Progress", "Current Step", i, iteration=i) # Task auto-completes when the script finishes
Save this as test_clearml.py and run it:
python3 test_clearml.py
Then open http://localhost:8080 in your browser—you should see the task listed under the "Local Test Project" with the scalar logs visible.
Troubleshooting Common Issues
- Port conflicts: If default ports (8008, 8080, 8081) are in use, edit the
~/.clearml/server.conffile to change them, then restart the services. - Permission errors: Ensure you have write access to
~/.clearml/data(the default local storage directory). Adjust permissions withchmodinstead of usingsudoif possible. - Python version issues: Ubuntu 18.04’s default Python 3.6 is supported, but if you hit errors, install Python 3.7/3.8 via
ppa:deadsnakes/ppaand use that version for installation.
I’ve seen this setup work smoothly for small-scale local experiments—no need for container orchestration when you just want to test ClearML on your own machine.
内容的提问来源于stack exchange,提问作者DalyaG

