Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify arm64 macOS (Apple Silicon) installation #89

Merged
merged 3 commits into from
Jan 31, 2023

Conversation

psobolewskiPhD
Copy link
Member

Description

This PR provides the basic update for installation on arm64 macOS (Apple Silicon).
pip install napari[all] doesn't work on this platform due to the lack of pyqt5 wheels on pypi (likewise with pyside2). As a result, I think we should just recommend conda and conda-forge. So this is what I've done here.
In the section regarding Qt backends, I clarify the above issue and note that if you provide the backend (e.g. via conda-forge) you can pip install napari.
I'm very open to suggestions for how to better handle that.

Type of change

  • Fixes or improves existing content
  • Adds new content page(s)
  • Fixes or improves workflow, documentation build or deployment

References

closes #43

Final checklist:

  • My PR is the minimum possible work for the desired functionality
  • I have commented my code, particularly in hard-to-understand areas
  • I have added alt text to new images included in this PR

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jan 15, 2023
@psobolewskiPhD
Copy link
Member Author

@Carreau I'm pretty sure I recall you using an Apple Silicon mac, not sure who else does, which is why I added you here to sanity check.

@GenevieveBuckley
Copy link
Contributor

@Carreau I'm pretty sure I recall you using an Apple Silicon mac, not sure who else does, which is why I added you here to sanity check.

I have an Apple Silicon mac, and yes, pip installation fails on it because of PyQt.

Full details:
Last login: Mon Jan 16 16:30:07 on ttys003
(base) genevieb@dyn-130-194-109-212 ~ % conda create -n test python=3.10 pip -y
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.14.0
  latest version: 22.11.1

Please update conda by running

    $ conda update -n base -c conda-forge conda



## Package Plan ##

  environment location: /Users/genevieb/mambaforge/envs/test

  added / updated specs:
    - pip
    - python=3.10


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    setuptools-66.0.0          |     pyhd8ed1ab_0         628 KB  conda-forge
    ------------------------------------------------------------
                                           Total:         628 KB

The following NEW packages will be INSTALLED:

  bzip2              conda-forge/osx-arm64::bzip2-1.0.8-h3422bc3_4
  ca-certificates    conda-forge/osx-arm64::ca-certificates-2022.12.7-h4653dfc_0
  libffi             conda-forge/osx-arm64::libffi-3.4.2-h3422bc3_5
  libsqlite          conda-forge/osx-arm64::libsqlite-3.40.0-h76d750c_0
  libzlib            conda-forge/osx-arm64::libzlib-1.2.13-h03a7124_4
  ncurses            conda-forge/osx-arm64::ncurses-6.3-h07bb92c_1
  openssl            conda-forge/osx-arm64::openssl-3.0.7-h03a7124_1
  pip                conda-forge/noarch::pip-22.3.1-pyhd8ed1ab_0
  python             conda-forge/osx-arm64::python-3.10.8-h3ba56d0_0_cpython
  readline           conda-forge/osx-arm64::readline-8.1.2-h46ed386_0
  setuptools         conda-forge/noarch::setuptools-66.0.0-pyhd8ed1ab_0
  tk                 conda-forge/osx-arm64::tk-8.6.12-he1e0b03_0
  tzdata             conda-forge/noarch::tzdata-2022g-h191b570_0
  wheel              conda-forge/noarch::wheel-0.38.4-pyhd8ed1ab_0
  xz                 conda-forge/osx-arm64::xz-5.2.6-h57fd34a_0



Downloading and Extracting Packages
setuptools-66.0.0    | 628 KB    | ##################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate test
#
# To deactivate an active environment, use
#
#     $ conda deactivate

