.. currentmodule:: tfts
This guide covers everything you need to install and set up TFTS (TensorFlow Time Series) for your environment.
The fastest way to install TFTS is using pip:
pip install tftsThis will install TFTS and its core dependencies.
- Minimum Requirements:
- Python 3.7 or higher
- 4GB RAM (8GB+ recommended)
- 2GB disk space
- Recommended:
- Python 3.8+
- 16GB RAM for training large models
- NVIDIA GPU with CUDA support (for GPU training)
- 5GB+ disk space (including datasets and model checkpoints)
TFTS requires the following core dependencies:
- Required:
tensorflow >= 2.4.0numpy >= 1.19.0pandas >= 1.1.0
- Optional but Recommended:
scikit-learn >= 0.24.0(for preprocessing)matplotlib >= 3.3.0(for visualization)seaborn >= 0.11.0(for advanced plotting)
Install the latest stable release from PyPI:
pip install tftsTo upgrade to the latest version:
pip install --upgrade tftsFor the latest development version, install from GitHub:
git clone https://github.com/LongxingTan/Time-series-prediction.git
cd Time-series-prediction
pip install -e .The -e flag installs in editable mode, allowing you to modify the source code.
If you plan to contribute or modify TFTS, install development dependencies:
git clone https://github.com/LongxingTan/Time-series-prediction.git
cd Time-series-prediction
pip install -e ".[dev]"This installs additional tools for testing, linting, and documentation.
TFTS provides a Docker image with all dependencies pre-installed:
Build the Docker Image:
docker build -f ./docker/Dockerfile -t tfts:latest .Run the Container:
docker run --rm -it \
--init \
--ipc=host \
--network=host \
--volume=$PWD:/app \
--gpus all \
tfts:latest /bin/bashFor CPU-only:
docker run --rm -it \
--init \
--volume=$PWD:/app \
tfts:latest /bin/bashFor GPU acceleration, install TensorFlow with CUDA support:
CUDA 11.2+ (Recommended):
pip install tensorflow[and-cuda]Manual CUDA Installation:
- Install CUDA Toolkit: https://developer.nvidia.com/cuda-downloads
- Install cuDNN: https://developer.nvidia.com/cudnn
- Install TensorFlow:
pip install tensorflow-gpu
pip install tftsVerify GPU Setup:
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))For macOS with Apple Silicon:
# Install tensorflow-metal for GPU acceleration
pip install tensorflow-macos tensorflow-metal
pip install tftsVerify Metal Support:
import tensorflow as tf
print(tf.config.list_physical_devices())For Google Cloud TPU:
pip install cloud-tpu-client
pip install tftsTPU Runtime Configuration:
import tensorflow as tf
resolver = tf.distribute.cluster_resolver.TPUClusterResolver()
tf.config.experimental_connect_to_cluster(resolver)
tf.tpu.experimental.initialize_tpu_system(resolver)Create an isolated conda environment for TFTS:
# Create environment
conda create -n tfts python=3.9
conda activate tfts
# Install dependencies
conda install tensorflow pandas numpy scikit-learn matplotlib
pip install tftsUsing Python's built-in venv:
# Create virtual environment
python -m venv tfts-env
# Activate (Linux/Mac)
source tfts-env/bin/activate
# Activate (Windows)
tfts-env\Scripts\activate
# Install TFTS
pip install tftsImportError: No module named 'tensorflow'
Solution: Install TensorFlow first:
pip install tensorflow>=2.4CUDA version mismatch
Solution: Ensure CUDA and cuDNN versions match TensorFlow requirements:
# Check TensorFlow CUDA requirement
python -c "import tensorflow as tf; print(tf.sysconfig.get_build_info())"Memory errors during installation
Solution: Install with no-cache option:
pip install --no-cache-dir tftsPermission denied on Linux/Mac
Solution: Use user installation:
pip install --user tfts- Windows:
- Use Anaconda/Miniconda for easier dependency management
- Install Microsoft Visual C++ Redistributable if needed
- Consider using WSL2 for Linux compatibility
- macOS:
- Install Xcode Command Line Tools:
xcode-select --install - Use Homebrew for system dependencies:
brew install python
- Install Xcode Command Line Tools:
- Linux:
- Install build essentials:
sudo apt-get install build-essential - For GPU: Install NVIDIA drivers and CUDA toolkit
- Install build essentials:
Check that TFTS is installed correctly:
import tfts
print(f"TFTS version: {tfts.__version__}")
# Check available models
from tfts import AutoConfig
models = ['seq2seq', 'transformer', 'informer', 'autoformer']
for model in models:
config = AutoConfig.for_model(model)
print(f"{model}: OK")Run the test suite to ensure everything works:
# Install test dependencies
pip install pytest pytest-cov
# Run tests
pytest tests/
# Run with coverage
pytest tests/ --cov=tftsRun a quick training test:
import tensorflow as tf
import tfts
from tfts import AutoConfig, AutoModel, KerasTrainer
# Generate sample data
train, valid = tfts.get_data('sine', train_length=24, predict_length=8)
# Create and train model
config = AutoConfig.for_model('seq2seq')
model = AutoModel.from_config(config, predict_sequence_length=8)
trainer = KerasTrainer(model)
trainer.train(train, valid, epochs=2)
print("✅ Installation successful!")Keep TFTS up to date with the latest features and bug fixes:
# Check current version
pip show tfts
# Update to latest version
pip install --upgrade tfts
# Update to specific version
pip install --upgrade tfts==1.3.0For bleeding-edge features, install from the development branch:
pip install git+https://github.com/LongxingTan/Time-series-prediction.git@masterTo remove TFTS:
pip uninstall tftsTo completely remove including dependencies:
pip uninstall tfts tensorflow pandas numpy scikit-learn matplotlibNow that you have TFTS installed:
- Quick Start: Try the :doc:`quickstart` tutorial
- Learn the Basics: Read :doc:`tutorials`
- Explore Models: Check :doc:`models` documentation
- Prepare Data: See :doc:`data_preparation` guide
- Train Models: Follow :doc:`training` best practices
If you encounter installation issues:
- 💬 Ask in GitHub Discussions
- 🐛 Report bugs in GitHub Issues