How to install fastai on Mac m1
I am trying to install fastai (version 1.0.61) on my new Mac m1.
I first tried:
pip install fastai==1.0.61

This gave me an error that I didn't have cmake, so I installed cmake successfully with brew install cmake.
Then, rerunning the fastai install command, I get this error:
Collecting fastai==1.0.61
  Using cached fastai-1.0.61-py3-none-any.whl (239 kB)
Collecting fastprogress&gt;=0.2.1
  Using cached fastprogress-1.0.2-py3-none-any.whl (12 kB)
Collecting numexpr
  Using cached numexpr-2.8.1-cp310-cp310-macosx_11_0_arm64.whl
Collecting scipy
  Using cached scipy-1.8.0-cp310-cp310-macosx_12_0_arm64.whl (28.7 MB)
Collecting pyyaml
  Using cached PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl (173 kB)
Collecting bottleneck
  Using cached Bottleneck-1.3.4-cp310-cp310-macosx_11_0_arm64.whl
Collecting matplotlib
  Using cached matplotlib-3.5.1-cp310-cp310-macosx_11_0_arm64.whl (7.2 MB)
Collecting pynvx&gt;=1.0.0
  Using cached pynvx-1.0.0.tar.gz (150 kB)
  Preparing metadata (setup.py) ... done
Collecting beautifulsoup4
  Using cached beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)
Collecting nvidia-ml-py3
  Using cached nvidia_ml_py3-7.352.0-py3-none-any.whl
Requirement already satisfied: requests in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from fastai==1.0.61) (2.27.1)
Requirement already satisfied: Pillow in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from fastai==1.0.61) (9.1.0)
Requirement already satisfied: pandas in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from fastai==1.0.61) (1.4.2)
Collecting packaging
  Using cached packaging-21.3-py3-none-any.whl (40 kB)
Requirement already satisfied: torch&gt;=1.0.0 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from fastai==1.0.61) (1.11.0)
Requirement already satisfied: torchvision in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from fastai==1.0.61) (0.12.0)
Requirement already satisfied: numpy&gt;=1.15 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from fastai==1.0.61) (1.22.3)
Requirement already satisfied: typing-extensions in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from torch&gt;=1.0.0-&gt;fastai==1.0.61) (4.2.0)
Collecting soupsieve&gt;1.2
  Using cached soupsieve-2.3.2.post1-py3-none-any.whl (37 kB)
Collecting pyparsing&gt;=2.2.1
  Using cached pyparsing-3.0.8-py3-none-any.whl (98 kB)
Collecting kiwisolver&gt;=1.0.1
  Using cached kiwisolver-1.4.2-cp310-cp310-macosx_11_0_arm64.whl (63 kB)
Requirement already satisfied: python-dateutil&gt;=2.7 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from matplotlib-&gt;fastai==1.0.61) (2.8.2)
Collecting cycler&gt;=0.10
  Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting fonttools&gt;=4.22.0
  Using cached fonttools-4.33.3-py3-none-any.whl (930 kB)
