How to run / develop for Feast on M1 Macs
- Dominant language
- Python
- Stars
- 7.3k
- Forks
- 1.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 15
Description
## Overview
This guide summarizes how both end users and Feast developers can get their M1 Macs set up to use or develop for Feast. `pyenv` is used in this guide, but isn't absolutely necessary.
## Installation Guide
1. **Install pyenv**
[https://github.com/pyenv/pyenv#homebrew-in-macos](https://github.com/pyenv/pyenv#homebrew-in-macos)
2. **Install dependencies**
```bash
brew install xz protobuf openssl zlib
```
3. **Install Python**
(only tested with 3.8.12)
```bash
CFLAGS="-I$(brew --prefix xz)/include" LDFLAGS="-L$(brew --prefix xz)/lib" pyenv install 3.8.12
```
4. Upgrade Pip and install dependencies
```bash
pip install --upgrade pip
pip install cryptography -U
export CFLAGS="-I$(brew --prefix protobuf)/include"
export LDFLAGS="-L$(brew --prefix protobuf)/lib"
# Please set the protobuf version below (we're hardcoding it to 3.17 here)
pip install protobuf==3.17 --force-reinstall --no-deps --install-option="--cpp_implementation"
```
You can stop here if you are just a Feast user (not a developer). At this point you should be able to `pip install feast`. Steps (5) and (6) are for developers only
5. Build and install Feast repository (run from Feast project root)
```bash
export LDFLAGS="-L$(brew --prefix freetds)/lib -L$(brew --prefix protobuf)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix openssl)/lib"
export CPPFLAGS="-I$(brew --prefix protobuf)/include -I$(brew --prefix zlib)/include"
export MYSQLCLIENT_LDFLAGS=$(pkg-config --libs mysqlclient)
export MYSQLCLIENT_CFLAGS=$(pkg-config --cflags mysqlclient)
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1
pip install pip-tools
brew install mysql
make install-python-ci-dependencies PYTHON=3.8
```
6. Run Feast tests (all tests should pass)
```
FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 sdk/python/tests
```
## Problems & Solutions
**Problem**
```
Lack of _ctypes
```
**Solution**
[https://github.com/pyenv/pyenv/issues/1768#issuecomment-871602950](https://github.com/pyenv/pyenv/issues/1768#issuecomment-871602950)
**Problem**
```
Could not build wheels for cryptography, which is required to install pyproject.toml-based projects
```
**Solution**
```
pip install --upgrade pip
pip install cryptography -U
```
**Problem**
```
distutils.errors.DistutilsExecError: command 'clang' failed with exit status 1
```
**Solution**
```
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1
```
**Problem**
```
ImportError: cannot import name '_message' from 'google.protobuf.pyext' (/opt/homebrew/Caskroom/miniforge/base/envs/intel_py39/lib/python3.9/site-packages/google/protobuf/pyext/__init__.py)
```
**Solution**
```bash
brew install protobuf
export CFLAGS="-I$(brew --prefix protobuf)/include"
export LDFLAGS="-L$(brew --prefix protobuf)/lib"
# You need
pip install protobuf==3.17 --force-reinstall --no-deps --install-option="--cpp_implementation"
```
**Problem**
```bash
ModuleNotFoundError: No module named '_lzma'
```
**Solution**
```bash
brew install xz
CFLAGS="-I$(brew --prefix xz)/include" LDFLAGS="-L$(brew --prefix xz)/lib" pyenv install 3.9.4
```
Contributor guide
Assessment
This issue has not been assessed yet.