Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
axiomoixa opened this issue Feb 14, 2018 · 10 comments
Closed

Comments

@axiomoixa
Copy link

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
> 
@thomasp85
Copy link

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)

@axiomoixa
Copy link
Author

@thomasp85
downgrading to Keras 2.1.3 at Python remedies the problem

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

@jjallaire
Copy link
Member

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

@jjallaire
Copy link
Member

Fixed via #285

@rtjohn
Copy link

rtjohn commented Feb 22, 2018

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

@jjallaire
Copy link
Member

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")

@rtjohn
Copy link

rtjohn commented Feb 22, 2018

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.

@jjallaire
Copy link
Member

jjallaire commented Feb 22, 2018 via email

@obewanjacobi
Copy link

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

@zzyopython
Copy link

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants