-
Notifications
You must be signed in to change notification settings - Fork 321
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
Unable to install tensor-flow in R-Studio on m1 mac #530
Comments
Update - still not working but closer. I repeated the install steps from scratch. Went into R- Studio and selected R Studio->Preferences->Python. Picked the Python 3.8.9 [System Interpreter] option. Then repeated the tensorflow::install_tensorflow() command. This time it seemed to work and did not give any error messages. However after loading the keras reticulate, and tensorflow libraries, and then making a call to keras_model_sequential, I get the following:
Detected Python configuration: |
Wanted to add that I cannot install Tensorflow on an M1 mac at the moment, I'm not sure what has changed, as I used to be able to do this with no issues. Here's my reprex + session info: library(tensorflow)
install_tensorflow(envname = "greta-env")
#> Installing: tensorflow-deps==2.6
#> Error: one or more Python packages failed to install [error code 1] Created on 2022-05-11 by the reprex package (v2.0.1) Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.2.0 (2022-04-22)
#> os macOS Big Sur 11.2.2
#> system aarch64, darwin20
#> ui X11
#> language (EN)
#> collate en_AU.UTF-8
#> ctype en_AU.UTF-8
#> tz Australia/Perth
#> date 2022-05-11
#> pandoc 2.17.1.1 @ /Applications/RStudio.app/Contents/MacOS/quarto/bin/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.2.0)
#> cli 3.3.0 2022-04-25 [1] CRAN (R 4.2.0)
#> digest 0.6.29 2021-12-01 [1] CRAN (R 4.2.0)
#> evaluate 0.15 2022-02-18 [1] CRAN (R 4.2.0)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0)
#> fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.0)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.2.0)
#> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.2.0)
#> jsonlite 1.8.0 2022-02-22 [1] CRAN (R 4.2.0)
#> knitr 1.39 2022-04-26 [1] CRAN (R 4.2.0)
#> lattice 0.20-45 2021-09-22 [1] CRAN (R 4.2.0)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.0)
#> Matrix 1.4-1 2022-03-23 [1] CRAN (R 4.2.0)
#> png 0.1-7 2013-12-03 [1] CRAN (R 4.2.0)
#> Rcpp 1.0.8.3 2022-03-17 [1] CRAN (R 4.2.0)
#> reprex 2.0.1 2021-08-05 [1] CRAN (R 4.2.0)
#> reticulate 1.24 2022-01-26 [1] CRAN (R 4.2.0)
#> rlang 1.0.2 2022-03-04 [1] CRAN (R 4.2.0)
#> rmarkdown 2.14 2022-04-25 [1] CRAN (R 4.2.0)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.2.0)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0)
#> stringi 1.7.6 2021-11-29 [1] CRAN (R 4.2.0)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.2.0)
#> tensorflow * 2.8.0.9000 2022-05-11 [1] Github (rstudio/tensorflow@6e3e00e)
#> tfruns 1.5.0 2021-02-26 [1] CRAN (R 4.2.0)
#> whisker 0.4 2019-08-28 [1] CRAN (R 4.2.0)
#> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.0)
#> xfun 0.31 2022-05-10 [1] CRAN (R 4.2.0)
#> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.2.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library
#>
#> ────────────────────────────────────────────────────────────────────────────── Not all of the error message was captured above, so here is what I get when I run the above code:
I've tried removing miniconda, and the |
That's unfortunate, looks like an update to a conda package is causing the installation of a pinned |
Quick update, I confirmed that this successfully installs TensorFlow on an M1 Mac running Monterey remotes::install_github("rstudio/tensorflow")
reticulate::miniconda_uninstall()
reticulate::install_miniconda()
tensorflow::install_tensorflow() |
I uninstalled the tensorflow and keras packages in R Studio and then re-installed tensorflow using the above commands. This works (i.e. keras and tensorflow library calls work) as long as there is nothing selected in the R Studio->Preferences->Python option. As soon as I select one of the available interpreters I get the error message below about tensorflow not being installed, even though it is definitely installed. It must be either a pathing issue or maybe I installed tensorflow wrong. I am hoping that this does not mean I will have similar issues with other python libraries, but I can use the tensorflow library for now. Thanks for the help. Error: Valid installation of TensorFlow not found. Python environments searched for 'tensorflow' package: Python exception encountered: You can install TensorFlow using the install_tensorflow() function. |
Hi, I think it's working as intended. |
How does the install select a python installation if you don't specify an environment? Or are you saying that the install creates a python installation for tensorflow to use? As I mentioned, I have it working so am closing the issue. Thanks for the help. |
|
Hello - I can't seem to get tensor-flow working on my m1 mac. I wonder if it's a pathing problem or I have the tensor-flow mac-os library installed in the wrong place?
Thanks in advance for your help.
Mac Version: macOS Monterey, version 12.3.1
This is my R-version:
Performed the follwing steps in R-studio R script:
install.packages("remotes")
remotes::install_github(sprintf("rstudio/%s", c("reticulate", "tensorflow", "keras")))
reticulate::miniconda_uninstall()
start with a blank slate
reticulate::install_miniconda(force=TRUE)
keras::install_keras()
Everything worked up until the last step. Here is the error message:
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done
All requested packages already installed.
Installing: tensorflow-deps
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done
All requested packages already installed.
Installing: tensorflow-macos
ERROR: Could not find a version that satisfies the requirement tensorflow-macos (from versions: none)
ERROR: No matching distribution found for tensorflow-macos
Error: Error installing package(s): "'tensorflow-macos'"
Path environment variable:
/Users/petergarafola/miniforge3/bin:/Users/petergarafola/miniforge3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
The text was updated successfully, but these errors were encountered: