arbitragelab icon indicating copy to clipboard operation
arbitragelab copied to clipboard

Tensorflow issue on MacOS M3

Open ben9809 opened this issue 2 months ago • 1 comments

  • 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:

  1. 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
  1. 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.

ben9809 avatar Apr 17 '24 10:04 ben9809

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

ben9809 avatar May 02 '24 18:05 ben9809