Retrieving notices: ...working... done
(base) genevieb@dyn-130-194-109-212 ~ % conda activate test
(test) genevieb@dyn-130-194-109-212 ~ % which pip
/Users/genevieb/mambaforge/envs/test/bin/pip
(test) genevieb@dyn-130-194-109-212 ~ % pip install "napari[all]"
Collecting napari[all]
  Downloading napari-0.4.17-py3-none-any.whl (2.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.6/2.6 MB 44.5 MB/s eta 0:00:00
Collecting pandas>=1.3.0
  Using cached pandas-1.5.2-cp310-cp310-macosx_11_0_arm64.whl (10.8 MB)
Collecting psygnal>=0.3.4
  Using cached psygnal-0.7.0-py3-none-any.whl (48 kB)
Collecting superqt>=0.3.0
  Using cached superqt-0.4.1-py3-none-any.whl (63 kB)
Collecting imageio!=2.11.0,!=2.22.1,>=2.5.0
  Using cached imageio-2.24.0-py3-none-any.whl (3.4 MB)
Collecting tqdm>=4.56.0
  Using cached tqdm-4.64.1-py2.py3-none-any.whl (78 kB)
Collecting pydantic>=1.9.0
  Using cached pydantic-1.10.4-cp310-cp310-macosx_11_0_arm64.whl (2.5 MB)
Collecting PyYAML>=5.1
  Using cached PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl (173 kB)
Collecting Pillow!=7.1.0,!=7.1.1
  Using cached Pillow-9.4.0-cp310-cp310-macosx_11_0_arm64.whl (3.0 MB)
Collecting npe2>=0.5.2
  Using cached npe2-0.6.2-py2.py3-none-any.whl (92 kB)
Collecting pint>=0.17
  Using cached Pint-0.20.1-py3-none-any.whl (269 kB)
Collecting PyOpenGL>=3.1.0
  Using cached PyOpenGL-3.1.6-py3-none-any.whl (2.4 MB)
Collecting tifffile>=2020.2.16
  Using cached tifffile-2022.10.10-py3-none-any.whl (210 kB)
Collecting napari-plugin-engine>=0.1.9
  Using cached napari_plugin_engine-0.2.0-py3-none-any.whl (33 kB)
Collecting napari-svg>=0.1.6
  Using cached napari_svg-0.1.6-py3-none-any.whl (12 kB)
Collecting numpy>=1.18.5
  Using cached numpy-1.24.1-cp310-cp310-macosx_11_0_arm64.whl (13.9 MB)
Collecting typing-extensions
  Using cached typing_extensions-4.4.0-py3-none-any.whl (26 kB)
Collecting pygments>=2.4.0
  Using cached Pygments-2.14.0-py3-none-any.whl (1.1 MB)
Collecting qtpy>=1.10.0
  Using cached QtPy-2.3.0-py3-none-any.whl (83 kB)
Collecting wrapt>=1.11.1
  Using cached wrapt-1.14.1-cp310-cp310-macosx_11_0_arm64.whl (35 kB)
Collecting vispy<0.12,>=0.11.0
  Downloading vispy-0.11.0.tar.gz (2.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 4.6 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting toolz>=0.10.0
  Using cached toolz-0.12.0-py3-none-any.whl (55 kB)
Collecting napari-console>=0.0.6
  Using cached napari_console-0.0.7-py3-none-any.whl (8.6 kB)
Collecting certifi>=2018.1.18
  Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting sphinx<5
  Using cached Sphinx-4.5.0-py3-none-any.whl (3.1 MB)
Collecting scipy>=1.5.4
  Using cached scipy-1.10.0-cp310-cp310-macosx_12_0_arm64.whl (28.8 MB)
Collecting numpydoc>=0.9.2
  Using cached numpydoc-1.5.0-py3-none-any.whl (52 kB)
Collecting magicgui>=0.3.6
  Using cached magicgui-0.6.1-py2.py3-none-any.whl (110 kB)
Collecting psutil>=5.0
  Using cached psutil-5.9.4-cp38-abi3-macosx_11_0_arm64.whl (244 kB)
Collecting dask[array]!=2.28.0,>=2.15.0
  Using cached dask-2023.1.0-py3-none-any.whl (1.1 MB)
Collecting scikit-image>=0.19.1
  Using cached scikit_image-0.19.3-cp310-cp310-macosx_12_0_arm64.whl (12.5 MB)
Collecting cachey>=0.2.1
  Using cached cachey-0.2.1-py3-none-any.whl (6.4 kB)
Collecting appdirs>=1.4.4
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting jsonschema>=3.2.0
  Using cached jsonschema-4.17.3-py3-none-any.whl (90 kB)
Collecting app-model<0.3.0,>=0.0.8
  Using cached app_model-0.1.1-py3-none-any.whl (56 kB)
Collecting PyQt5!=5.15.0,>=5.12.3
  Downloading PyQt5-5.15.7.tar.gz (3.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 13.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [24 lines of output]
      Querying qmake about your Qt installation...
      Traceback (most recent call last):
        File "/Users/genevieb/mambaforge/envs/test/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 144, in prepare_metadata_for_build_wheel
          hook = backend.prepare_metadata_for_build_wheel
      AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/Users/genevieb/mambaforge/envs/test/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/Users/genevieb/mambaforge/envs/test/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/genevieb/mambaforge/envs/test/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 148, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/private/var/folders/82/phlx_f6j5518qtvpm4x0_0fm0000gq/T/pip-build-env-n0469wub/overlay/lib/python3.10/site-packages/sipbuild/api.py", line 46, in build_wheel
          project = AbstractProject.bootstrap('wheel',
        File "/private/var/folders/82/phlx_f6j5518qtvpm4x0_0fm0000gq/T/pip-build-env-n0469wub/overlay/lib/python3.10/site-packages/sipbuild/abstract_project.py", line 87, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "/private/var/folders/82/phlx_f6j5518qtvpm4x0_0fm0000gq/T/pip-build-env-n0469wub/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 601, in setup
          self.update(tool)
        File "/private/var/folders/82/phlx_f6j5518qtvpm4x0_0fm0000gq/T/pip-install-dxm8b578/pyqt5_3c645aa84c9740b2baeca65dcd3df420/project.py", line 166, in update
          raise UserException(
      sipbuild.exceptions.UserException
      [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.
hint: See above for details.
(test) genevieb@dyn-130-194-109-212 ~ %

Honestly if conda installs work on all platforms, I think it's better to move that chunk of text up above pip & prioritize it as the preferred method. I'd put the stuff about pip down below it as an alternative, with a note warning Apple Silicon users.

Comment on lines 188 to 190
*(On arm64 macOS, it is the availability of wheels for these Qt5 backends via pip
that is the problem. If you provide the backend, for example via conda from conda-forge,
then you can `pip install napari`, but without the `[all]`.)*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding this after the fact, I would instead update the line above:

Running pip install "napari[all]" will install the default framework — currently PyQt5, but this could change in the future.

to something like:

Running `pip install "napari[all]"` will install the default framework —
currently PyQt5, but this could change in the future. (But note: if you
have a Mac machine with Apple Silicon — a processor with a name like
"M1" — see {ref}`note-m1`.)

```{note}
:name: note-m1

For machines with Apple Silicon, pre-compiled PyQt5 or PySide2
[wheels](https://realpython.com/python-wheels/) are not available,
so trying to `pip install napari[all]` will fail. You can install one of
those libraries separately, for example with `conda` or `mamba`,
and then `pip install napari`.
```

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jni I've updated for your comment. Slightly tweaked in a way that made more sense to me.
What do you think @GenevieveBuckley comment to put conda-forge first?
From my year+ it seems like conda vs pip is like religious wars—I'm not sure where we stand, officially. But we do provide instructions for conda envs, so ... 👀

docs/index.md Outdated Show resolved Hide resolved
Copy link
Contributor

@dstansby dstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good - I've left some suggestions to make the instructions clearer.

docs/index.md Outdated Show resolved Hide resolved
docs/index.md Outdated Show resolved Hide resolved
docs/tutorials/fundamentals/installation.md Outdated Show resolved Hide resolved
docs/tutorials/fundamentals/installation.md Outdated Show resolved Hide resolved
@jni jni merged commit ced502b into napari:main Jan 31, 2023
@jni
Copy link
Member

jni commented Jan 31, 2023

Thank you @psobolewskiPhD and everyone who participated in review! 🎉 🙏

@psobolewskiPhD psobolewskiPhD added this to the 0.4.18 milestone Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: How to document arm64-native installation on macOS? (aka Apple Silicon, M1, M2)
5 participants