This guide will help you set up a proper Python environment for the lmagi (easyAGI) project.
- Python 3.9 or higher (Python 3.13.7 recommended)
- pip package manager
- virtualenv (optional but recommended)
Run the setup script to automatically create and configure your environment:
chmod +x setup.sh
./setup.shThis script will:
- Check your Python version
- Create a virtual environment in
./venv - Install all dependencies from
requirements.txt - Create necessary directories
- Create a
.envfile template for API keys
If you prefer to set up manually:
python3 -m venv venvmacOS/Linux:
source venv/bin/activateWindows:
venv\Scripts\activatepip install --upgrade pippip install -r requirements.txtmkdir -p memory/stm memory/logs memory/truth gfxCreate a .env file in the project root:
touch .envAdd your API keys to the .env file:
# OpenAI API Key
OPENAI_API_KEY=your_openai_key_here
# Groq API Key
GROQ_API_KEY=your_groq_key_here
# Together.ai API Key
TOGETHER_API_KEY=your_together_key_here
# AI71 API Key
AI71_API_KEY=your_ai71_key_hereThe project uses the following main dependencies:
- openai - OpenAI API integration
- groq - Groq API for Llama3 models
- together - Together.ai API integration
- ai71 - AI71 Falcon models
- nicegui - UI framework with FastAPI integration
- fastapi - Web framework
- uvicorn - ASGI server
- aiohttp - Async HTTP client/server
- asyncio - Built-in async I/O (Python 3.4+)
- python-dotenv - Environment variable management
- ujson - Fast JSON processing
- psutil - System and process utilities
python lmagi.pyThis will start the web interface at http://localhost:8080 (default NiceGUI port).
Access the Ollama interface at:
http://localhost:8080/ollama
lmagi/
├── automind/ # AGI reasoning modules
│ ├── agi.py
│ ├── automind.py
│ ├── logic.py
│ ├── openmind.py
│ └── SocraticReasoning.py
├── memory/ # Memory storage
│ ├── stm/ # Short-term memory
│ ├── logs/ # Reasoning logs
│ └── truth/ # Truth tables
├── webmind/ # Web and API handlers
│ ├── api.py
│ ├── chatter.py
│ ├── html_head.py
│ └── ollama_handler.py
├── gfx/ # Static assets
├── lmagi.py # Main application
├── requirements.txt # Dependencies
├── setup.sh # Setup script
├── setup.py # Package configuration
└── .env # API keys (create this)
Issue: source venv/bin/activate doesn't work
Solution: Make sure you're in the project root directory and the virtual environment was created successfully.
Issue: Import errors when running the application
Solution: Ensure you've activated the virtual environment and installed all dependencies:
source venv/bin/activate
pip install -r requirements.txtIssue: NiceGUI can't start because port is in use
Solution: Either stop the process using the port or specify a different port in the code.
Issue: Authentication errors with LLM APIs
Solution:
- Verify your API keys are correct in the
.envfile - Ensure there are no extra spaces or quotes around the keys
- Check that the
.envfile is in the project root directory
Issue: ModuleNotFoundError: No module named 'asyncio'
Solution: The asyncio module is built into Python 3.4+. If you see this error:
- Check your Python version:
python3 --version - Remove the
asyncio==3.4.3line from requirements.txt (it's not needed for Python 3.9+)
Uncomment the development dependencies in requirements.txt:
pytest>=7.4.0 # Testing framework
black>=23.0.0 # Code formatter
flake8>=6.0.0 # Linter
mypy>=1.5.0 # Type checkerThen install:
pip install -r requirements.txtblack .flake8 .mypy .To install lmagi as a package:
pip install -e .This allows you to import lmagi modules from anywhere in your system while in development mode.
- Documentation: https://rage.pythai.net
- License: MIT License (c) 2024 Gregory L. Magnusson
- The application requires at least one API key to function
- Memory files will be created automatically on first run
- All conversation data is stored locally in the
memorydirectory - The autonomous reasoning feature can be enabled/disabled via the UI toggle