简体   繁体   中英

Can't run Jupiter Notebook on Mac m1

Just reinstalled Anaconda on my Mac m1, and now when I try and open Jupyter Notebook using the command line, it gives me this error:

jupyter notebook
Traceback (most recent call last):
  File "/Users/alborzgharabaghi/opt/anaconda3/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "/Users/alborzgharabaghi/opt/anaconda3/lib/python3.8/site-packages/notebook/notebookapp.py", line 49, in <module>
    from zmq.eventloop import ioloop
  File "/Users/alborzgharabaghi/.local/lib/python3.8/site-packages/zmq/__init__.py", line 57, in <module>
    _load_libzmq()
  File "/Users/alborzgharabaghi/.local/lib/python3.8/site-packages/zmq/__init__.py", line 32, in _load_libzmq
    from . import libzmq
ImportError: dlopen(/Users/alborzgharabaghi/.local/lib/python3.8/site-packages/zmq/libzmq.cpython-38-darwin.so, 10): no suitable image found.  Did find:
    /Users/alborzgharabaghi/.local/lib/python3.8/site-packages/zmq/libzmq.cpython-38-darwin.so: mach-o, but wrong architecture
    /Users/alborzgharabaghi/.local/lib/python3.8/site-packages/zmq/libzmq.cpython-38-darwin.so: mach-o, but wrong architecture

Any help would be appreciated.

The problem is coming from the pyzmq library!

Its non-M1 compatible version has probably been installed on your Mac. You will need to reinstall it with a Rosetta Terminal.

Step 1: create a new Rosetta terminal, follow that tuto (or any other on the web)

Step 2: open your new Rosetta terminal and re-install pyzmq :

pip uninstall pyzmq
pip install pyzmq

I've been experiencing similar issues with this and other CLI commands with the M1. MacOS ships with an old version of Bash, updating Bash to v5 (and making sure I'm running commands in that environment) cleared up this error for me. This article helped: Upgrading Bash on MacOS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM