Recently, I decided to install Nanobot on my WSL Ubuntu environment.
Step 1: Preparing the Environment
I started by updating my system and installing the necessary packages:
sudo apt update
sudo apt install python3-full python3-venv git
Step 2: Cloning Nanobot
Next, I cloned the Nanobot repository from GitHub:
git clone https://github.com/HKUDS/nanobot.git
cd nanobot
Step 3: Creating a Virtual Environment
When I tried to install Nanobot directly with pip install -e ., I hit the following error:
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install...
This happened because Ubuntu now protects the system Python environment (PEP 668). The solution was to create a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
Step 4: Installing Nanobot
Inside the virtual environment, I upgraded pip and installed Nanobot:
pip install --upgrade pip
pip install -e .
Step 5: Configuring Nanobot
I needed to configure Nanobot with my API key. I copied my existing config file from Windows into WSL:
mkdir -p ~/.nanobot
cp /mnt/c/Users/oktay/.nanobot/config.json ~/.nanobot/
Alternatively, I could have created a symlink to always share the same config:
ln -s /mnt/c/Users/oktay/.nanobot/config.json ~/.nanobot/config.json
Step 6: Facing the API Key Error
When I ran nanobot agent, I got:
Error: No API key configured for provider 'None'.
The fix was to ensure my ~/.nanobot/config.json contained the correct key:
{
"api_key": "YOUR_OPENAI_API_KEY",
"model": "gpt-4o-mini",
"webui": true
}
Step 7: Running Nanobot
Finally, I launched Nanobot inside the virtual environment:
cd ~/nanobot
source .venv/bin/activate
nanobot agent
With the correct configuration, Nanobot started successfully, and the WebUI became available at http://127.0.0.1:8765.
Conclusion
Installing Nanobot on WSL Ubuntu was straightforward once I understood the new Python environment restrictions. The key lessons were:
- Always use a virtual environment to avoid conflicts with system Python.
- Keep your config file in
~/.nanobot/config.jsonwith the correct API key. - Symlinking the config file from Windows ensures both environments stay in sync.
Now Nanobot runs smoothly on my WSL setup, ready for experiments and development.