-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic install of keras and tensorflow on M1 Mac leads to crashes #1165
Comments
Would it be possible to install tensorflow from https://github.com/apple/tensorflow_macos? Could this work in |
Hi. Same issue here. I have tried the above, install the AppleML tensorflow version succesfully in a venv. Then with reticulate and use_python pointing to this python distribution. However, same issue. Every call to tensorflow/keras crashes Rstudio. |
Hi, here is an update to this after 1.5 days of struggling:
Stuck there! |
Edit: ...I'm an idiot. I thought I was in a totally different repo, didn't realize I jumped into the Rstudio repo. My comment probably is even less helpful than it is before -- my apologies! Rstudio is still on Intel via Rosetta -- it's not Apple Silicon Native. Integrating that with Python (especially since you used my issue which encourages you to use the ARM route) wouldn't work. My best guess would be you need to get a Rosetta compiled Python, somehow trick it to get the Intel version of Tensorflow, then trick Rstudio to accept it. |
I don’t think your comment is not helpful. Quite the opposite (even if unintentional). But I think you go right down to the core of the issue, although I am not sure.
Bummer. |
As an update, someone had contributed to my personal 'Data Science on ARM' notes at https://github.com/mwidjaja1/DSOnMacARM#pythonrfortran-ie-anacondaminiforge. In that section, someone implied you can use Miniforge/Conda (think of it it as a Python package manager) to awkwardly install a version of R that is ARM compatible. I am NOT an R expert in anyway, to me this sounds like witchcraft that you can use Python to install R. But that might be another option too. |
Hi Folks, I am encountered with the same problem. Do you fix your problem? |
Hello! Same problem .. has anyone fixed the problem? |
Same problem here, tensorflow works but keras crashes. Any update? |
So, I just saw this guide to getting tensorflow up and running on your M1 mac - https://medium.com/codex/installing-tensorflow-on-m1-macs-958767a7a4b3 - it works great! If this gets tf installed, I guess the followup would be then how to make the keras and R packages in R use this installation instead of what comes through if you try and install it as is. Thoughts? |
Some progress, sort of... After following the instructions above, I tried some of the pointers from https://tensorflow.rstudio.com/installation/custom/ and tried
And instead of a crash, got
So - I feel like this is the right way to go.....anyone else have further thoughts? |
I have different passages that allow me to import correctly tensorflow, load mnist correctly, compile a Keras API model. However, when training crashes. The different steps are (you need to have anaconda installed): On the mac terminal type:
This creates a conda enviroment called tf2 then to open Rstudio:
Once you open Rstudio execute:
Then execute the following lines to make sure that tensorflow works:
And it works with no problem, then I load MNIST dataset with no problem as:
And I compile a simple neural network with Keras API with no problem. However when I fit the model, after a couple of seconds the session aborts. Sometimes Keras may not be installed, the easiest way to install it is to open anaconda navigator, select the tf2 environment and install "r-keras" I hope these steps are useful and someone from the community can take it from here to solve the Keras issue. Tullio |
Hrm. This does not seem to work. I created an environment, From terminal, running
And then
causes a crash. Out of curiosity, I uninstalled the three packages with |
OK. I installed the nightly arm build of R from https://mac.r-project.org/ I reinstalled the libraries (reticulate had to be the binary - it failed from source) I also have
in my .Renviron Now, But. minst ran. And it ran fast. I'll wrap this into a blog post later tonight and then close this issue? I mean, I'd like to solve the other problems, but this is functional! |
OK - blog post with instructions is up at http://imachordata.com/2021/05/07/r-tensorflow-on-an-m1-mac-without-crashing/ - hopefully the apple fork will be pulled back into the main one, and things can continue (so we can do things like use tiffs and such from other libraries) - but, good luck, all! And thanks! |
Sir please help me to resolve it. My mail is "proy288@gmail.com" I badly need the solution for this.. |
I believe that installation on M1 Macs works on the development version of the R package. This should be all you need: remotes::install_github("rstudio/reticulate")
remotes::install_github("rstudio/tensorflow")
remotes::install_github("rstudio/keras")
reticulate::miniconda_uninstall()
reticulate::install_miniconda()
keras::install_keras() Please file a new issue if this doesn't work! |
This is not working for an specific part. The miniconda is not installing. The message is tarfile.ReadError: unexpected end of data The above exception was the direct cause of the following exception: Traceback (most recent call last): |
are you able to knit your file? creating a conda env and use that conda env in rstudio will make tf working. But I am unable to knit |
Hello! I am trying to get keras and tensorflow to run on R 4.0.3 on a brand new installation on an M1 macbook pro.
I installed both keras and tensorflow libraries, ran
install_keras()
andinstall_tensorflow()
and installed miniconda along with them as prompted.However, whenever I try and access tensorflow, my R session crashes (both in Rstudio and R.app).
Even the following
causes a hard crash. Should I be specifying different versions, etc., to my
install_*
functions?(sidenote - can tensorflow be installed to make use of the GPUs on an M1? Would love to do this)
The text was updated successfully, but these errors were encountered: