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

Michael Dewey ||@t@ @end|ng |rom dewey@myzen@co@uk
Fri Feb 7 17:06:54 CET 2025


Have you got tensorflow installed somewhere where R knows about it?

Michael

On 07/02/2025 06:51, KABILAN S wrote:
> 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]]
> 
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> 

-- 
Michael Dewey



More information about the R-package-devel mailing list