Skip to main content

Overview

Grupo de Anda projects use various Python libraries for AI, audio processing, GUI development, and more. This guide covers installing and managing these dependencies.
Ubuntu Users: Always activate your virtual environment before installing dependencies. See the Virtual Environments guide first.

Required Dependencies

The Grupo de Anda projects use the following Python libraries:
pip install customtkinter keyboard gpt4all requests llama-cpp-python gTTS pygame torch librosa numpy sounddevice pydub

Library Overview

LibraryPurpose
customtkinterModern GUI framework for Python applications
keyboardKeyboard event handling and hotkeys
gpt4allLocal AI model integration
requestsHTTP requests for API calls
llama-cpp-pythonLlama model inference
gTTSGoogle Text-to-Speech
pygameAudio playback and game development
torchPyTorch deep learning framework
librosaAudio analysis and processing
numpyNumerical computing
sounddeviceAudio recording and playback
pydubAudio file manipulation

Installation Steps

1

Activate Virtual Environment

Critical: Always activate your virtual environment first, especially on Ubuntu.
Windows:
.venv\Scripts\Activate.ps1
Linux/macOS:
source .venv/bin/activate
You should see (.venv) in your terminal prompt.
2

Update pip

Ensure you have the latest version of pip:
pip install --upgrade pip
3

Install All Dependencies

Install all required libraries at once:
pip install customtkinter keyboard gpt4all requests llama-cpp-python gTTS pygame torch librosa numpy sounddevice pydub
This may take several minutes as some packages (especially PyTorch) are quite large.
4

Verify Installation

Test that the packages installed correctly:
pip list
You should see all the installed packages listed.

Installing Individual Packages

If you prefer to install packages one at a time or only need specific libraries:

GUI Development

pip install customtkinter

AI and Machine Learning

pip install gpt4all llama-cpp-python torch

Audio Processing

pip install gTTS pygame librosa sounddevice pydub

Utilities

pip install keyboard requests numpy

API Configuration

Some features require API keys or external services:
If the code you want to run uses AI models that require an API, you’ll need to obtain the appropriate API key.

Google Gemini API

  • Endpoint: https://generativelanguage.googleapis.com/
  • Use: AI model integration
  • Get your API key from Google AI Studio

Google Text-to-Speech API

  • Endpoint: https://translate.google.com/translate_tts
  • Use: Text-to-speech conversion
  • Used by the gTTS library (no API key needed for basic usage)
API keys are typically configured in environment variables or configuration files:Environment Variable:
export GEMINI_API_KEY="your-api-key-here"
Configuration File: Create a .env file or config file as specified by the specific project.
Never commit API keys to version control. Add .env to your .gitignore file.

Dependency Management

Creating requirements.txt

To save your current dependencies:
pip freeze > requirements.txt
This creates a file listing all installed packages and their versions.

Installing from requirements.txt

If the project includes a requirements.txt file:
pip install -r requirements.txt
This installs all dependencies with the exact versions specified.

Platform-Specific Notes

Ubuntu/Linux

Always use virtual environments on Ubuntu. Never use sudo pip to install packages.
Some packages may require system dependencies:
# For audio libraries
sudo apt install portaudio19-dev python3-pyaudio

# For general development
sudo apt install python3-dev build-essential

Windows

  • Most packages install without issues
  • PyTorch may require Visual C++ Redistributable
  • Some audio libraries may need additional setup

macOS

  • Install Homebrew first for system dependencies
  • May need Xcode Command Line Tools:
    xcode-select --install
    

PyTorch Installation

PyTorch is a large package with different installation options:

CPU-Only (Smaller, Faster Download)

pip install torch --index-url https://download.pytorch.org/whl/cpu

GPU Support (CUDA)

For NVIDIA GPU acceleration:
pip install torch --index-url https://download.pytorch.org/whl/cu118
The basic pip install torch command installs the CPU version. For GPU training and inference, use the CUDA version appropriate for your system.

Updating Dependencies

Update a Single Package

pip install --upgrade package-name

Update All Packages

pip list --outdated
pip install --upgrade package-name1 package-name2
Be cautious when updating packages as new versions may introduce breaking changes. Test thoroughly after updates.

Running the Code

After installing dependencies:
1

Ensure Virtual Environment is Active

Check for (.venv) in your terminal prompt.
2

Navigate to Project Directory

cd /path/to/your/project
3

Run the Program

In Terminal:
python your_script.py
In VS Code: Press F5 to execute in terminal or launch the visual interface.
Depending on the file, it will either run in the terminal or open a graphical user interface.

Troubleshooting

The package isn’t installed. Install it:
pip install package-name
Make sure your virtual environment is activated.
Ubuntu: Never use sudo pip. Use a virtual environment instead.Windows: Run your terminal as administrator, or use virtual environments (recommended).
PyTorch is a large package (several GB). The download takes time depending on your internet connection.For a smaller install, use CPU-only:
pip install torch --index-url https://download.pytorch.org/whl/cpu
Try creating a fresh virtual environment:
# Deactivate current environment
deactivate

# Remove old environment
rm -rf .venv

# Create new environment
python3 -m venv .venv
source .venv/bin/activate

# Reinstall packages
pip install customtkinter keyboard gpt4all ...
Linux: Install system audio dependencies:
sudo apt install portaudio19-dev python3-pyaudio ffmpeg
Windows: Install Visual C++ Redistributable from Microsoft.macOS: Install portaudio via Homebrew:
brew install portaudio
These packages require compilation. Install build tools:Ubuntu:
sudo apt install build-essential cmake
Windows: Install Visual Studio Build ToolsmacOS: Install Xcode Command Line Tools:
xcode-select --install

Next Steps

With dependencies installed, you can:
  1. Set up Arduino hardware (for hardware projects)
  2. Start running the Grupo de Anda projects
  3. Explore the AI model training in the ai creator folder

Additional Resources

AI Model Training

In the ai creator folder, you’ll find AI model training code. You can:
  • Use existing training data
  • Add your own data for training
  • Configure to use CPU, GPU, or both for improved performance

Supported AI Commands

The trained models support these commands:
  • search=[tema] - AI searches the internet for a topic
  • clma=[lugar] - AI provides climate data for a specific region
  • ubicacion=[] - Provides location data to the AI

Intent Detection

The intent detection model recognizes:
  • investigar (research)
  • clima (weather/climate)
  • conversacion_ai (AI conversation)

Build docs developers (and LLMs) love