본문 바로가기

IT/Python

[jupyter] mac m1 (실리콘) jupyter import error

2021년형 맥북 에어 M1을 사용하고 있다.

python을 설치하고 jupyter 서버를 실행하는 순간 ImportError가 발생했다.

찾아보니 zmq라는 패키지가 제대로 설치되지 않은 것이 이유이다. (아래 cmd의 출력된 구문을 보면 zmq가 있다)

1. 에러메세지

# jfrost @ JAESEOui-MacBookAir in ~ [17:46:40]
$ jupyter notebook

...
ImportError: dlopen(/Users/jfrost/Library/Python/3.8/lib/python/site-packages/zmq/backend/cython/constants.cpython-38-darwin.so, 2): no suitable image found.  Did find:
	/Users/jfrost/Library/Python/3.8/lib/python/site-packages/zmq/backend/cython/constants.cpython-38-darwin.so: mach-o, but wrong architecture
	/Users/jfrost/Library/Python/3.8/lib/python/site-packages/zmq/backend/cython/constants.cpython-38-darwin.so: mach-o, but wrong architecture

2. zmq 재설치 후에 혹시몰라서 jupyter도 재설치 했다.

pip3 uninstall pyzmq
pip3 install pyzmq
pip3 uninstall jupyter
pip3 install jupyter

3. jupyter 정상 동작

# jfrost @ JAESEOui-MacBookAir in ~ [17:54:15] C:130
$ jupyter notebook

[I 17:54:20.617 NotebookApp] Writing notebook server cookie secret to /Users/jfrost/Library/Jupyter/runtime/notebook_cookie_secret
[I 17:54:20.781 NotebookApp] Serving notebooks from local directory: /Users/jfrost
[I 17:54:20.781 NotebookApp] Jupyter Notebook 6.4.3 is running at:
[I 17:54:20.781 NotebookApp] http://localhost:8888/?token=0d300e81aa3e86b032655b8433ae8570e1d86b816858b0b5
[I 17:54:20.781 NotebookApp]  or http://127.0.0.1:8888/?token=0d300e81aa3e86b032655b8433ae8570e1d86b816858b0b5
[I 17:54:20.781 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 17:54:20.785 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///Users/jfrost/Library/Jupyter/runtime/nbserver-27544-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=0d300e81aa3e86b032655b8433ae8570e1d86b816858b0b5
     or http://127.0.0.1:8888/?token=0d300e81aa3e86b032655b8433ae8570e1d86b816858b0b5

 

참고한 사이트 : https://github.com/jupyter/notebook/issues/3435

 

zmq: Can not launch jupyter notebook · Issue #3435 · jupyter/notebook

Hi, conda activate base jupyter notebook Gives me this message: Traceback (most recent call last): File "/home/ics_vr/anaconda3/bin/jupyter-notebook", line 7, in from noteb...

github.com