Summary
Running nanoresearch health on Windows crashes during environment discovery because nanoresearch/agents/runtime_env/_discovery.py uses os.environ / os.path.expanduser(...) without importing os.
Environment
- OS: Windows 11
- Shell: PowerShell
- Python: conda environment
- Project path:
D:\NanoResearch
Steps to reproduce
- Clone the repo on Windows.
- Create and activate a conda environment.
- Install the project in editable mode.
- Run:
Actual behavior
The command crashes with:
NameError:` name 'os' is not defined
Traceback excerpt:
File "D:\NanoResearch\nanoresearch\agents\runtime_env_discovery.py", line 85, in discover_environments
pyenv_root = os.environ.get("PYENV_ROOT") or os.path.expanduser("~/.pyenv")
NameError: name 'os' is not defined
Expected behavior
nanoresearch health should complete normally and report detected Python environments.
Root cause
nanoresearch/agents/runtime_env/_discovery.py references os.environ and os.path.expanduser(...) but does not import os.
Suggested fix
Add the missing import at the top of nanoresearch/agents/runtime_env/_discovery.py:
import os
For example:
from __future__ import annotations
import json
import logging
import os
import platform
import re
import shutil
import subprocess
from pathlib import Path
from typing import Any
Summary
Running
nanoresearch healthon Windows crashes during environment discovery becausenanoresearch/agents/runtime_env/_discovery.pyusesos.environ/os.path.expanduser(...)without importingos.Environment
D:\NanoResearchSteps to reproduce
Actual behavior
The command crashes with:
NameError:` name 'os' is not defined
Traceback excerpt:
File "D:\NanoResearch\nanoresearch\agents\runtime_env_discovery.py", line 85, in discover_environments
pyenv_root = os.environ.get("PYENV_ROOT") or os.path.expanduser("~/.pyenv")
NameError: name 'os' is not defined
Expected behavior
nanoresearch health should complete normally and report detected Python environments.
Root cause
nanoresearch/agents/runtime_env/_discovery.py references os.environ and os.path.expanduser(...) but does not import os.
Suggested fix
Add the missing import at the top of nanoresearch/agents/runtime_env/_discovery.py:
import os
For example: