arbitragelab
arbitragelab copied to clipboard
Tensorflow issue on MacOS M3
- ArbitrageLab: development branch
- Python version:
3.8
- Operating System:
MacOS
Description
When I try to execute tests on a macOS M3 architecture there is a problem related to TensorFlow package that crashes the execution of the tests.
What I Did
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python -m pytest tests/
Error Message: zsh: illegal hardware instruction python -m pytest tests/
Expected behavior
The test suite should execute without any crashes, allowing for all tests to run to completion and report results.
Additional context
There is a way to resolve this issue if you are using Python 3.8. Here's a better approach to ensure compatibility with the macOS M3 architecture:
- Install conda for MacOS (https://conda.io/projects/conda/en/latest/user-guide/install/macos.html)
conda create -n arbitragelab python=3.8
conda activate arbitragelab
- Comment line 4 from requirements.txt (cvxpy package installation fails: https://stackoverflow.com/questions/73610748/how-to-install-cvxpy-on-mac-m1)
conda install -c conda-forge cvxpy #install cvxpy through conda
pip install -r requirements.txt
python -m pytest tests/
Following these steps, the issue related to the TensorFlow package is fixed. Consider that once the library supports Python 3.9 or later, this issue may not be present anymore.
After merging the development branch, it will be only necessary to install cvxpy through conda just for the Python versions 3.8 and 3.9