Keras: TypeError: update() takes from 2 to 3 positional arguments but 4 were given

Created on 14 Feb 2018  Â·  10Comments  Â·  Source: rstudio/keras

When I run the conv_lstm.R example, I get the following error:

Error in py_call_impl(callable, dots$args, dots$keywords) : 
  TypeError: update() takes from 2 to 3 positional arguments but 4 were given

Detailed traceback: 
  File "/usr/lib64/python3.4/site-packages/keras/models.py", line 963, in fit
    validation_steps=validation_steps)
  File "/usr/lib64/python3.4/site-packages/keras/engine/training.py", line 1712, in fit
    validation_steps=validation_steps)
  File "/usr/lib64/python3.4/site-packages/keras/engine/training.py", line 1241, in _fit_loop
    callbacks.on_batch_end(batch_index, batch_logs)
  File "/usr/lib64/python3.4/site-packages/keras/callbacks.py", line 113, in on_batch_end
    callback.on_batch_end(batch, logs)
  File "/usr/lib64/python3.4/site-packages/keras/callbacks.py", line 331, in on_batch_end
    self.progbar.update(self.seen, self.log_values)
  File "/home/lai/R/x86_64-pc-linux-gnu-library/3.4/keras/python/kerastools/progbar.py", line 23, in update_with_patch
    update(self, current, values, force)

When I try to run my own code, I also bump into this error. Is there something wrong with my Keras installation, or is it a bug?

> sessionInfo()       
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux

Matrix products: default
BLAS: /opt/microsoft/ropen/3.4.3/lib64/R/lib/libRblas.so
LAPACK: /opt/microsoft/ropen/3.4.3/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] raster_2.6-7         sp_1.2-5             abind_1.4-5         
[4] keras_2.1.3.1001     RevoUtils_10.0.7     RevoUtilsMath_10.0.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.14          lattice_0.20-35       zeallot_0.0.6        
 [4] grid_3.4.3            R6_2.2.2              jsonlite_1.5         
 [7] magrittr_1.5          tfruns_1.1            whisker_0.3-2        
[10] reticulate_1.4.0.9001 tools_3.4.3           compiler_3.4.3       
[13] base64enc_0.1-3       tensorflow_1.5.0.9000
> 

Most helpful comment

@thomasp85
downgrading to Keras 2.1.3 at Python remedies the problem

source .virtualenv/r-tensorflow/bin/activate
pip install keras=2.1.3

All 10 comments

I have the same error. Just adding my session info in case it help with identifying the problem

> implementation()
Module(keras)
> backend()$backend()
[1] "tensorflow"
> keras:::keras_version()
[1] ‘2.1.4’
> tensorflow::tf_config()
TensorFlow v1.5.0 (~/.virtualenvs/r-tensorflow/lib/python2.7/site-packages/keras)
Python v2.7 (~/.virtualenvs/r-tensorflow/bin/python)
> devtools::session_info()
Session info ----------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.3 (2017-11-30)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.1.383)           
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       Europe/Copenhagen           
 date     2018-02-14                  

Packages --------------------------------------------------------------------------------------------
 package    * version    date       source                             
 base       * 3.4.3      2017-12-07 local                              
 base64enc    0.1-3      2015-07-28 CRAN (R 3.4.0)                     
 compiler     3.4.3      2017-12-07 local                              
 datasets   * 3.4.3      2017-12-07 local                              
 devtools     1.13.4     2017-11-09 CRAN (R 3.4.2)                     
 digest       0.6.15     2018-01-28 CRAN (R 3.4.3)                     
 graphics   * 3.4.3      2017-12-07 local                              
 grDevices  * 3.4.3      2017-12-07 local                              
 jsonlite     1.5        2017-06-01 CRAN (R 3.4.0)                     
 keras      * 2.1.3      2018-01-17 CRAN (R 3.4.3)                     
 magrittr     1.5        2014-11-22 CRAN (R 3.4.0)                     
 memoise      1.1.0      2017-04-21 CRAN (R 3.4.0)                     
 methods    * 3.4.3      2017-12-07 local                              
 R6           2.2.2      2017-06-17 CRAN (R 3.4.0)                     
 Rcpp         0.12.15    2018-01-20 CRAN (R 3.4.3)                     
 reticulate   1.4.0.9001 2018-02-14 Github (rstudio/reticulate@e49861a)
 stats      * 3.4.3      2017-12-07 local                              
 tensorflow   1.5        2018-01-17 CRAN (R 3.4.3)                     
 tfruns       1.2        2018-01-18 CRAN (R 3.4.3)                     
 tools        3.4.3      2017-12-07 local                              
 utils      * 3.4.3      2017-12-07 local                              
 whisker      0.3-2      2013-04-28 CRAN (R 3.4.0)                     
 withr        2.1.1.9000 2018-01-04 Github (jimhester/withr@df18523)   
 yaml         2.1.16     2017-12-12 CRAN (R 3.4.3)                     
 zeallot      0.1.0      2018-01-28 CRAN (R 3.4.3)

@thomasp85
downgrading to Keras 2.1.3 at Python remedies the problem

source .virtualenv/r-tensorflow/bin/activate
pip install keras=2.1.3

Yes, I think this is a Keras 2.1.4 (which was just released 12 hours ago!) issue. I will resolve it ASAP.

Fixed via #285

Just bought the new book "Deep Learning with R". Getting this same error when working through the first imdb example:

library(keras)
imdb <- dataset_imdb(num_words = 10000)
 Error in py_call_impl(callable, dots$args, dots$keywords) : 
  TypeError: update() takes from 2 to 3 positional arguments but 4 were given 

Mac OS 10.13.3
RStudio 1.1.423
R 3.4.3
Keras 2.1.3

This is an error introduced in Keras 2.1.4. You can install the latest version of Keras for R from GitHub to overcome the error: devtools::install_github("rstudio/keras")

Thanks. I'm using 2.1.3 though?
Installing via devtools yields:

Error: package or namespace load failed for ‘keras’ in get(Info[i, 1], envir = env):
 lazy-load database '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/tfruns/R/tfruns.rdb' is corrupt
Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1

The book is nice so far though!

Uninstalling tfruns let me install Keras via CRAN again.

2.1.4 of the core Keras library installed via install_keras

Restart your R session then try installing from GitHub again
On Thu, Feb 22, 2018 at 4:36 PM Ryan Johnson notifications@github.com
wrote:

Thanks. I'm using 2.1.3 though?
Installing via devtools yields:

Error: package or namespace load failed for ‘keras’ in get(Info[i, 1], envir = env):
lazy-load database '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/tfruns/R/tfruns.rdb' is corrupt
Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1

The books is nice so far though!

—
You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub
https://github.com/rstudio/keras/issues/285#issuecomment-367830365, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAGXx-8HXl3GnkSJzRzeD6qPBl_OVvAFks5tXd3sgaJpZM4SFER7
.

I ran into the above errors mentioned, so I uninstalled the keras package and attempted to install it from GitHub and got the following error. Is there a way to install Keras while dodging these errors?
image

text.delete(0,0,tkinter.END)

TypeError: delete() takes from 2 to 3 positional arguments but 4 were given

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LarsHill picture LarsHill  Â·  6Comments

Mrugankakarte picture Mrugankakarte  Â·  5Comments

fderyckel picture fderyckel  Â·  4Comments

jingweihuang picture jingweihuang  Â·  6Comments

gundalav picture gundalav  Â·  3Comments