Skip to content

MacOS 12.2.1 Apple Silicon (M1 chip) with GPU acceleration

Peter Leonard edited this page Mar 11, 2022 · 6 revisions
  1. This was tested on macOS Monterey (12.2.1)

  2. Install Miniforge for Apple Silicon. (See project page for more info.)

  3. Create a new environment for pixplot:

conda create --name pixplot python=3.9

conda activate pixplot

  1. Install the required packages for Apple's support of Tensorflow on the M1 chip:

conda install -c apple tensorflow-deps

pip install tensorflow-macos tensorflow-metal

  1. Clone pixplot:

git clone https://github.com/YaleDHLab/pix-plot.git

  1. Adjust the install_requires section of setup.py to read as follows:
  install_requires=[
    'cmake',
    'Cython',
    'glob2',
    'h5py',
    'iiif-downloader',
    'numpy',
    'pointgrid>=0.0.2',
    'python-dateutil>=2.8.0',
    'scikit-learn',
    'scipy',
    'six',
    'tqdm',
    'umap-learn',
    'yale-dhlab-rasterfairy>=1.0.3',
    'yale-dhlab-keras-preprocessing>=1.1.1',
    'matplotlib'
  ],
  1. Fix Pillow:

pip install --force-reinstall https://files.pythonhosted.org/packages/34/4e/a491038f9bb13ea7f69874789d2cb69577eefb16724d678602f42222128f/Pillow-9.0.1-1-cp39-cp39-macosx_11_0_arm64.whl

  1. Install numba via conda, not pip:

conda install -c numba numba

  1. Run python setup.py install

  2. Optional steps past this point:

pip install image_datasets (a helper utility to easily grab pixplot-ready datasets)

  1. Get a sample dataset:

python

import image_datasets

image_datasets.oslomini.download()

(now exit python via quit() or CTRL+D)

  1. Test the installation:

time pixplot --images="datasets/oslomini/images/*.jpg" --metadata="datasets/oslomini/metadata/metadata.csv" --shuffle