Issue
I encounter some problems on my MacBook Pro M1. I thought it would be easier to start coding on it, apparently it's not a ML beast yet...
I need to use both PyTorch and TensorFlow on Python. I have installed TensorFlow 2.0 for Mac OS.
The problem is: TensorFlow won't work when you use a x86_64 terminal. (So it doesn't work with PyCharm). However, I can import TensorFlow 2.0 from an arm terminal. Paradoxically, PyTorch won't install on a arm terminal, only on a x86_64 terminal. So, on the same Python terminal, I'm not able to import both torch and TensorFlow 2.0.
Since HuggingFace transformers is crucial for me, and transformers needs both TensorFlow 2.0 and PyTorch, I need to go back on my old computer to code. I'm very disappointed!
Anyone successfully imported both PyTorch and TensorFlow on a Mac M1 device?
And does anyone know if there is a way to force PyCharm to use an arm terminal, so I can use TensorFlow 2.0 on PyCharm on my M1 MPB?
Thank you!
Solution
After some research, I found this answer: https://github.com/pytorch/pytorch/issues/48145 .
So if someone tries to run both Tensorflow and Torch on Mac M1 with PyCharm Apple Silicon Version, here's how to proceed:
- Create a new virtual env with Tensorflow Mac OS
- From terminal (not from PyCharm, I got an error), with sudo rights, install the whl file for torch, from the GitHub issue: https://github.com/wizyoung/AppleSiliconSelfBuilds/blob/main/builds/torch-1.8.0a0-cp39-cp39-macosx_11_0_arm64.whl
Now you can open a PyCharm project with your freshly created virtual environment, and you'll be able to import both Tensorflow and Torch. However, a lot of librairies will be tricky to install like PyTorch...
Answered By - pythonize
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.