Anyone able to install trax on an Apple Silicon, M1 mac?

Any pointers would be appreciated. After too many hours I finally got jaxlib to install with miniforge after watching this (Mac M1 Monterey Installing Miniforge and Anaconda/Miniconda Side-by-Side - YouTube), but no luck yet with trax.

I have not tried trax, but went through the process with other libs for other deeplearning courses. Are you running the Apple M1-specific version of tensorflow?

Not yet, haven’t installed tensorflow on this machine at all

I just followed this tutorial to install the HuggingFace transformers library for Course 4, Week 3 ungraded labs. In the process, I installed tensorflow for the Apple Silicon, M1 mac: From Zero to Transformers on Apple M1 Chip | by Alfonso Farruggia | Medium

Haven’t tried again to install trax, however.

Just tried installing trax again with no success. With miniforge on an environment where tensorflow runs:

 conda install trax

yields

Collecting

g package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - trax

Current channels:

  - https://conda.anaconda.org/conda-forge/osx-arm64
  - https://conda.anaconda.org/conda-forge/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

Then

pip3 install trax==1.3.9

yields


Collecting trax==1.3.9
  Using cached trax-1.3.9-py2.py3-none-any.whl (629 kB)
Requirement already satisfied: absl-py in /Users/myuser/miniforgeenvs/tensorflowenv/lib/python3.9/site-packages (from trax==1.3.9) (1.0.0)
Collecting matplotlib
  Downloading matplotlib-3.5.1-cp39-cp39-macosx_11_0_arm64.whl (7.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.2/7.2 MB 9.3 MB/s eta 0:00:00
Collecting jaxlib
  Downloading jaxlib-0.1.76-cp39-none-macosx_11_0_arm64.whl (57.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.3/57.3 MB 19.2 MB/s eta 0:00:00
Requirement already satisfied: six in /Users/myuser/miniforgeenvs/tensorflowenv/lib/python3.9/site-packages (from trax==1.3.9) (1.15.0)
Collecting tensorflow-datasets
  Downloading tensorflow_datasets-4.5.2-py3-none-any.whl (4.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 26.4 MB/s eta 0:00:00
Collecting jax
  Downloading jax-0.2.28.tar.gz (887 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 887.3/887.3 KB 20.6 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting funcsigs
  Using cached funcsigs-1.0.2-py2.py3-none-any.whl (17 kB)
Requirement already satisfied: numpy in /Users/myuser/miniforgeenvs/tensorflowenv/lib/python3.9/site-packages (from trax==1.3.9) (1.21.5)
Collecting gym
  Using cached gym-0.21.0-py3-none-any.whl
Collecting t5
  Using cached t5-0.9.3-py3-none-any.whl (153 kB)
Collecting psutil
  Using cached psutil-5.9.0.tar.gz (478 kB)
  Preparing metadata (setup.py) ... done
Collecting gin-config
  Using cached gin_config-0.5.0-py3-none-any.whl (61 kB)
Requirement already satisfied: scipy in /Users/myuser/miniforgeenvs/tensorflowenv/lib/python3.9/site-packages (from trax==1.3.9) (1.7.3)
ERROR: Could not find a version that satisfies the requirement tensorflow-text (from trax) (from versions: none)
ERROR: No matching distribution found for tensorflow-text

looks like this continues to be a problem for everyone. some people are trying to compile their own, but that doesn’t seem straightforward at all…

opened ~4 weeks ago

I got jaxand jaxlib on my M1 mac but no joy with tensorflow-text or trax.

UPDATE: got tensorflow-text installed in a python 3.8 virtual env

tensorflow-deps           2.8.0                         0    apple
tensorflow-hub            0.12.0                   pypi_0    pypi
tensorflow-macos          2.8.0                    pypi_0    pypi
tensorflow-metal          0.4.0                    pypi_0    pypi
tensorflow-text           2.8.1                    pypi_0    pypi

still no joy on trax

Yes I was finally able to install TRAX on my M1 mac!
First I installed Tensorflow-text - using the correct version to match my tensorflow installation and the python version i have installed.
After I installed that - trax installed easily and error free!
You can find the versions for M1 for tensorflow and tensorflow addons below!

I’ve created a requirements.txt to fix problems with…pretty old packages used by the notebooks in the course:

Not sure I’ve dealt with all the issues but at least it works with C3_W1 assignment notebook.

2 Likes

I realize this is an old thread, and my M1 is already something of a relic. However, for anyone coming along this trail, the requirements.txt provided above was a big help, so thanks @Jeongho_Jang
Still, in August 2024 I needed to make a few changes in order to get this to run.

The suggested level of seqio is <= 0.0.16 but this lead to some incompatibilities for me further down the dependency ladder in clu. Resolved by using seqio==0.0.8

Additionally, I had to downlevel from default for two packages:

numpy==1.26.0
scipy==1.11.3

Here are the key players that enabled me to successfully run the (old?) trax-based code locally on arm64 / Apple M1

tensorboard               2.8.0 
tensorflow-datasets       4.9.3
tensorflow-macos          2.8.0
tensorflow-metadata       1.15.0
tensorflow-text           2.8.2

keras                     2.8.0
keras-preprocessing       1.1.2
tf-keras                  2.15.0

jax                       0.2.28
jaxlib                    0.1.76

ipython                   8.18.1
python                    3.9.19

trax                      1.3.9
1 Like