Requirement already satisfied: pytz&gt;=2020.1 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from pandas-&gt;fastai==1.0.61) (2022.1)
Requirement already satisfied: certifi&gt;=2017.4.17 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from requests-&gt;fastai==1.0.61) (2021.10.8)
Requirement already satisfied: idna&lt;4,&gt;=2.5 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from requests-&gt;fastai==1.0.61) (3.3)
Requirement already satisfied: charset-normalizer~=2.0.0 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from requests-&gt;fastai==1.0.61) (2.0.12)
Requirement already satisfied: urllib3&lt;1.27,&gt;=1.21.1 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from requests-&gt;fastai==1.0.61) (1.26.9)
Requirement already satisfied: six&gt;=1.5 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from python-dateutil&gt;=2.7-&gt;matplotlib-&gt;fastai==1.0.61) (1.16.0)
Building wheels for collected packages: pynvx
  Building wheel for pynvx (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─&gt; [78 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-11.0-arm64-cpython-310
      creating build/lib.macosx-11.0-arm64-cpython-310/pynvx
      copying pynvx/pynvml.py -&gt; build/lib.macosx-11.0-arm64-cpython-310/pynvx
      copying pynvx/__init__.py -&gt; build/lib.macosx-11.0-arm64-cpython-310/pynvx
      running build_ext
      -- The C compiler identification is AppleClang 13.1.6.13160021
      -- The CXX compiler identification is AppleClang 13.1.6.13160021
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Found PythonInterp: /Users/connoreaton/miniforge3/envs/spaff_nlp/bin/python3.10 (found version &quot;3.10.4&quot;)
      -- Found PythonLibs: /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/libpython3.10.dylib
      -- Performing Test HAS_CPP14_FLAG
      -- Performing Test HAS_CPP14_FLAG - Success
      -- pybind11 v2.3.dev0
      -- Performing Test HAS_FLTO
      -- Performing Test HAS_FLTO - Success
      -- LTO enabled
      CMake Error at /opt/homebrew/Cellar/cmake/3.23.1/share/cmake/Modules/FindCUDA.cmake:859 (message):
        Specify CUDA_TOOLKIT_ROOT_DIR
      Call Stack (most recent call first):
        CMakeLists.txt:8 (find_package)
      
      
      -- Configuring incomplete, errors occurred!
      See also &quot;/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/build/temp.macosx-11.0-arm64-cpython-310/CMakeFiles/CMakeOutput.log&quot;.
      See also &quot;/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/build/temp.macosx-11.0-arm64-cpython-310/CMakeFiles/CMakeError.log&quot;.
      Traceback (most recent call last):
        File &quot;&lt;string&gt;&quot;, line 2, in &lt;module&gt;
        File &quot;&lt;pip-setuptools-caller&gt;&quot;, line 34, in &lt;module&gt;
        File &quot;/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/setup.py&quot;, line 68, in &lt;module&gt;
          setup(
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/__init__.py&quot;, line 87, in setup
          return distutils.core.setup(**attrs)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/core.py&quot;, line 148, in setup
          return run_commands(dist)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/core.py&quot;, line 163, in run_commands
          dist.run_commands()
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py&quot;, line 967, in run_commands
          self.run_command(cmd)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/dist.py&quot;, line 1214, in run_command
          super().run_command(command)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py&quot;, line 986, in run_command
          cmd_obj.run()
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/wheel/bdist_wheel.py&quot;, line 299, in run
          self.run_command('build')
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/cmd.py&quot;, line 313, in run_command
          self.distribution.run_command(command)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/dist.py&quot;, line 1214, in run_command
          super().run_command(command)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py&quot;, line 986, in run_command
          cmd_obj.run()
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/command/build.py&quot;, line 136, in run
          self.run_command(cmd_name)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/cmd.py&quot;, line 313, in run_command
          self.distribution.run_command(command)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/dist.py&quot;, line 1214, in run_command
          super().run_command(command)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py&quot;, line 986, in run_command
          cmd_obj.run()
        File &quot;/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/setup.py&quot;, line 32, in run
          self.build_extension(ext)
        File &quot;/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/setup.py&quot;, line 56, in build_extension
          subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/subprocess.py&quot;, line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/build/lib.macosx-11.0-arm64-cpython-310', '-DPYTHON_EXECUTABLE=/Users/connoreaton/miniforge3/envs/spaff_nlp/bin/python3.10', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pynvx
  Running setup.py clean for pynvx
Failed to build pynvx
Installing collected packages: pynvx, nvidia-ml-py3, soupsieve, scipy, pyyaml, pyparsing, kiwisolver, fonttools, fastprogress, cycler, bottleneck, packaging, beautifulsoup4, numexpr, matplotlib, fastai
  Running setup.py install for pynvx ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for pynvx did not run successfully.
  │ exit code: 1
  ╰─&gt; [82 lines of output]
      running install
      /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.macosx-11.0-arm64-cpython-310
      creating build/lib.macosx-11.0-arm64-cpython-310/pynvx
      copying pynvx/pynvml.py -&gt; build/lib.macosx-11.0-arm64-cpython-310/pynvx
      copying pynvx/__init__.py -&gt; build/lib.macosx-11.0-arm64-cpython-310/pynvx
      running build_ext
      -- The C compiler identification is AppleClang 13.1.6.13160021
      -- The CXX compiler identification is AppleClang 13.1.6.13160021
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Found PythonInterp: /Users/connoreaton/miniforge3/envs/spaff_nlp/bin/python3.10 (found version &quot;3.10.4&quot;)
      -- Found PythonLibs: /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/libpython3.10.dylib
      -- Performing Test HAS_CPP14_FLAG
      -- Performing Test HAS_CPP14_FLAG - Success
      -- pybind11 v2.3.dev0
      -- Performing Test HAS_FLTO
      -- Performing Test HAS_FLTO - Success
      -- LTO enabled
      CMake Error at /opt/homebrew/Cellar/cmake/3.23.1/share/cmake/Modules/FindCUDA.cmake:859 (message):
        Specify CUDA_TOOLKIT_ROOT_DIR
      Call Stack (most recent call first):
        CMakeLists.txt:8 (find_package)
      
      
      -- Configuring incomplete, errors occurred!
      See also &quot;/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/build/temp.macosx-11.0-arm64-cpython-310/CMakeFiles/CMakeOutput.log&quot;.
      See also &quot;/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/build/temp.macosx-11.0-arm64-cpython-310/CMakeFiles/CMakeError.log&quot;.
      Traceback (most recent call last):
        File &quot;&lt;string&gt;&quot;, line 2, in &lt;module&gt;
        File &quot;&lt;pip-setuptools-caller&gt;&quot;, line 34, in &lt;module&gt;
        File &quot;/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/setup.py&quot;, line 68, in &lt;module&gt;
          setup(
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/__init__.py&quot;, line 87, in setup
          return distutils.core.setup(**attrs)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/core.py&quot;, line 148, in setup
          return run_commands(dist)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/core.py&quot;, line 163, in run_commands
          dist.run_commands()
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py&quot;, line 967, in run_commands
          self.run_command(cmd)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/dist.py&quot;, line 1214, in run_command
          super().run_command(command)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py&quot;, line 986, in run_command
          cmd_obj.run()
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/command/install.py&quot;, line 68, in run
          return orig.install.run(self)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/command/install.py&quot;, line 670, in run
          self.run_command('build')
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/cmd.py&quot;, line 313, in run_command
          self.distribution.run_command(command)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/dist.py&quot;, line 1214, in run_command
          super().run_command(command)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py&quot;, line 986, in run_command
          cmd_obj.run()
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/command/build.py&quot;, line 136, in run
          self.run_command(cmd_name)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/cmd.py&quot;, line 313, in run_command
          self.distribution.run_command(command)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/dist.py&quot;, line 1214, in run_command
          super().run_command(command)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py&quot;, line 986, in run_command
          cmd_obj.run()
        File &quot;/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/setup.py&quot;, line 32, in run
          self.build_extension(ext)
        File &quot;/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/setup.py&quot;, line 56, in build_extension
          subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
        File &quot;/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/subprocess.py&quot;, line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/build/lib.macosx-11.0-arm64-cpython-310', '-DPYTHON_EXECUTABLE=/Users/connoreaton/miniforge3/envs/spaff_nlp/bin/python3.10', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─&gt; pynvx

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I am clearly unable to install pynvx. This makes sense because pynvx deals with CUDA, which apparently Mac M1 cannot support. I tried the CPU only build install documentation from fastai here:
https://fastai1.fast.ai/install.html
But I get the same error.
What can I do? If I can't train models locally that's okay, but I want to at least be able to load models and predict with them.

fastai seems to need pyenv which needs CUDA to work. CUDA is available only on Nvidia GPUs and the MAC M1 has a completly differente SOC with no Nvidia GPU
You can read the actual error
CMake Error at /opt/homebrew/Cellar/cmake/3.23.1/share/cmake/Modules/FindCUDA.cmake:859

