question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

napari does not install numpy correctly on MacOs M1 (with possible workaround/fix) leading to a crash

See original GitHub issue

Hello,

I’ve recently been working with M1 MacOs chips and had trouble with the installation. I found a work around and thought it might be useful to you.

🐛 Bug

When installing and running napari the intended (?) way, napari crashes.

To Reproduce

Steps to reproduce the behavior:

$ conda create -n test2
$ conda activate test2
$ conda install napari
$ napari

After running napari, it crashes and

I get the following error:
Traceback (most recent call last):
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/__init__.py", line 23, in <module>
    from . import multiarray
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/multiarray.py", line 10, in <module>
    from . import overrides
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/overrides.py", line 6, in <module>
    from numpy.core._multiarray_umath import (
ImportError: dlopen(/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so, 0x0002): Library not loaded: @rpath/libcblas.3.dylib
  Referenced from: /Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so
  Reason: tried: '/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/leo.guignard/miniforge3/envs/test2/bin/../lib/libcblas.3.dylib' (no such file), '/Users/leo.guignard/miniforge3/envs/test2/bin/../lib/libcblas.3.dylib' (no such file), '/usr/local/lib/libcblas.3.dylib' (no such file), '/usr/lib/libcblas.3.dylib' (no such file)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/dask/array/__init__.py", line 2, in <module>
    from dask.array import backends, fft, lib, linalg, ma, overlap, random
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/dask/array/backends.py", line 1, in <module>
    import numpy as np
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/__init__.py", line 140, in <module>
    from . import core
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/__init__.py", line 49, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.10 from "/Users/leo.guignard/miniforge3/envs/test2/bin/python3.10"
  * The NumPy version is: "1.23.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: dlopen(/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so, 0x0002): Library not loaded: @rpath/libcblas.3.dylib
  Referenced from: /Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so
  Reason: tried: '/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/leo.guignard/miniforge3/envs/test2/bin/../lib/libcblas.3.dylib' (no such file), '/Users/leo.guignard/miniforge3/envs/test2/bin/../lib/libcblas.3.dylib' (no such file), '/usr/local/lib/libcblas.3.dylib' (no such file), '/usr/lib/libcblas.3.dylib' (no such file)


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/leo.guignard/miniforge3/envs/test2/bin/napari", line 6, in <module>
    from napari.__main__ import main
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/napari/__main__.py", line 15, in <module>
    import napari.plugins._npe2 as _npe2
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/napari/plugins/__init__.py", line 7, in <module>
    from ..settings import get_settings
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/napari/settings/__init__.py", line 4, in <module>
    from ..utils.translations import trans
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/napari/utils/__init__.py", line 1, in <module>
    from ._dask_utils import resize_dask_cache
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/napari/utils/_dask_utils.py", line 8, in <module>
    import dask.array as da
  File "/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/dask/array/__init__.py", line 271, in <module>
    raise ImportError(str(e) + "\n\n" + msg) from e
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.10 from "/Users/leo.guignard/miniforge3/envs/test2/bin/python3.10"
  * The NumPy version is: "1.23.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: dlopen(/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so, 0x0002): Library not loaded: @rpath/libcblas.3.dylib
  Referenced from: /Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so
  Reason: tried: '/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/leo.guignard/miniforge3/envs/test2/lib/python3.10/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/leo.guignard/miniforge3/envs/test2/bin/../lib/libcblas.3.dylib' (no such file), '/Users/leo.guignard/miniforge3/envs/test2/bin/../lib/libcblas.3.dylib' (no such file), '/usr/local/lib/libcblas.3.dylib' (no such file), '/usr/lib/libcblas.3.dylib' (no such file)


Dask array requirements are not installed.

Please either conda or pip install as follows:

  conda install dask                 # either conda install
  python -m pip install "dask[array]" --upgrade  # or python -m pip install

Now, if I install napari the following way:

$ conda create -n test
$ conda activate test
$ conda install numpy napari

It starts as intended.

(Note that I have tried what was suggested on the error message and that it did not work).

Expected behavior

Not crash

Environment

Here is the difference between the two installations:

$ diff <(conda list -n test2) <(conda list -n test)
1c1
< # packages in environment at /Users/leo.guignard/miniforge3/envs/test2:
---
> # packages in environment at /Users/leo.guignard/miniforge3/envs/test:
12a13,14
> blas                      2.115                  openblas    conda-forge
> blas-devel                3.9.0           15_osxarm64_openblas    conda-forge
109a112
> liblapacke                3.9.0           15_osxarm64_openblas    conda-forge
113c116
< libopenblas               0.3.20               hea475bc_0
---
> libopenblas               0.3.20          openmp_h130de29_1    conda-forge
148c151,152
< numpy                     1.23.1          py310h0a343b5_0    conda-forge
---
> numpy                     1.23.1          py310h220015d_0
> numpy-base                1.23.1          py310h742c864_0
149a154
> openblas                  0.3.20          openmp_h7efc2c9_1    conda-forge

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Czakicommented, Aug 8, 2022

Please checek version of napari. Based on your second issue it looks like you meets a bug in conda and got napari in version 0.4.14 instead of 0.4.16. See #4891

0reactions
potating-potatocommented, Aug 10, 2022

going to close this issue as it seems resolved

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue with downloading Napari on Mac M1 chip
I am having issues downloading Napari on my Mac M1 chip. I tried downloading the GUI app as well as and the source...
Read more >
conda-forge installs napari 0.4.14 instead of newest stable ...
I can reproduce this on my M1 macOS 12.4 arm64-native miniforge/conda-forge environment. Conda install output:.
Read more >
python 3.x - numpy build fail in M1 Big sur 11.1 - Stack Overflow
I was installing numpy inside docker (preview for M1). The steps here were helpful to point me in a direction. I needed a...
Read more >
Error installing numpy on m1 Mac using terminal - Python
I get an error trying to install numpy via terminal on m1 mac, Big Sur V11.2.3 Does anyone have any ideas on how...
Read more >
Mac Big Sur Python bug? : r/MacOS - Reddit
sudo pip install numpy. or. sudo pip3 install numpy. It is not working under Big Sur within a terminal or VsCode instance of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found