How to install “devtools” package in R (RStudio 3.4.0)?

Good afternoon. Recently I`ve faced a problem, connected with the installation of "devtools" package in RStudio 3.4.0. When I type:

install.packages("devtools")

The following message appears:

One or more of the packages that will be updated by this installation are currently loaded. Restarting R prior to updating these packages is strongly recommended.

RStudio can restart R and then automatically continue the installation after restarting (all work and data will be preserved during the restart)

Do you want to restart R prior to installing? 

After I press "Yes", restart of the current RStudio session takes place, and the process of "devtools" package installation begins. But the installation process doesn't come to its end, and, finally, the message about the necessity of restarting current RStudio session, described above, appears.

Thank you for your help.

Hello Maxim and welcome to RStudio community. You should try to restart RStudio manually before trying to install devtools. Let me know how it goes.

Hello.
I restart RStudio and then type:
install.packages("devtools")

However, then I receive the following message:
Error in download.file(url, destfile, method, mode = "wb", ...) : cannot open URL 'https://cran.rstudio.com/src/contrib/devtools_2.3.1.tar.gz' Warning in install.packages : download of package ‘devtools’ failed

Therefore, the installation process is cancelled.

Okay well noted.

Make sure that your computer is connected to the internet when you try to install devtools. Then, assuming that you use RStudio, click on the "Packages" tab (usually in the bottom-right pane of your screen), click on "Install", look for devtools in the "Packages" search box and install it from there.

Now, I am not really sure the reason why you want to install devtools. It is a very powerful package and you may want to use it to develop an R package. If that is the case, then let's make sure you successfully install it. However, if your goal is to use its install_github() function to be able to install packages from Github, then let me suggest the remotes package. It does the same thing and is technically easier to install since its dependencies are all base packages.

I followed your recommendations, but, unfortunately, devtools packages wasn't installed.
I received the following error:
Error in library(devtools) : there is no ‘devtools’ package

My primary aim is to successfully install keras and tensorflow packages to use them in order to create machine learning (ML) models. Therefore I need devtools.
I managed to install remotes package, then I tried install_github("rstudio/keras") and, finally, got 2 warning messages:
Warning messages: 1: In untar2(tarfile, files, list, exdir) : skipping pax global extended headers 2: In untar2(tarfile, files, list, exdir) : skipping pax global extended headers

Then, after typing is_keras_available() I received FALSE.

Generally, I need keras_model_sequential() function from keras. But when I type it, I receive the following error:
`Error: Installation of TensorFlow not found.

Python environments searched for 'tensorflow' package:
C:\Users\user\Anaconda3\python.exe

You can install TensorFlow using the install_tensorflow() function.`

Typing install_tensorflow() leads to the following error:
Error in conda_install(envname, packages, conda = conda, ...) : unused argument (python_version = "3.6")

1 Like

Are you following an installation guide? Because I think that you also need to install Python on your computer to use Keras and Tensorflow. Also, are you using your personal computer? I am asking because if you are trying to install packages from an office computer, some security measures may be preventing you from doing the installations.

I'm using my own computer.
Of course, I have also installed Python 3.8.5 and Anaconda before working with keras and tensorflow in RStudio.

Could you copy and paste the entire installation log that you get in your console when you try to install keras. There could be important information in there.

install.packages("keras") library(keras) is_keras_available()

After I run the last code line i receive FALSE.
Warning message: running command '"C:\Users\user\AppData\Local\Programs\Python\PYTHON~1\\python.exe" "C:/Users/user/Documents/R/win-library/3.4/reticulate/config/config.py"' had status 123.

What I meant was the installation log is: when you run install.packages("keras"), copy and paste the entire log that shows up in your console. It is a bit long but may contain useful information to troubleshoot your problem.

I've just started a new R session. Then I ran install.packages("keras")
After this the following information appeared in the console:

`Installing package into ‘D:/user/documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES.rds': HTTP status was '502 Bad Gateway'

There is a binary version available but the source version is later:
binary source needs_compilation
keras 2.2.4.1 2.3.0.0 FALSE

installing the source package ‘keras’

trying URL 'https://cran.rstudio.com/src/contrib/keras_2.3.0.0.tar.gz'
Content type 'application/x-gzip' length 3331721 bytes (3.2 MB)
downloaded 3.2 MB

  • installing source package 'keras' ...
    ** пакет 'keras' удачно распакован, MD5 sums проверены
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
    *** arch - i386
    *** arch - x64
  • DONE (keras)

The downloaded source packages are in
‘D:\user\data\local\RtmpY1CWJA\downloaded_packages’
Warning messages:
1: package ‘rugarch’ was built under R version 3.4.4
2: package ‘h2o’ was built under R version 3.4.4
3: package ‘ghyp’ was built under R version 3.4.4
4: package ‘numDeriv’ was built under R version 3.4.1
5: package ‘gplots’ was built under R version 3.4.4
6: package ‘fBasics’ was built under R version 3.4.3
7: package ‘timeDate’ was built under R version 3.4.2`

Okay this means that keras was successfully installed.

But after all of this I type is_keras_available() and receive FALSE .

Generally, I need keras_model_sequential() function from keras . But when I type it, I receive the following error:
`Error: Installation of TensorFlow not found.

Python environments searched for 'tensorflow' package:
D:\user\Anaconda3\python.exe

You can install TensorFlow using the install_tensorflow() function.`

Typing install_tensorflow() leads to the following error:
Error in conda_install(envname, packages, conda = conda, ...) : unused argument (python_version = "3.6")

And nothing happens.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.