Reputation: 55
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.
Upvotes: 1
Views: 1960
Reputation: 1
Encountering a similar issue during my attempt to install the notebook on a Python 3.7.13 virtual environment on my MacBook Pro with M2, I identified the root cause as pyzmq. The challenge stemmed from the fact that, as per the installation wiki, the wheel for MacOS arm architecture was exclusively built for Python versions greater than or equal to 3.9. The specific error message surfaced during the pyzmq installation process:
ERROR: Could not build wheels for pyzmq, which is required to install pyproject.toml-based projects.
To address this, I referred to online blogs and initially resolved the problem by installing Python build dependencies using Homebrew:
brew install openssl readline sqlite3 xz zlib libffi cython zeromq
Subsequently, I activated my Python 3.7 virtual environment and installed pyzmq from source:
pip install --no-binary pyzmq pyzmq
With these steps completed successfully, I was then able to seamlessly install the Jupyter notebook package:
pip install notebook
Upvotes: 0
Reputation: 3
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
Upvotes: 0
Reputation: 1027
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
Upvotes: 1