boxlite-ai / boxlite-ai/boxlite
CodeBox: auto-install does not work — import of missing packages raises ModuleNotFoundError
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 179
- Avg merge
- 23h 25m
- Merged PRs (30d)
- 121
Description
## Description
The documentation claims CodeBox automatically detects and installs missing packages (`code-execution.mdx` Step 2, `quickstart-python.mdx`, `core-concepts.mdx`). In practice, this does not work — importing a package not present in `python:slim` raises `ModuleNotFoundError`.
## Reproduction
```python
import asyncio
import boxlite
async def main():
async with boxlite.CodeBox() as codebox:
result = await codebox.run("""
import requests
response = requests.get('https://api.github.com/zen')
print(response.text)
""")
print(result)
asyncio.run(main())
```
## Expected
CodeBox detects `import requests`, installs `requests` via pip, then re-runs the code.
## Actual
```
ModuleNotFoundError: No module named 'requests'
```
## Environment
- boxlite 0.5.10
- macOS Apple Silicon
- Python 3.12
## Notes
`install_package("requests")` works fine when called explicitly. The issue is specifically the auto-detection + auto-install feature.
Contributor guide
Assessment
This issue has not been assessed yet.