Skip to content

Instantly share code, notes, and snippets.

@simonprovost
Last active May 28, 2023 16:48
Show Gist options
  • Save simonprovost/051952533680026b67fa58c3552b8a7b to your computer and use it in GitHub Desktop.
Save simonprovost/051952533680026b67fa58c3552b8a7b to your computer and use it in GitHub Desktop.
How to install Auto-Sklearn on Mac OS (Big sur version: ✅)
#Auto-Sklearn on BigSur OSX 🖥
On the installation guide for Auto-Sklearn, the authors state: "We currently do not know if auto-sklearn works on OSX"
(Auto-Sklearn, 2021). However, there are a few steps to take that are not clear on Github/Stack, so I decided to compile
a list of those solutions and make it work for the most recent stable version of OSX (MacOS Big Sur 11.4 (20F71)).
Please feel free to follow those instructions and have fun with Auto-Sklearn. Additionally, @auto-sklearn,
if you find this solution interesting, please share the link somewhere on the installation guide.
# Contribution 👍
Please add a comment to this gist if you see any improvements that can help others, for the sake of the Apple community
and Auto-ML tools.
# The procedure for installing Auto-Sklearn is as follows 🪜
⚠️ Note: We consider that you already have acquired Python3.x. ⚠️
1️⃣ Installation of swig3:
> brew install swig@3
> brew link swig@3
2️⃣ Installation of xgboost:
> cd /tmp
> git clone --recursive https://github.com/dmlc/xgboost
***
2.1) Installation of GCC:
> brew install gcc
Or use the conda:
> conda create -n bayes
> conda activate bayes
> conda install gcc ⚠️(if not found refers to: https://anaconda.org/conda-forge/gcc)⚠️
***
> cd xgboost ; cp make/minimum.mk ./config.mk ; make -j4
> cd python-package
> sudo python setup.py install ⚠️ or if you are using python3 ⚠️ sudo python3 setup.py install
3️⃣ Installation of Auto-Sklearn:
> pip install auto-sklearn ⚠️ or if you are using pip3 ⚠️ pip3 install auto-sklearn
⛔️ If there are any errors, please refer to the following information gathered from Stackoverflow and other website.
After the completion of the 3.1 or 3.2 problem: install again auto-sklearn (step above): > pip(3) instal auto-sklearn
3.1) `XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh
in root path?`
> cp [path_to_libxgboost.dylib] /Users/...../.conda/envs/untitled/xgboost/
List of candidates:
- /private/var/folders/xw/cvs2qk9d77vc8fgn7zyvp84sqjlg4_/T/pip-install-25jfq24s/xgboost/xgboost/libxgboost.dylib
- /private/var/folders/xw/cvs2qk9d77vc8fgn7zyvp84sqjlg4_/T/pip-install-25jfq24s/xgboost/xgboost/../../lib/libxgboost.dylib
- /private/var/folders/xw/cvs2qk9d77vc8fgn7zyvp84sqjlg4_/T/pip-install-25jfq24s/xgboost/xgboost/./lib/libxgboost.dylib
- /Users/..../.conda/envs/untitled/xgboost/libxgboost.dylib
3.2) `Manually install pyrfr`
pyrfr == 0.6.1, Downloadhttps://pypi.python.org/pypi/pyrfr/0.6.1
After the above-mentioned extract the packet download, modify after extracting installation file setup.py
extra_compile_args = ['-O2', '-std=c++11']
extra_compile_args = ['-O2', '-std=c++11', '-stdlib=libc++', '-mmacosx-version-min=10.7']
> cd pyrfr-0.6.1/
> python setup.py install / or if you are using python3 / python3 setup.py install
> brew link pcre
🧪 Time to test if Auto-Sklearn works on your machine 🧪
Please refer to this snippet and run it on your favourite terminal as a normal py file:
https://pastebin.com/7BXXwSkY
@eliwoods
Copy link

eliwoods commented Jul 21, 2022

The following worked for installing auto-sklearn==0.14.7 on macOS 12.2.1 running on Apple Silicon :

$ brew install swig
$ brew link swig
$ pip install auto-sklearn

I was able to run the classifier example with a small modification of setting memory_limit=None in the AutoSklearnClassifier.__init__ method. The fit method used a small amount of memory while running, not totally sure why I was getting an error, but at least it is working locally :)

A couple of notes:

  • gcc (clang-1300.0.27.3) was already installed via Command Line Tools
  • swig@3 is unsupported and deprecated, hence installing from the non-versioned formula
  • The latest version of auto-sklearn does not requires xgboost, so no need to manually install it

@TomPham97
Copy link

@eliwoods your recommendations work for my MacOS 12.5.1 Intel Core i7 as well!

@simonprovost
Copy link
Author

Wonderful guys thanks for the comments, it will help many others 🤝

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment