ODrivetool Install on M1 Mac (Apple silicon)

I recently upgraded my mac from a 2013 intel based system to a 2021 M1 apple silicon-based system.

I was kinda able to keep limping along with old version of things installed via python and homebrew but it got to the point that I needed to migrate to stuff that fit the architecture. After lots of finagling was able to get compilation of ODrive firmware working with tup, though it involved downloading my own version of osxFuse and putting it in the path.

However, I have not been able to get odrivetool to install. I have tried both Python 3.8.12 and 3.10.2 (version control being done with pyenv) with the following command:

python -m pip install --upgrade odrive

Though the formatting of the errors is slightly different depending on the version it is the same base problem - libfibre is not supported.

  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  Ă— python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/tmp/pip-install-8erquy61/odrive_7396b7120099451893815d1fd63e8035/setup.py", line 61, in <module>
          import odrive.version
        File "/private/tmp/pip-install-8erquy61/odrive_7396b7120099451893815d1fd63e8035/odrive/__init__.py", line 9, in <module>
          import fibre
        File "/private/tmp/pip-install-8erquy61/odrive_7396b7120099451893815d1fd63e8035/odrive/pyfibre/fibre/__init__.py", line 4, in <module>
          from .libfibre import Domain, ObjectLostError
        File "/private/tmp/pip-install-8erquy61/odrive_7396b7120099451893815d1fd63e8035/odrive/pyfibre/fibre/libfibre.py", line 53, in <module>
          raise ModuleNotFoundError("libfibre is not supported on your platform ({} {}). {}".format(*system_desc, instructions))
      ModuleNotFoundError: libfibre is not supported on your platform (Darwin arm64). Go to https://github.com/samuelsadok/fibre-cpp for instructions on how to compile libfibre. Once you have compiled it, add it to this folder.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Ă— Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.

I have cloned the repo at the link (GitHub - samuelsadok/fibre-cpp: C++ implementation of Fibre) and followed the rather simple steps to build, but they don’t work. When trying to run make I get this error:

Makefile:25: *** commands commence before first target. Stop.

Again I have played around with various settings and brew installs as I feel like it should be something simple. But have yet to get it working so any ideas are appreciated. Should I keep figuring out how to get fibre-cpp to compile? Is there some easier way to get odrivetool working on an M1 mac that I am missing?

(I have also opened an issue on the fibre-cpp repo as the issue could easily just be there as well.

2 Likes

I ran into this issue as well and was able to do it this way:

  1. Select Terminal.app in the /Applications/Utilities folder and press Cmd+I
  2. Enable “Open using Rosetta” in the Info panel
  3. Open Terminal and follow the usual odrivetool installation routine

After installing it you can uncheck “Open using Rosetta” if desired, and it should still run

3 Likes

Yeah, we’re having some libfibre issues with M1 macs. I’ll let Samuel know.

1 Like

Thanks for the tips here, it would be great to get it up and working easily on an M1 mac. But for now here are the steps that I took to get things working.

Followed this guide on how to have both arm64 and x86 versions of homebrew installed at the same time. Then used pyenv and this guide to have the ability to switch between arm64 and x86 versions of python.

I found it was easier to set up two versions of terminal, one that is always arm64 and one that is always x86, otherwise, some things were finding the wrong version when trying to install/build. With this setup, I simply switched to an x86 version of python 3.8 in the x86 terminal and then was able to install odrivetool. And now that it is installed it seems that it can run from either version of terminal as long as an x86 version of python is used.

If it helps anyone, here is I added to my .zshrc to properly set the path depending on which version of terminal I open.

# HOMEBREW
alias brew86='arch -x86_64 /usr/local/homebrew/bin/brew'
alias brew='arch -arm64e /opt/homebrew/bin/brew'
alias nano=/opt/homebrew/bin/nano

# Set path depending on architecture
arch_name="$(uname -m)"
if [ "${arch_name}" = "arm64" ]; then
  export PATH="$(brew --prefix)/bin:$PATH"
  export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib"
  export CPATH="$CPATH:$(brew --prefix)/include"
  export C_INCLUDE_PATH="$C_INCLUDE_PATH:$(brew --prefix)/include"
  export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:$(brew --prefix)/include"
elif [ "${arch_name}" = "x86_64" ]; then
  #needs to have both brew locations in order to use same install of pyenv
  export PATH="$(brew86 --prefix)/bin:$(brew --prefix)/bin:$PATH"
  export LIBRARY_PATH="$LIBRARY_PATH:$(brew86 --prefix)/lib"
  export CPATH="$CPATH:$(brew86 --prefix)/include"
  export C_INCLUDE_PATH="$C_INCLUDE_PATH:$(brew86 --prefix)/include"
  export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:$(brew86 --prefix)/include"
else
  echo "Unexpected architecture: ${arch_name}"
fi

# Python settings - using pyenv
PYENV_ROOT=~/.pyenv
export PATH=$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi

alias pyenv86='arch -x86_64 pyenv'

The exact settings may be different on someone else’s machine depending on what the default paths are and where different things are installed.

1 Like

Hello,

I ran into this issue as well during installation and I must admit that I am on the “follow instructions exactly and hope they work” end of the Terminal-user spectrum.

I changed Terminal to launch with Rosetta but I got the error “ModuleNotFoundError: libfibre is not supported on your platform (Darwin arm64). Go to GitHub - samuelsadok/fibre-cpp at devel for instructions on how to compile libfibre. Once you have compiled it, add it to this folder.”

Unfortunately I don’t know what to do from here. Am I better off trying to do this on my Windows PC?

Edit: Flawless installation on my PC so I guess I’ve answered my own question. Hopefully the M1 issues are resolved because it would be much nicer to have a mobile device to configure my Drives.

1 Like

Yeah, it is much easier on Windows right now.

I don’t remember exactly which changes fixed what compilation problems, but I think the issue with libfibre goes away once the correct version of python is installed and running in the x86 version of terminal. This is definitely a process that takes a bit of a deeper knowledge of terminal and how python works on mac.

It would be a great improvement to have things running smoothly on M1 Macs.

Today we finally released odrivetool 0.6.1 with native support for Apple Silicon.

(as a side note: you could actually also run older versions in translation mode with arch -x86_64 odrivetool)

2 Likes