rstudio / rstudio/reticulate

Error in .Call(`_reticulate_py_call_impl`, x, args, keywords) : reached elapsed time limit

Open
#293 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.8k
Forks
349
Avg merge
5h 13m
Merged PRs (30d)
4

Description

I keep getting this error using reticulate with python 3.6, keras 2.2, tensorflow 1.8. I am forcing reticulate to use python 3.6 with use_python("/usr/local/bin/python3", required = T). Error occurs when trying to invoke tensorflow with many rows or from few rows but large files. Example I am following is from here --> https://tensorflow.rstudio.com/blog/simple-audio-classification-keras.html

Script that produces error is below;

library(stringr)
library(dplyr)
library(fs)
library(tfdatasets)
library(tensorflow)
library(utils)
library(keras)
library(reticulate)
use_python("/usr/local/bin/python3", required = T)

Download the data
dir.create("data")

download.file(
url = "http://download.tensorflow.org/data/speech_commands_v0.01.tar.gz",
destfile = "data/speech_commands_v0.01.tar.gz"
)

untar("data/speech_commands_v0.01.tar.gz", exdir = "data/speech_commands_v0.01")

Get list of all files

files <- fs::dir_ls(
path = "data/speech_commands_v0.01/",
recursive = TRUE,
glob = "*.wav"
)

files <- files[!str_detect(files, "background_noise")]

df <- data_frame(
fname = files,
class = fname %>% str_extract("1/.*/") %>%
str_replace_all("1/", "") %>%
str_replace_all("/", ""),
class_id = class %>% as.factor() %>% as.integer() - 1L
)

timeout error occurs here in trying to process 64721 rows or when trying to open small numbers of large wav files.

suggests a memory or sockets problem in reticular or tfdatasets. If I reduce sample data problem repeats in other

tf calls later in the scripts shown here --> https://tensorflow.rstudio.com/blog/simple-audio-classification-keras.html

ds <- tensor_slices_dataset(df) # problem occurs here. Error in .Call(_reticulate_py_call_impl, x, args, keywords) : reached elapsed time limit
traceback()
sessionInfo()
py_config()

And my console report of the above;

library(stringr)
library(dplyr)

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

filter, lag

The following objects are masked from ‘package:base’:

intersect, setdiff, setequal, union

library(fs)
library(tfdatasets)
library(tensorflow)
library(utils)
library(keras)
library(reticulate)
use_python("/usr/local/bin/python3", required = T)
files <- fs::dir_ls(

  • path = "data/speech_commands_v0.01/",
  • recursive = TRUE,
  • glob = "*.wav"
  • )

files <- files[!str_detect(files, "background_noise")]

df <- data_frame(

  • fname = files,
  • class = fname %>% str_extract("1/.*/") %>%
  • str_replace_all("1/", "") %>%
    
  • str_replace_all("/", ""),
    
  • class_id = class %>% as.factor() %>% as.integer() - 1L
  • )

timeout error occurs here in trying to process 64721 rows or when trying to open small numbers of large wav files.

suggests a memory or sockets problem in reticular or tfdatasets. If I reduce sample data problem repeats in other

tf calls later in the scripts shown here --> https://tensorflow.rstudio.com/blog/simple-audio-classification-keras.html

ds <- tensor_slices_dataset(df) # problem occurs here. Error in .Call(_reticulate_py_call_impl, x, args, keywords) : reached elapsed time limit
traceback()
No traceback available
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] reticulate_1.8.0.9000 keras_2.1.6.9001 tensorflow_1.8.0.9000 tfdatasets_1.5 fs_1.2.3
[6] dplyr_0.7.5 stringr_1.3.1

loaded via a namespace (and not attached):
[1] Rcpp_0.12.17 whisker_0.3-2 bindr_0.1.1 magrittr_1.5 tidyselect_0.2.4 lattice_0.20-35 R6_2.2.2
[8] rlang_0.2.1 tools_3.5.0 grid_3.5.0 tfruns_1.3 yaml_2.1.19 assertthat_0.2.0 tibble_1.4.2
[15] Matrix_1.2-14 bindrcpp_0.2.2 purrr_0.2.5 base64enc_0.1-3 zeallot_0.1.0 glue_1.2.0 stringi_1.2.3
[22] compiler_3.5.0 pillar_1.2.3 jsonlite_1.5 pkgconfig_2.0.1

py_config()
python: /usr/local/bin/python3
libpython: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin/libpython3.6.dylib
pythonhome: /Library/Frameworks/Python.framework/Versions/3.6:/Library/Frameworks/Python.framework/Versions/3.6
version: 3.6.3 (v3.6.3:2c5fed86e0, Oct 3 2017, 00:32:08) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
numpy: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy
numpy_version: 1.15.0
keras: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras

NOTE: Python version was forced by use_python function
2018-06-21 16:45:52.907052: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Error in .Call(_reticulate_py_call_impl, x, args, keywords) :
reached elapsed time limit

Thanks for the help to untangle this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied R script with the listed reticulate, Keras, TensorFlow, and Python versions. Start at tensor_slices_dataset(df) and the .Call(_reticulate_py_call_impl) timeout, using traceback(), sessionInfo(), and py_config() to isolate the failure; done means the cause is fixed or its supported configuration is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
keras, python, r, tensorflow
Domain
backend, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.