Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Cannot open jupyter notebook or import tensorflow on Mac M1 #242

Open
RemeAjayi opened this issue Apr 23, 2021 · 6 comments
Open

Cannot open jupyter notebook or import tensorflow on Mac M1 #242

RemeAjayi opened this issue Apr 23, 2021 · 6 comments

Comments

@RemeAjayi
Copy link

Hello,

I have successfully installed tensorflow on macos using the instructions on the github repo and this tutorial. I created a virtual environment and in that environment, tensorflow and jupyter notebook are listed as packages installed.

However, when I switch to python 3 in the terminal and type import tensorflow. I get failed to run tensorflow runtime. And more importantly when I run jupyter notebook I get

Traceback (most recent call last): File "/Users/olohireme/miniforge3/envs/tensorflow_macos/bin/jupyter-notebook", line 5, in <module> from notebook.notebookapp import main File "/Users/olohireme/miniforge3/envs/tensorflow_macos/lib/python3.8/site-packages/notebook/notebookapp.py", line 78, in <module> from .services.kernels.kernelmanager import MappingKernelManager, AsyncMappingKernelManager File "/Users/olohireme/miniforge3/envs/tensorflow_macos/lib/python3.8/site-packages/notebook/services/kernels/kernelmanager.py", line 18, in <module> from jupyter_client.session import Session File "/Users/olohireme/miniforge3/envs/tensorflow_macos/lib/python3.8/site-packages/jupyter_client/__init__.py", line 4, in <module> from .connect import * File "/Users/olohireme/miniforge3/envs/tensorflow_macos/lib/python3.8/site-packages/jupyter_client/connect.py", line 21, in <module> import zmq File "/Users/olohireme/miniforge3/envs/tensorflow_macos/lib/python3.8/site-packages/zmq/__init__.py", line 50, in <module> _load_libzmq() File "/Users/olohireme/miniforge3/envs/tensorflow_macos/lib/python3.8/site-packages/zmq/__init__.py", line 28, in _load_libzmq from . import libzmq ImportError: dlopen(/Users/olohireme/miniforge3/envs/tensorflow_macos/lib/python3.8/site-packages/zmq/libzmq.cpython-38-darwin.so, 10): no suitable image found. Did find: /Users/olohireme/miniforge3/envs/tensorflow_macos/lib/python3.8/site-packages/zmq/libzmq.cpython-38-darwin.so: mach-o, but wrong architecture /Users/olohireme/miniforge3/envs/tensorflow_macos/lib/python3.8/site-packages/zmq/libzmq.cpython-38-darwin.so: mach-o, but wrong architecture

Please what am I doing wrong? This is my second day of trying to get this to work.

@arge-7
Copy link

arge-7 commented Apr 23, 2021

Are you positive you downloaded the ARM64 version and not the intel? Looks like you might have mixed them up.

Can you import tensorflow in your terminal or other IDE? Is this specific to Jupyter?

@RemeAjayi
Copy link
Author

Thank you so much for responding. Yes, I downloaded the ARM64 version.
This was the final command I used to install tensorflow. It references the ARM64 version.
pip install --upgrade 0t "$env/lib/python3.8/site-packages/" --n0-dependencies --force "$libs/tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl"
I cannot import tensorflow in Visual Studio Code. It is not specific to jupyter. Opening jupyter is another issue, the stack trace above is what I get why I try to open jupyter. I cannot open jupyter right now. Please let me know if you have any other questions. Thanks!

@RemeAjayi
Copy link
Author

RemeAjayi commented Apr 23, 2021

After following the steps in this post

I realised that the python version in my virtual environment is for x86.

% file $(which python) /Users/olohireme/miniforge3/envs/tensorflow_macos/bin/python: Mach-O 64-bit executable x86_64

I have gone through that post and researched. I do not understand how to change it to ARM.

@arge-7
Copy link

arge-7 commented Apr 24, 2021

I'm not familiar with that tutorial. Try starting from scratch with this one, which has worked for me multiple times. It's straight from Apple's TF repo.

#153

@ManuelSchneid3r
Copy link

@arge-7 it "works", but do you get GPU acceleration?

@devnev39
Copy link

Did you have installed this tensorflow with mini forge. It looks like you used pip which don't have any supported libraries. If not consider uninstalling all and installing with mini forge conda as given in the tutorial.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants