[R-pkg-devel] How to solve this error while running python script in R environment?

KABILAN S k@b||@n151414 @end|ng |rom gm@||@com
Fri Feb 7 07:51:27 CET 2025


When I am creating the R package based on the python script, I am getting the below error while checking the package.


* checking examples ... [60s] ERROR
Running examples in 'transformerForecasting-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: TRANSFORMER
> ### Title: Transformer Model for Time Series Forecasting
> ### Aliases: TRANSFORMER
>
> ### ** Examples
>
> data(S_P_500_Close_data)
> df <- S_P_500_Close_data
> result <- TRANSFORMER(df = S_P_500_Close_data, study_variable = "Price")
Error: Valid installation of TensorFlow not found.

Python environments searched for 'tensorflow' package:
 C:\Users\CRAN\Documents\.virtualenvs\r-reticulate\Scripts\python.exe

Python exception encountered:
 Traceback (most recent call last):
  File "D:\RCompile\CRANpkg\lib\4.5\reticulate\python\rpytools\loader.py", line 122, in _find_and_load_hook
    return _run_hook(name, _hook)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\RCompile\CRANpkg\lib\4.5\reticulate\python\rpytools\loader.py", line 96, in _run_hook
    module = hook()
             ^^^^^^
  File "D:\RCompile\CRANpkg\lib\4.5\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.
Execution halted

How to solve this?

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list