Installation Guide
Prerequisites
Python 3.9 or later - Download from https://www.python.org/downloads/
pip - Included with Python 3.4+
An Xplain server instance - Required for connecting and running analyses
Install from PyPI
pip install xplain
Install from Source
For development or to get the latest version:
git clone <repository-url>
cd xplainpy
# Create and activate a virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windows
# Install in editable mode
pip install -e .
Optional Dependencies
MCP Server Integration (for Claude AI integration):
pip install -e ".[mcp]"
Development/Testing:
pip install -e ".[dev]"
Core Dependencies
The following packages are installed automatically:
pandas- Data manipulation and analysisnumpy- Numerical computingrequests- HTTP client for Web API callstreelib- Tree data structure and visualizationpatsy- Statistical formula APIstatsmodels- Statistical modelingpyecharts- Data visualizationpydantic- Data validation
Verify Installation
import xplain
print(xplain.__version__)
Recommended IDE and Tools
JupyterLab - Interactive notebooks: https://jupyter.org/install
PyCharm - Full-featured Python IDE: https://www.jetbrains.com/pycharm/
VS Code - Lightweight editor with Python support: https://code.visualstudio.com/
Configuration and Credentials
After installation, configure credentials for secure authentication.
Option 1: Config File (Recommended)
Create ~/.xplainpyrc:
{
"url": "http://localhost:8080",
"user": "myuser",
"password": "mypassword"
}
Secure the file:
chmod 600 ~/.xplainpyrc
Option 2: Environment Variables
export XPLAIN_URL="http://localhost:8080"
export XPLAIN_USER="myuser"
export XPLAIN_PASSWORD="mypassword"
Multiple Environments:
For managing credentials across multiple environments (dev, staging, production), see the complete Authentication & Credential Management guide.
Legacy Environment Variables
These are still supported for backward compatibility:
export xplain_url="http://myhost:8080"
export xplain_session_id="30FA4025AC5AE68852D803838FAA503D"