Skip to content

Installation Issue - no valid installation of tensorflow #622

Open
@lynseymccoll

Description

@lynseymccoll

Hi,

I'm having problems installing tensorflow.

I can add the following code:

install_tensorflow(envname = "C:\Users\LynseyMcColl\AppData\Local\r-tensorflow", method = "conda", python_version = "3.11", version = "2.18")

Which says the installation is successful but when I then try it out I get the following error message:
Error: Valid installation of TensorFlow not found.

I have set an envname above as I am working on one drive and so have pointed it to the desktop rather than an online environment which I've read can cause problems.

I've put the messages I get to the commands requested below.

Many thanks,

Lynsey

reticulate::py_config()

libpython:      C:/Users/LynseyMcColl/AppData/Local/Programs/Python/Python311/python311.dll
pythonhome:     C:/Users/LynseyMcColl/AppData/Local/Programs/Python/Python311
version:        3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
Architecture:   64bit
numpy:           [NOT FOUND]

NOTE: Python version was forced by use_python() function

tensorflow::tf_config()

Valid installation of TensorFlow not found.

Python environments searched for 'tensorflow' package:
 C:\Users\LynseyMcColl\AppData\Local\Programs\Python\Python311\python.exe

Python exception encountered:
 Traceback (most recent call last):
  File "C:\Users\LynseyMcColl\AppData\Local\R\win-library\4.4\reticulate\python\rpytools\loader.py", line 122, in _find_and_load_hook
    return _run_hook(name, _hook)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\LynseyMcColl\AppData\Local\R\win-library\4.4\reticulate\python\rpytools\loader.py", line 96, in _run_hook
    module = hook()
             ^^^^^^
  File "C:\Users\LynseyMcColl\AppData\Local\R\win-library\4.4\reticulate\python\rpytools\loader.py", line 120, in _hook
    return _find_and_load(name, import_)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'tensorflow'


You can install TensorFlow using the install_tensorflow() function.
 
Warning message:
ModuleNotFoundError: No module named 'tensorflow'
Run `reticulate::py_last_error()` for details.
Restart the R session and load the tensorflow R package before reticulate has initialized Python, or ensure reticulate initialized a Python installation where the tensorflow module is installed.

reticulate::import("tensorflow")

Error in py_module_import(module, convert = convert) : 
  ModuleNotFoundError: No module named 'tensorflow'
Run `reticulate::py_last_error()` for details.

reticulate::py_last_error()

── Python Exception Message ──────────────────────────────────────────────────────────────────────────────────
Traceback (most recent call last):
  File "C:\Users\LynseyMcColl\AppData\Local\R\win-library\4.4\reticulate\python\rpytools\loader.py", line 122, in _find_and_load_hook
    return _run_hook(name, _hook)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\LynseyMcColl\AppData\Local\R\win-library\4.4\reticulate\python\rpytools\loader.py", line 96, in _run_hook
    module = hook()
             ^^^^^^
  File "C:\Users\LynseyMcColl\AppData\Local\R\win-library\4.4\reticulate\python\rpytools\loader.py", line 120, in _hook
    return _find_and_load(name, import_)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'tensorflow'

── R Traceback ───────────────────────────────────────────────────────────────────────────────────────────────
    ▆
 1. └─reticulate::import("tensorflow")
 2.   └─reticulate:::py_module_import(module, convert = convert)
See `reticulate::py_last_error()$r_trace$full_call` for more details.

sessionInfo()

R version 4.4.3 (2025-02-28 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)

Matrix products: default


locale:
[1] LC_COLLATE=English_United Kingdom.utf8  LC_CTYPE=English_United Kingdom.utf8   
[3] LC_MONETARY=English_United Kingdom.utf8 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.utf8    

time zone: Europe/London
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] base64enc_0.1-3        Matrix_1.7-2           lattice_0.22-6         reticulate_1.42.0     
 [5] magrittr_2.0.3         glue_1.8.0             png_0.1-8              lifecycle_1.0.4       
 [9] cli_3.6.4              tensorflow_2.16.0.9000 vctrs_0.6.5            grid_4.4.3            
[13] tfruns_1.5.3           compiler_4.4.3         rstudioapi_0.17.1      tools_4.4.3           
[17] whisker_0.4.1          pillar_1.10.1          Rcpp_1.0.14            rlang_1.1.5           
[21] jsonlite_2.0.0   

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions