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

install_keras() fails #367

Closed
WT215 opened this issue Apr 17, 2018 · 7 comments
Closed

install_keras() fails #367

WT215 opened this issue Apr 17, 2018 · 7 comments

Comments

@WT215
Copy link

WT215 commented Apr 17, 2018

Hi,

I am using Windows 8. I installed anaconda3 and run Rstudio from the Navigator. Then I connected anaconda with the base R : "\Anaconda3\lib\R".

I can successfully install keras via: install.packages('keras'). However, when I run install_keras(), I got the following error:

> install_keras()
Error: lexical error: invalid char in json text.
                                       Usage: conda [options] [INPUTFI
                     (right here) ------^
In addition: Warning message:
running command '"D:\ProgramData\Anaconda3\Scripts\conda.exe" info --json' had status 2 

Here are some more details:

> session_info()
Session info ------------------------------------------------------------------
 setting  value                         
 version  R version 3.4.3 (2017-11-30)  
 system   x86_64, mingw32               
 ui       RStudio (1.1.423)             
 language (EN)                          
 collate  Chinese (Simplified)_China.936
 tz       Europe/London                 
 date     2018-04-17                    

Packages ----------------------------------------------------------------------
 package       * version date       source        
 base          * 3.4.3   2018-01-10 local         
 compiler        3.4.3   2018-01-10 local         
 curl            3.1     2017-12-28 local         
 datasets      * 3.4.3   2018-01-10 local         
 devtools      * 1.13.3  2017-08-02 CRAN (R 3.4.1)
 digest          0.6.13  2017-12-14 CRAN (R 3.4.3)
 graphics      * 3.4.3   2018-01-10 local         
 grDevices     * 3.4.3   2018-01-10 local         
 httr            1.3.1   2017-08-20 CRAN (R 3.4.3)
 jsonlite        1.5     2017-06-01 CRAN (R 3.3.2)
 keras         * 2.0.6   2017-08-30 CRAN (R 3.4.1)
 knitr           1.18    2017-12-27 CRAN (R 3.4.3)
 magrittr        1.5     2014-11-22 CRAN (R 3.4.3)
 memoise         1.1.0   2017-04-21 CRAN (R 3.4.1)
 methods       * 3.4.3   2018-01-10 local         
 R6              2.2.2   2017-06-17 CRAN (R 3.3.2)
 Rcpp            0.12.14 2017-11-23 CRAN (R 3.4.3)
 reticulate      1.1     2017-08-26 CRAN (R 3.4.1)
 RevoUtils     * 10.0.8  2018-02-07 local         
 RevoUtilsMath * 10.0.1  2017-09-19 local         
 rsconnect       0.8.5   2017-08-23 CRAN (R 3.4.3)
 stats         * 3.4.3   2018-01-10 local         
 tensorflow      1.3.1   2017-08-26 CRAN (R 3.4.1)
 tfruns          0.9.1   2017-08-24 CRAN (R 3.4.1)
 tools           3.4.3   2018-01-10 local         
 utils         * 3.4.3   2018-01-10 local         
 withr           2.1.1   2017-12-19 CRAN (R 3.4.3)
 yaml            2.1.16  2017-12-12 CRAN (R 3.4.3)

Cheers,
Wenhao

@WT215
Copy link
Author

WT215 commented Apr 18, 2018

I uninstalled anaconda2, which was installed a long time ago. Then I can run install_keras() successfully.

However, when I proceed to the following code:

> mnist <- dataset_mnist()
D:\ProgramData\Anaconda3\envs\r-tensorflow\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters

Using TensorFlow backend.

Downloading data from
 
https://s3.amazonaws.com/img-datasets/mnist.npz


 Show Traceback
 
 Rerun with Debug
 Error in py_call_impl(callable, dots$args, dots$keywords) : 
  TypeError: 'int' object is not callable 

May I ask what causes these problems?

Many thanks!

@WT215
Copy link
Author

WT215 commented Apr 18, 2018

I closed another R session, and then rerun > mnist <- dataset_mnist(), and it works!

@WT215 WT215 closed this as completed Apr 26, 2018
@PaolaGhione
Copy link

Hi,
I got the same trouble when I tried to install keras package in rstudio and I got the following error:

keras::install_keras()
Error: lexical error: invalid char in json text.
WARNING: The conda.compat modul
(right here) ------^

@BrianCollinss
Copy link

Same here, with python 3.6.8 on Anaconda.

> library(tensorflow)
> install_tensorflow(version='v1.13',method='conda')
Error: lexical error: invalid char in json text.
                                       WARNING: The conda.compat modul
                     (right here) ------^

@rgurlek
Copy link

rgurlek commented Apr 10, 2019

I got the same error. Any suggestion?

@BrianCollinss
Copy link

Follow this: #733 (comment)

@PaolaGhione
Copy link

Hi everybody, after many attempts, I got this solution:
1.) installation of R 3.5.2 (independent from directory (standard or any other)
2.) installation of RStudio (independent from directory)
3.) RStudio -> Tools -> Global Options -> Packages -> Disable both "Use secure download method for HTTP" and "Use Internet Explorer library/proxy for HTTP"
4.) installation of Miniconda3 (-> has to be the standard directory!) Version 4.5.11 (it did not work with the newest version)
5.) Use RStudio ->
install.packages("tensorflow")
install.packages("keras")
library("keras")
install_keras()
This worked for me and I am now able to use Keras in R!

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

4 participants