{"action":"created","issue":{"url":"https://api.github.com/repos/rstudio/keras/issues/262","repository_url":"https://api.github.com/repos/rstudio/keras","labels_url":"https://api.github.com/repos/rstudio/keras/issues/262/labels{/name}","comments_url":"https://api.github.com/repos/rstudio/keras/issues/262/comments","events_url":"https://api.github.com/repos/rstudio/keras/issues/262/events","html_url":"https://github.com/rstudio/keras/issues/262","id":291947534,"number":262,"title":"Error in py_call_impl(callable, dots$args, dots$keywords) :    AttributeError: 'int' object has no attribute 'ndim'","user":{"login":"mauzeyj","id":13355915,"avatar_url":"https://avatars0.githubusercontent.com/u/13355915?v=4","gravatar_id":"","url":"https://api.github.com/users/mauzeyj","html_url":"https://github.com/mauzeyj","followers_url":"https://api.github.com/users/mauzeyj/followers","following_url":"https://api.github.com/users/mauzeyj/following{/other_user}","gists_url":"https://api.github.com/users/mauzeyj/gists{/gist_id}","starred_url":"https://api.github.com/users/mauzeyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauzeyj/subscriptions","organizations_url":"https://api.github.com/users/mauzeyj/orgs","repos_url":"https://api.github.com/users/mauzeyj/repos","events_url":"https://api.github.com/users/mauzeyj/events{/privacy}","received_events_url":"https://api.github.com/users/mauzeyj/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-01-26T16:01:29Z","updated_at":"2018-04-18T18:38:37Z","closed_at":"2018-02-02T15:05:38Z","author_association":"NONE","body":"Hello,\r\n\r\nThis issue is very similar to https://github.com/rstudio/keras/issues/33 but with a different error. I can't run any of the R keras imdb examples but can run the mnist examples.  \r\n\r\nThis is a sample of one of the imdb examples that won't run. \r\n```\r\nlibrary(keras)\r\nuse_condaenv('py35', required = TRUE)\r\nreticulate::py_config()\r\ntf_config()\r\n\r\n# Parameters --------------------------------------------------------------\r\n\r\n# Embedding\r\nmax_features = 20000\r\nmaxlen = 100\r\nembedding_size = 128\r\n\r\n# Convolution\r\nkernel_size = 5\r\nfilters = 64\r\npool_size = 4\r\n\r\n# LSTM\r\nlstm_output_size = 70\r\n\r\n# Training\r\nbatch_size = 30\r\nepochs = 2\r\n\r\n# Data Preparation --------------------------------------------------------\r\n\r\n# The x data includes integer sequences, each integer is a word\r\n# The y data includes a set of integer labels (0 or 1)\r\n# The num_words argument indicates that only the max_fetures most frequent\r\n# words will be integerized. All other will be ignored.\r\n# See help(dataset_imdb)\r\nimdb <- dataset_imdb(num_words = max_features)\r\n# Keras load all data into a list with the following structure:\r\nstr(imdb)\r\n\r\n# Pad the sequences to the same length\r\n# This will convert our dataset into a matrix: each line is a review\r\n# and each column a word on the sequence\r\n# We pad the sequences with 0s to the left\r\nx_train <- imdb$train$x %>%\r\n  pad_sequences(maxlen = maxlen)\r\nx_test <- imdb$test$x %>%\r\n  pad_sequences(maxlen = maxlen)\r\n\r\n# Defining Model ------------------------------------------------------\r\n\r\nmodel <- keras_model_sequential()\r\n\r\nmodel %>%\r\n  layer_embedding(max_features, embedding_size, input_length = maxlen) %>%\r\n  layer_dropout(0.25) %>%\r\n  layer_conv_1d(\r\n    filters, \r\n    kernel_size, \r\n    padding = \"valid\",\r\n    activation = \"relu\",\r\n    strides = 1\r\n  ) %>%\r\n  layer_max_pooling_1d(pool_size) %>%\r\n  layer_lstm(lstm_output_size) %>%\r\n  layer_dense(1) %>%\r\n  layer_activation(\"sigmoid\")\r\n\r\nmodel %>% compile(\r\n  loss = \"binary_crossentropy\",\r\n  optimizer = \"adam\",\r\n  metrics = \"accuracy\"\r\n)\r\n\r\n# Training ----------------------------------------------------------------\r\n\r\nmodel %>% fit(\r\n  x_train, imdb$train$y,\r\n  batch_size = batch_size,\r\n  epochs = epochs,\r\n  validation_data = list(x_test, imdb$test$y)\r\n)\r\n```\r\n\r\nAs in the other ticket I saw this is the output i get from reticulate\r\n```\r\n> reticulate::py_config()\r\npython:         C:\\Users\\jmauzey\\AppData\\Local\\conda\\conda\\envs\\r-tensorflow\\python.exe\r\nlibpython:      C:/Users/jmauzey/AppData/Local/conda/conda/envs/r-tensorflow/python36.dll\r\npythonhome:     C:\\Users\\jmauzey\\AppData\\Local\\conda\\conda\\envs\\R-TENS~1\r\nversion:        3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]\r\nArchitecture:   64bit\r\nnumpy:          C:\\Users\\jmauzey\\AppData\\Local\\conda\\conda\\envs\\R-TENS~1\\lib\\site-packages\\numpy\r\nnumpy_version:  1.14.0\r\nkeras:          C:\\Users\\jmauzey\\AppData\\Local\\conda\\conda\\envs\\R-TENS~1\\lib\\site-packages\\keras\r\n```\r\n\r\nAnd the output from the python versions found\r\n\r\n```\r\npython versions found: \r\n C:\\Users\\jmauzey\\AppData\\Local\\conda\\conda\\envs\\r-tensorflow\\python.exe\r\n C:\\Users\\jmauzey\\AppData\\Local\\CONTIN~1\\ANACON~1\\python.exe\r\n C:\\Users\\jmauzey\\AppData\\Local\\Continuum\\anaconda3\\python.exe\r\n C:\\Users\\jmauzey\\AppData\\Local\\conda\\conda\\envs\\my_root\\python.exe\r\n C:\\Users\\jmauzey\\AppData\\Local\\conda\\conda\\envs\\tf-keras\\python.exe\r\n```\r\n\r\nI have been struggling with this for a couple of days.  I had been experiencing another issue and read that uninstalling anaconda would help. I removed it and it solved my problem.  I used R keras for a week but then needed jupyter notebook again so reinstalled anaconda thinking that a fresh installation would help.  R keras hasn't worked after that.  I have attempted uninstalling R, R studio, all python and anaconda installations in an attempt to start from scratch. I have reinstalled reticulate as well. I have also noticed this message when using install_keras()\r\n```\r\n> install_keras()\r\nUsing r-tensorflow conda environment for TensorFlow installation\r\nSolving environment: ...working... \r\nWARNING: The remote server could not find the noarch directory for the\r\nrequested channel with url: https://conda.anaconda.org/conda-forge\r\n\r\nIt is possible you have given conda an invalid channel. Please double-check\r\nyour conda configuration using `conda config --show`.\r\n\r\nIf the requested url is in fact a valid conda channel, please request that the\r\nchannel administrator create `noarch/repodata.json` and associated\r\n`noarch/repodata.json.bz2` files, even if `noarch/repodata.json` is empty.\r\n$ mkdir noarch\r\n$ echo '{}' > noarch/repodata.json\r\n$ bzip2 -k noarch/repodata.json\r\ndone\r\n\r\n# All requested packages already installed.\r\n```\r\nHere are some additional messages I got when using the same commands I saw in the other ticket. \r\n```\r\n> tf_config()\r\nTensorFlow v1.2.1 (C:\\Users\\jmauzey\\AppData\\Local\\conda\\conda\\envs\\R-TENS~1\\lib\\site-packages\\keras)\r\nPython v3.6 (C:\\Users\\jmauzey\\AppData\\Local\\conda\\conda\\envs\\r-tensorflow\\python.exe)\r\n```\r\n```\r\n> devtools::session_info()\r\nSession info ----------------------------------------------------------------------------------------------------------------------------------------------\r\n setting  value                       \r\n version  R version 3.4.3 (2017-11-30)\r\n system   x86_64, mingw32             \r\n ui       RStudio (1.1.419)           \r\n language (EN)                        \r\n collate  English_United States.1252  \r\n tz       America/Denver              \r\n date     2018-01-26                  \r\n\r\nPackages --------------------------------------------------------------------------------------------------------------------------------------------------\r\n package    * version date       source        \r\n base       * 3.4.3   2017-12-06 local         \r\n base64enc    0.1-3   2015-07-28 CRAN (R 3.4.0)\r\n compiler     3.4.3   2017-12-06 local         \r\n datasets   * 3.4.3   2017-12-06 local         \r\n devtools     1.13.4  2017-11-09 CRAN (R 3.4.3)\r\n digest       0.6.14  2018-01-14 CRAN (R 3.4.3)\r\n graphics   * 3.4.3   2017-12-06 local         \r\n grDevices  * 3.4.3   2017-12-06 local         \r\n jsonlite     1.5     2017-06-01 CRAN (R 3.4.3)\r\n keras      * 2.1.3   2018-01-17 CRAN (R 3.4.3)\r\n magrittr     1.5     2014-11-22 CRAN (R 3.4.0)\r\n memoise      1.1.0   2017-04-21 CRAN (R 3.4.0)\r\n methods    * 3.4.3   2017-12-06 local         \r\n R6           2.2.2   2017-06-17 CRAN (R 3.4.3)\r\n Rcpp         0.12.15 2018-01-20 CRAN (R 3.4.3)\r\n reticulate   1.4     2018-01-09 CRAN (R 3.4.3)\r\n stats      * 3.4.3   2017-12-06 local         \r\n tensorflow * 1.5     2018-01-17 CRAN (R 3.4.3)\r\n tfruns       1.2     2018-01-18 CRAN (R 3.4.3)\r\n tools        3.4.3   2017-12-06 local         \r\n utils      * 3.4.3   2017-12-06 local         \r\n whisker      0.3-2   2013-04-28 CRAN (R 3.4.0)\r\n withr        2.1.1   2017-12-19 CRAN (R 3.4.3)\r\n yaml         2.1.16  2017-12-12 CRAN (R 3.4.3)\r\n zeallot      0.0.6   2017-09-28 CRAN (R 3.4.3)\r\n```\r\n\r\nLet me know anything else I can provide. "},"comment":{"url":"https://api.github.com/repos/rstudio/keras/issues/comments/382487507","html_url":"https://github.com/rstudio/keras/issues/262#issuecomment-382487507","issue_url":"https://api.github.com/repos/rstudio/keras/issues/262","id":382487507,"user":{"login":"miladm12","id":14200044,"avatar_url":"https://avatars2.githubusercontent.com/u/14200044?v=4","gravatar_id":"","url":"https://api.github.com/users/miladm12","html_url":"https://github.com/miladm12","followers_url":"https://api.github.com/users/miladm12/followers","following_url":"https://api.github.com/users/miladm12/following{/other_user}","gists_url":"https://api.github.com/users/miladm12/gists{/gist_id}","starred_url":"https://api.github.com/users/miladm12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miladm12/subscriptions","organizations_url":"https://api.github.com/users/miladm12/orgs","repos_url":"https://api.github.com/users/miladm12/repos","events_url":"https://api.github.com/users/miladm12/events{/privacy}","received_events_url":"https://api.github.com/users/miladm12/received_events","type":"User","site_admin":false},"created_at":"2018-04-18T18:38:37Z","updated_at":"2018-04-18T18:38:37Z","author_association":"NONE","body":"I still get the same error: \"Error in py_call_impl(callable, dots$args, dots$keywords)\". \r\n\r\nI did install the development version from github, but when I try to run the command \r\n\r\n```r\r\nhistory <- model %>% fit_generator(\r\n  train_gen,\r\n  steps_per_epoch = 500,\r\n  epochs = 20,\r\n  validation_data = val_gen,\r\n  validation_steps = val_steps\r\n)\r\n```\r\n\r\nI get this error. "}}
{"actor":{"display_login":"miladm12"}}