# Installation Error "zsh: illegal hardware instruction"

**URL:** <https://discuss.bayesflow.org/t/installation-error-zsh-illegal-hardware-instruction/56>\
**Category:** General\
**Created:** [February 2, 2024, 10:34am UTC](https://discuss.bayesflow.org/t/installation-error-zsh-illegal-hardware-instruction/56 "2024-02-02T10:34:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eodol](https://avatars.discourse-cdn.com/v4/letter/e/3ab097/32.png) [@eodol](https://discuss.bayesflow.org/u/eodol)\
**Post date:** [February 2, 2024, 10:34am UTC](https://discuss.bayesflow.org/t/installation-error-zsh-illegal-hardware-instruction/56/1 "2024-02-02T10:34:45Z")

</div>

If normal installation fails for MacOS there may be an issue in the dependencies.  
During my installation process I ran into the following problems:  
- error could not build “grpcio” wheels  
- xcrun error: invalid developer path  
 → My xcode was not up to date  
 → FIX: $ xcode-select --install  
 → Found here  
- [xcrun: error: invalid active devel… | Apple Developer Forums](https://forums.developer.apple.com/forums/thread/673827)  
- [Add instruction for building on macOS with M1 chip by Alyetama · Pull Request #30316 · grpc/grpc · GitHub](https://github.com/grpc/grpc/pull/30316)

Once I got that sorted, everything was installed but upon running in python

> import bayesflow as bf

I got the error:  
“zsh: illegal hardware instruction”  
This is a known error for tensorflow in M1 Chips. The way I got around this was following  
this YouTube tutorial ([https://www.youtube.com/watch?v=WFIZn6titnc](https://www.youtube.com/watch?v=WFIZn6titnc)) whose steps are abbreviated below.

Exact steps

1. Download Miniforge  
1.1 Go to: [GitHub - conda-forge/miniforge: A conda-forge distribution.](https://github.com/conda-forge/miniforge?tab=readme-ov-file)  
1.2 Click to download current MacOS arm Miniforge file  
1.3 Find file name in Downloads folder and copy it  
/Users/username/Downloads/Miniforge3-MacOSX-arm64.sh  
1.4 Change file permissions to allow execution  
` $ chmod +x /Users/username/Downloads/Miniforge3-MacOSX-arm64.sh`  
1.5 Execute file

`$ sh /Users/username/Downloads/Miniforge3-MacOSX-arm64.sh`

1. Activate Miniforge  
` $ source ~/miniforge3/bin/activate`
2. Install tensorflow dependencies for apple  
` $conda install -c apple tensorflow-deps`
3. Check that tensorflow is not already installed  
`$ python -m pip uninstall tensorflow-macos`
4. Create a conda environment  
`$ conda create --name bayes2`
5. Activate the environment  
` $ conda activate bayes2`
6. Install dependencies and tensorflow into the environment

```auto
$ conda install -c apple tensorflow-deps
    $ pip install tensorflow-macos

```

1. Install bayesflow as normal  
`$ pip install bayesflow`

---

<div class="post-metadata">

**Author:** ![marvinschmitt](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.bayesflow.org/marvinschmitt/32/98_2.png) [@marvinschmitt](https://discuss.bayesflow.org/u/marvinschmitt)\
**Post date:** [February 2, 2024, 10:40am UTC](https://discuss.bayesflow.org/t/installation-error-zsh-illegal-hardware-instruction/56/2 "2024-02-02T10:40:52Z")

</div>

Welcome to the BayesFlow Forums!

Thanks for sharing your solution to this issue. I’m sure that will help others who encounter the same problems at some point.

Cheers!
