Skip to content

๐Ÿ“ฆ Installation Guide

Install KerasFactory and get your development environment ready for tabular modeling with Keras 3.

๐ŸŽฏ Quick Install

1
pip install kerasfactory

๐Ÿ”ง Requirements

Python Version

  • Python 3.8+ (recommended: Python 3.10+)

Core Dependencies

  • Keras 3.0+ (TensorFlow backend recommended for testing)
  • NumPy 1.21+
  • Pandas 1.3+ (for data handling or tf.DataSet if you have tensorflow)

Optional Dependencies

  • Matplotlib (for visualization)
  • Seaborn (for statistical plots)
  • Scikit-learn (for preprocessing utilities)

๐Ÿš€ Installation Methods

1
2
3
4
5
6
7
8
# Latest stable release
pip install kerasfactory

# With optional dependencies
pip install kerasfactory[full]

# Specific version
pip install kerasfactory==1.0.0

2. Development Install

1
2
3
4
5
6
7
8
9
# Clone the repository
git clone https://github.com/UnicoLab/KerasFactory.git
cd KerasFactory

# Install in development mode
pip install -e .

# Install with development dependencies
pip install -e ".[dev]"

3. Conda Install

1
2
3
4
5
6
# Create a new environment
conda create -n kerasfactory python=3.10
conda activate kerasfactory

# Install KerasFactory
pip install kerasfactory

๐Ÿ” Verify Installation

Test your installation with this simple script:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
import keras
from kerasfactory.layers import TabularAttention

# Test basic import
print("โœ… KerasFactory imported successfully!")

# Test layer creation
layer = TabularAttention(num_heads=8, key_dim=64)
print("โœ… TabularAttention layer created!")

# Test with sample data
import numpy as np
x = np.random.random((32, 20))
output = layer(x)
print(f"โœ… Layer output shape: {output.shape}")

๐Ÿ› Troubleshooting

Common Issues

ImportError: No module named 'keras'

1
2
# Install Keras 3
pip install keras>=3.0.0

TensorFlow Backend Issues

1
2
3
4
5
# Install TensorFlow
pip install tensorflow>=2.13.0

# Or use JAX backend
pip install jax jaxlib

Memory Issues

1
2
3
4
5
# Set memory growth for TensorFlow
import tensorflow as tf
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
    tf.config.experimental.set_memory_growth(gpus[0], True)

Backend Configuration

KerasFactory works with multiple Keras backends:

1
2
3
4
5
6
7
8
9
# TensorFlow backend (default)
import os
os.environ['KERAS_BACKEND'] = 'tensorflow'

# JAX backend
os.environ['KERAS_BACKEND'] = 'jax'

# PyTorch backend
os.environ['KERAS_BACKEND'] = 'torch'

๐Ÿ“‹ System Requirements

Minimum Requirements

  • RAM: 4GB
  • Storage: 1GB free space
  • CPU: 2 cores
  • RAM: 8GB+
  • Storage: 5GB+ free space
  • CPU: 4+ cores
  • GPU: NVIDIA GPU with CUDA support (optional)

๐Ÿ”„ Updating KerasFactory

1
2
3
4
5
# Update to latest version
pip install --upgrade kerasfactory

# Check current version
python -c "import kerasfactory; print(kerasfactory.__version__)"

๐Ÿงช Testing Installation

Run the test suite to ensure everything works:

1
2
3
4
5
6
7
8
9
# Run basic tests
python -c "
import kerasfactory
from kerasfactory.layers import *
print('All layers imported successfully!')
"

# Run comprehensive tests (if available)
pytest tests/

๐Ÿ“š Next Steps

  1. Quick Start: Follow the Quick Start Guide
  2. Explore Layers: Check out the Layer Explorer
  3. Read Documentation: Browse the Layers section
  4. Try Examples: Run through the Examples

Installation complete! Ready to start building with KerasFactory? Head to the Quick Start Guide!