Knitr package install issues - Error: invalid version specification ‘NA’

Error Information:

Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
no package 'knitr' was found

Description of issue -
Error on startup

Steps taken so far -
Uninstalled/reinstalled R and RStudio roughly 427 times
Googled it
Cried, several times
Cursed
Banged hands on desk

System Information:

  • RStudio Edition: Desktop
  • RStudio Version: Version 1.1.456
  • OS Version: Windows 10
  • R Version: 3.5.1

It's a work desktop. I don't know how to change/set permissions. I don't understand most of the answers to this question on other help forums, so goshdarnit, I am frustrated! Please be very specific and basic. "Oh, have you tried framulating your pathlibobulator settings using frambobulate()? Try that." = Shucks! I don't know how to do that. Thanks in advance.

Also:

  • RStudio diagnostics report:
  • Your sessionInfo():
    R version 3.5.1 (2018-07-02)
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1 yaml_2.2.0

  • RStudio crash report:
  • RStudio application log files:

From Troubleshooting Guide: Using RStudio

Hey @Helpingmeisfun, I'm sorry things are going so badly for you—I, too, am thinking of burning my laptop at the moment (for R-unrelated reasons, ha), so I know the feeling.

Thanks for giving us so much detail about you system and what you're seeing! The one detail I would ask for is exactly how you're trying to install knitr.

  • Are you trying to type install.packages() in the R console in RStudio, or are you using the "Install Packages" option on the Tools menu?
  • If it's the command (the former), what exactly are you typing (including any arguments)?
  • If it's the option on the Tools menu, which options are you selecting in the Install Packages dialog box that pops up ("Install from", "Packages", "Install to Library" and "Install dependencies")?

Fingers crossed we can work it out :slight_smile:

2 Likes

If you've got the bandwidth, I have one more question to add to @rensa's list:

  • When you try to install knitr, some lines of text (or maybe a whole bunch of lines of text!) should start dumping out in the console pane. Can you please try to copy and paste all of those lines here?

(somewhere in the inscrutable mess a clue to the problem can usually be found!)

1 Like

Ouch, sounds like someone had a bad day! Of course, FML = Fix My Ligthhouse, right? :stuck_out_tongue_winking_eye:
Anyway, a couple questions, don't feel offended if they're too naive, I don't know your background:

  • do you know what a proxy is? If you do, do you know what's the URL of your company proxy (I bet your intranet at work is behind a firewall, right)?
  • let me try a very wild guess: this all started because you tried to compile a .Rmd file, and RStudio told you that in order to do that, it had to install up-to-date versions of packages rmarkdown, knitr, etc. Then a new popup opened, you saw a lot of incomprehensible text messages and in the end your .Rmd file did not compile. Correct? Then you went down the rabbit hole of installing/uninstalling/etc. etc.. IF my wild guess is correct, then:
  1. uninstall everything (sorry)
  2. restart Windows
  3. Install CRAN R (you're using CRAN R, right? not Microsoft R Open)
  4. Install this thingie: https://cran.r-project.org/bin/windows/Rtools/Rtools35.exe
  5. Install RStudio

Now, before you do anything else, we need to get the proxy stuff sorted out. And yes, as @jcblum wisely suggested, if you could copy & paste all the incomprehensible mess which is printed out to the console when you first try to install knitr, that would help a lot.


Just a little of background, because I guess you're dying to know what the heck is going on: the error message you reported

Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
no package 'knitr' was found

seems to indicate that knitr, and possibly other packages such as rmarkdown, were not correctly installed. You probably see this message not when you try to install knitr, but afterwards, when you restart R, or when you load knitr, or when you try to knit a .Rmd document.

1 Like

Thanks! And here's the install dump. It also happens just like this if I leave off the "dependencies = TRUE" thing.

> install.packages('knitr', dependencies = TRUE)
Installing package into ‘\\D5H2PFP1/User$/Stephanie/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘colorspace’, ‘labeling’, ‘munsell’, ‘RColorBrewer’, ‘BH’, ‘gtable’, ‘plyr’, ‘reshape2’, ‘scales’, ‘viridisLite’, ‘httpuv’, ‘xtable’, ‘sourcetools’, ‘later’, ‘promises’, ‘lazyeval’, ‘ggplot2’, ‘miniUI’, ‘backports’, ‘assertthat’, ‘ps’, ‘fansi’, ‘utf8’, ‘mime’, ‘glue’, ‘magrittr’, ‘stringi’, ‘htmltools’, ‘jsonlite’, ‘shiny’, ‘crosstalk’, ‘manipulateWidget’, ‘base64enc’, ‘rprojroot’, ‘withr’, ‘processx’, ‘filehash’, ‘Rcpp’, ‘curl’, ‘openssl’, ‘R6’, ‘sysfonts’, ‘showtextdb’, ‘cli’, ‘crayon’, ‘pillar’, ‘rlang’, ‘evaluate’, ‘highr’, ‘markdown’, ‘stringr’, ‘yaml’, ‘formatR’, ‘testit’, ‘digest’, ‘rgl’, ‘rmarkdown’, ‘htmlwidgets’, ‘webshot’, ‘tikzDevice’, ‘tinytex’, ‘xfun’, ‘reticulate’, ‘JuliaCall’, ‘png’, ‘jpeg’, ‘xml2’, ‘httr’, ‘DBI’, ‘showtext’, ‘tibble’


  There are binary versions available but the source versions are later:
        binary source needs_compilation
later    0.7.4  0.7.5              TRUE
stringi  1.1.7  1.2.4              TRUE

  Binaries will be installed
trying URL 'cran.rstudio.com/bin/windows/contrib/3.5/colorspace_1.3-2[dot]zip'
Content type 'application/zip' length 527483 bytes (515 KB)
downloaded 515 KB

#one of the above happened for each of the below...

package ‘colorspace’ successfully unpacked and MD5 sums checked
package ‘labeling’ successfully unpacked and MD5 sums checked
package ‘munsell’ successfully unpacked and MD5 sums checked
package ‘RColorBrewer’ successfully unpacked and MD5 sums checked
package ‘BH’ successfully unpacked and MD5 sums checked
package ‘gtable’ successfully unpacked and MD5 sums checked
package ‘plyr’ successfully unpacked and MD5 sums checked
package ‘reshape2’ successfully unpacked and MD5 sums checked
package ‘scales’ successfully unpacked and MD5 sums checked
package ‘viridisLite’ successfully unpacked and MD5 sums checked
package ‘httpuv’ successfully unpacked and MD5 sums checked
package ‘xtable’ successfully unpacked and MD5 sums checked
package ‘sourcetools’ successfully unpacked and MD5 sums checked
package ‘later’ successfully unpacked and MD5 sums checked
package ‘promises’ successfully unpacked and MD5 sums checked
package ‘lazyeval’ successfully unpacked and MD5 sums checked
package ‘ggplot2’ successfully unpacked and MD5 sums checked
package ‘miniUI’ successfully unpacked and MD5 sums checked
package ‘backports’ successfully unpacked and MD5 sums checked
package ‘assertthat’ successfully unpacked and MD5 sums checked
package ‘ps’ successfully unpacked and MD5 sums checked
package ‘fansi’ successfully unpacked and MD5 sums checked
package ‘utf8’ successfully unpacked and MD5 sums checked
package ‘mime’ successfully unpacked and MD5 sums checked
package ‘glue’ successfully unpacked and MD5 sums checked
package ‘magrittr’ successfully unpacked and MD5 sums checked
package ‘stringi’ successfully unpacked and MD5 sums checked
package ‘htmltools’ successfully unpacked and MD5 sums checked
package ‘jsonlite’ successfully unpacked and MD5 sums checked
package ‘shiny’ successfully unpacked and MD5 sums checked
package ‘crosstalk’ successfully unpacked and MD5 sums checked
package ‘manipulateWidget’ successfully unpacked and MD5 sums checked
package ‘base64enc’ successfully unpacked and MD5 sums checked
package ‘rprojroot’ successfully unpacked and MD5 sums checked
package ‘withr’ successfully unpacked and MD5 sums checked
package ‘processx’ successfully unpacked and MD5 sums checked
package ‘filehash’ successfully unpacked and MD5 sums checked
package ‘Rcpp’ successfully unpacked and MD5 sums checked
package ‘curl’ successfully unpacked and MD5 sums checked
package ‘openssl’ successfully unpacked and MD5 sums checked
package ‘R6’ successfully unpacked and MD5 sums checked
package ‘sysfonts’ successfully unpacked and MD5 sums checked
package ‘showtextdb’ successfully unpacked and MD5 sums checked
package ‘cli’ successfully unpacked and MD5 sums checked
package ‘crayon’ successfully unpacked and MD5 sums checked
package ‘pillar’ successfully unpacked and MD5 sums checked
package ‘rlang’ successfully unpacked and MD5 sums checked
package ‘evaluate’ successfully unpacked and MD5 sums checked
package ‘highr’ successfully unpacked and MD5 sums checked
package ‘markdown’ successfully unpacked and MD5 sums checked
package ‘stringr’ successfully unpacked and MD5 sums checked
package ‘yaml’ successfully unpacked and MD5 sums checked
package ‘formatR’ successfully unpacked and MD5 sums checked
package ‘testit’ successfully unpacked and MD5 sums checked
package ‘digest’ successfully unpacked and MD5 sums checked
package ‘rgl’ successfully unpacked and MD5 sums checked
package ‘rmarkdown’ successfully unpacked and MD5 sums checked
package ‘htmlwidgets’ successfully unpacked and MD5 sums checked
package ‘webshot’ successfully unpacked and MD5 sums checked
package ‘tikzDevice’ successfully unpacked and MD5 sums checked
package ‘tinytex’ successfully unpacked and MD5 sums checked
package ‘xfun’ successfully unpacked and MD5 sums checked
package ‘reticulate’ successfully unpacked and MD5 sums checked
package ‘JuliaCall’ successfully unpacked and MD5 sums checked
package ‘png’ successfully unpacked and MD5 sums checked
package ‘jpeg’ successfully unpacked and MD5 sums checked
package ‘xml2’ successfully unpacked and MD5 sums checked
package ‘httr’ successfully unpacked and MD5 sums checked
package ‘DBI’ successfully unpacked and MD5 sums checked
package ‘showtext’ successfully unpacked and MD5 sums checked
package ‘tibble’ successfully unpacked and MD5 sums checked
package ‘knitr’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\Stephanie\AppData\Local\Temp\Rtmpuwbb6Z\downloaded_packages
Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
  no package 'knitr' was found
2 Likes

Hi rensa and thanks,

  • I am using install.packages. I have tried it with and without "..., dependencies = TRUE".
  • install.packages('knitr', dependencies = TRUE) [see above]

See response to other comment above for the output of that. Looks normal until the end.

2 Likes

Yeah, it definitely looks a bit off! I found this StackOverflow question where someone else had the same problem, but unfortunately nobody got them a solution. One of the commenters suggested updating R, but you're on the latest version.

I'm particularly interested in this line:

Installing package into ‘\D5H2PFP1/User$/Stephanie/R/win-library/3.5’

In this thread, somebody says that a similar error might come up if your computer can't write to the location where you packages are supposed to be (the library)—for example, if the library is on a work network drive. Is there any chance you use R at work? I'm not an expert here, but the path in this error looks like maybe it's a network location. Can anyone else verify this?

1 Like

Ouch, it seems everything was installed correctly! I'm out of my depth here...well, at least I'd say it's not a proxy issue because you're able to download all the packages. Maybe your Windows account doesn't have permissions to write to specific folders...Are you able to install other R packages? For example If you try

install.packages("reprex")

or

install.packages("dplyr")

does it work?

1 Like

Thanks Andrea, and yes, yesterday was beyond bad. Thanks to everyone here for tolerating me. I'll try to get it together.

I sort of know what a proxy is, but here's a twist I should have mentioned: I work from home. So, I'm just connected to the internet as far as I know. I also have a laptop running both R and R Studio, and I do NOT get this error on that, so it is probably something to do with something work-related, but maybe not a proxy? I don't know. :-\ My desktop has a curved 34" monitor, so I'd really prefer to work on it instead of the 13" laptop.

Your guess is close, but I've gotten this error since day 1 on this machine. I've never needed knitr for anything until now, so I've just ignored it. Coursera's classes seem to love knitr and Rmarkdown, both of which do seem super awesome, but I've already quit one class because of this and it feels a bit overwhelming and hopeless.

I will try all of your steps now and report back. I don't know how to begin getting the proxy stuff sorted out. My IT guy is not super helpful.

Thanks!
Steph

2 Likes

Yes, I can install any other package I've tried (e.g., dplyr, gapminder, RHANES, etc.), and never get this error.

And, I can open .rmd files. When I try to CREATE a new Rmarkdown file, it tells me I need updated versions of a bunch of packages, I say okay, it does its thing, then still doesn't work.

I agree, and I think I saw the same StackOverflow post (just prior to a crying jag, if I recall correctly). This was why I said that I don't know how to change/fix permissions. I can ask the IT guy if I MUST, but he's just not very helpful and very slow, so I'm really hoping to get it resolved on my (our) own.

Also, why does every other package under the sun seem to work just fine? If it was a permissions problem, wouldn't everything else not work?

Thanks!

1 Like

@Helpingmeisfun, can you type library() and show me what pops up in the "R packages available" panel? It should be one or more lists of packages that each start with "Packages in library 'C:\Something\something\whatever".

Since this a work installation, I'm wondering if maybe your packages have been spread across one library on your computer and another on a work network drive :slight_smile:

(This'll be a loooooong dump of information, so when you paste it, highlight it all and click the </> button.)

2 Likes

Yes, exactly, when you try to knit a R Markdown document, RStudio says you need up-to-date versions of various packages, as I guessed:

From the text output you showed, It doesn't look like RStudio is trying to compile any package from source. Thus, you shouldn't need https://cran.r-project.org/bin/windows/Rtools/Rtools35.exe. At this point I think @rensa may be right: but maybe for some weird reason R attempts to install packages such as dplyr to a local directory (for which you have write permissions, so the attempt succeeds) and packages such as knitr to a network directory for which you don't have write permissions, so the attempt fails. It seems weird to me (I always thought all packages would be installed to the same library folder), but maybe that's what's happening.

2 Likes

I don't get any errors for any of the other packages in this first batch where it says knitr is, but maybe the fact that I have two libraries is meaningful?

Packages in library ‘\\D5H2PFP1/User$/Stephanie/R/win-library/3.5’:

AlgDesign                           Algorithmic Experimental Design
assertthat                          Easy Pre and Post Assertions
backports                           Reimplementations of Functions Introduced Since R-3.0.0
base64enc                           Tools for base64 encoding
BH                                  Boost C++ Header Files
bindr                               Parametrized Active Bindings
bindrcpp                            An 'Rcpp' Interface to Active Bindings
bitops                              Bitwise Operations
broom                               Convert Statistical Analysis Objects into Tidy Tibbles
callr                               Call R from R
caTools                             Tools: moving window statistics, GIF, Base64, ROC AUC, etc.
cellranger                          Translate Spreadsheet Cell Ranges to Rows and Columns
cli                                 Helpers for Developing Command Line Interfaces
clipr                               Read and Write from the System Clipboard
colorspace                          Color Space Manipulation
conjoint                            An Implementation of Conjoint Analysis Method
crayon                              Colored Terminal Output
crosstalk                           Inter-Widget Interactivity for HTML Widgets
cubature                            Adaptive Multivariate Integration over Hypercubes
curl                                A Modern and Flexible Web Client for R
DBI                                 R Database Interface
dbplyr                              A 'dplyr' Back End for Databases
DDIwR                               DDI with R
DEoptimR                            Differential Evolution Optimization in Pure R
devtools                            Tools to Make Developing R Packages Easier
digest                              Create Compact Hash Digests of R Objects
diptest                             Hartigan's Dip Test Statistic for Unimodality - Corrected
dplyr                               A Grammar of Data Manipulation
evaluate                            Parsing and Evaluation Tools that Provide More Details than the Default
ExPosition                          Exploratory analysis with the singular value decomposition.
fansi                               ANSI Control Sequence Aware String Functions
filehash                            Simple Key-Value Database
flexmix                             Flexible Mixture Modeling
forcats                             Tools for Working with Categorical Variables (Factors)
formatR                             Format R Code Automatically
fpc                                 Flexible Procedures for Clustering
gapminder                           Data from Gapminder
ggfortify                           Data Visualization Tools for Statistical Analysis Results
ggplot2                             Create Elegant Data Visualisations Using the Grammar of Graphics
git2r                               Provides Access to Git Repositories
glue                                Interpreted String Literals
gridExtra                           Miscellaneous Functions for "Grid" Graphics
gtable                              Arrange 'Grobs' in Tables
haven                               Import and Export 'SPSS', 'Stata' and 'SAS' Files
highr                               Syntax Highlighting for R Source Code
hms                                 Pretty Time of Day
htmltools                           Tools for HTML
htmlwidgets                         HTML Widgets for R
httpuv                              HTTP and WebSocket Server Library
httr                                Tools for Working with URLs and HTTP
jpeg                                Read and write JPEG images
jsonlite                            A Robust, High Performance JSON Parser and Generator for R
JuliaCall                           Seamless Integration Between R and 'Julia'
kernlab                             Kernel-Based Machine Learning Lab
knitr                               A General-Purpose Package for Dynamic Report Generation in R
labeling                            Axis Labeling
later                               Utilities for Delaying Function Execution
lazyeval                            Lazy (Non-Standard) Evaluation
lubridate                           Make Dealing with Dates a Little Easier
magrittr                            A Forward-Pipe Operator for R
manipulateWidget                    Add Even More Interactivity to Interactive Charts
markdown                            'Markdown' Rendering for R
mclust                              Gaussian Mixture Modelling for Model-Based Clustering, Classification,
                                    and Density Estimation
memoise                             Memoisation of Functions
mime                                Map Filenames to MIME Types
miniUI                              Shiny UI Widgets for Small Screens
modelr                              Modelling Functions that Work with the Pipe
modeltools                          Tools and Classes for Statistical Models
munsell                             Utilities for Using Munsell Colours
mvtnorm                             Multivariate Normal and t Distributions
openssl                             Toolkit for Encryption, Signatures and Certificates Based on OpenSSL
pillar                              Coloured Formatting for Columns
pkgconfig                           Private Configuration for 'R' Packages
plogr                               The 'plog' C++ Logging Library
plyr                                Tools for Splitting, Applying and Combining Data
png                                 Read and write PNG images
prabclus                            Functions for Clustering of Presence-Absence, Abundance and Multilocus
                                    Genetic Data
prettyGraphs                        publication-quality graphics.
processx                            Execute and Control System Processes
promises                            Abstractions for Promise-Based Asynchronous Programming
ps                                  List, Query, Manipulate System Processes
purrr                               Functional Programming Tools
R6                                  Classes with Reference Semantics
RColorBrewer                        ColorBrewer Palettes
Rcpp                                Seamless R and C++ Integration
readr                               Read Rectangular Text Data
readxl                              Read Excel Files
rematch                             Match Regular Expressions with a Nicer 'API'
reprex                              Prepare Reproducible Example Code via the Clipboard
reshape2                            Flexibly Reshape Data: A Reboot of the Reshape Package
reticulate                          Interface to 'Python'
rgl                                 3D Visualization Using OpenGL
rlang                               Functions for Base Types and Core R and 'Tidyverse' Features
rmarkdown                           Dynamic Documents for R
RNHANES                             Facilitates Analysis of CDC NHANES Data
robustbase                          Basic Robust Statistics
rprojroot                           Finding Files in Project Subdirectories
rstudioapi                          Safely Access the RStudio API
rvest                               Easily Harvest (Scrape) Web Pages
scales                              Scale Functions for Visualization
selectr                             Translate CSS Selectors to XPath Expressions
shiny                               Web Application Framework for R
showtext                            Using Fonts More Easily in R Graphs
showtextdb                          Font Files for the 'showtext' Package
sourcetools                         Tools for Reading, Tokenizing and Parsing R Code
stringi                             Character String Processing Facilities
stringr                             Simple, Consistent Wrappers for Common String Operations
survey                              Analysis of Complex Survey Samples
sysfonts                            Loading Fonts into R
testit                              A Simple Package for Testing R Packages
tibble                              Simple Data Frames
tidyr                               Easily Tidy Data with 'spread()' and 'gather()' Functions
tidyselect                          Select from a Set of Strings
tidyverse                           Easily Install and Load the 'Tidyverse'
tikzDevice                          R Graphics Output in LaTeX Format
tinytex                             Helper Functions to Install and Maintain 'TeX Live', and Compile
                                    'LaTeX' Documents
trimcluster                         Cluster Analysis with Trimming
utf8                                Unicode Text Processing
viridisLite                         Default Color Maps from 'matplotlib' (Lite Version)
webshot                             Take Screenshots of Web Pages
whisker                             {{mustache}} for R, logicless templating
withr                               Run Code 'With' Temporarily Modified Global State
xfun                                Miscellaneous Functions by 'Yihui Xie'
XML                                 Tools for Parsing and Generating XML Within R and S-Plus
xml2                                Parse XML
xtable                              Export Tables to LaTeX or HTML
yaml                                Methods to Convert R Data to YAML and Back

Packages in library ‘C:/Program Files/R/R-3.5.1/library’:

base                                The R Base Package
boot                                Bootstrap Functions (Originally by Angelo Canty for S)
class                               Functions for Classification
cluster                             "Finding Groups in Data": Cluster Analysis Extended Rousseeuw et al.
codetools                           Code Analysis Tools for R
compiler                            The R Compiler Package
datasets                            The R Datasets Package
foreign                             Read Data Stored by 'Minitab', 'S', 'SAS', 'SPSS', 'Stata', 'Systat',
                                    'Weka', 'dBase', ...
graphics                            The R Graphics Package
grDevices                           The R Graphics Devices and Support for Colours and Fonts
grid                                The Grid Graphics Package
KernSmooth                          Functions for Kernel Smoothing Supporting Wand & Jones (1995)
lattice                             Trellis Graphics for R
MASS                                Support Functions and Datasets for Venables and Ripley's MASS
Matrix                              Sparse and Dense Matrix Classes and Methods
methods                             Formal Methods and Classes
mgcv                                Mixed GAM Computation Vehicle with Automatic Smoothness Estimation
nlme                                Linear and Nonlinear Mixed Effects Models
nnet                                Feed-Forward Neural Networks and Multinomial Log-Linear Models
parallel                            Support for Parallel computation in R
rpart                               Recursive Partitioning and Regression Trees
spatial                             Functions for Kriging and Point Pattern Analysis
splines                             Regression Spline Functions and Classes
stats                               The R Stats Package
stats4                              Statistical Functions using S4 Classes
survival                            Survival Analysis
tcltk                               Tcl/Tk Interface
tools                               Tools for Package Development
translations                        The R Translations Package
utils                               The R Utils Package

The shorter list at the end in C:/Program Files/R/R-3.5.1/library is the set of base packages: the ones that come installed with R by default (even if you don't have RStudio). Those are where I'd expect them.

\\D5H2PFP1/User$/Stephanie/R/win-library/3.5 looks like a network location to me. I'm not sure why the problem is just with knitr, though :confused:

Okay, trying to work through how this goes. RStudio wants to update knitr, so it downloads the latest version and then tries to compare that against the present version. It can't because of a network access problem, and it gets NA for the current version.

I'm absolutely spitballing here (we might need to see if RStudio staff can help you), but it's possible that if you're installing a new package, no version check needs to happen. It could be that this network access problem—if it is a network access problem—is limited to whatever mechanism the version check is done by and doesn't affect other operations, like installing or loading packages.

At this point I think @Andrea and I are probably both at the limits of our knowledge, so I'm gonna flag this and hopefully we can get more eyes on it :slight_smile:

3 Likes

Thanks everyone.

I uninstalled; restarted; reinstalled; restarted; deleted every R-related folder I could find; opened R Studio, NO ERROR message, because I deleted the old win-library so didn't have knitr anymore. Cool. Reinstalled knitr...

> install.packages("knitr")
Installing package into ‘\\D5H2PFP1/User$/Stephanie/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘mime’, ‘glue’, ‘magrittr’, ‘stringi’, ‘evaluate’, ‘highr’, ‘markdown’, ‘stringr’, ‘yaml’


  There is a binary version available but the source version is later:
        binary source needs_compilation
stringi  1.1.7  1.2.4              TRUE

  Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/mime_0.5.zip'
Content type 'application/zip' length 46959 bytes (45 KB)
downloaded 45 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/glue_1.3.0.zip'
Content type 'application/zip' length 108452 bytes (105 KB)
downloaded 105 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/magrittr_1.5.zip'
Content type 'application/zip' length 155711 bytes (152 KB)
downloaded 152 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/stringi_1.1.7.zip'
Content type 'application/zip' length 14368013 bytes (13.7 MB)
downloaded 13.7 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/evaluate_0.11.zip'
Content type 'application/zip' length 73445 bytes (71 KB)
downloaded 71 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/highr_0.7.zip'
Content type 'application/zip' length 48212 bytes (47 KB)
downloaded 47 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/markdown_0.8.zip'
Content type 'application/zip' length 189498 bytes (185 KB)
downloaded 185 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/stringr_1.3.1.zip'
Content type 'application/zip' length 194293 bytes (189 KB)
downloaded 189 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/yaml_2.2.0.zip'
Content type 'application/zip' length 203553 bytes (198 KB)
downloaded 198 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/knitr_1.20.zip'
Content type 'application/zip' length 1181722 bytes (1.1 MB)
downloaded 1.1 MB

package ‘mime’ successfully unpacked and MD5 sums checked
package ‘glue’ successfully unpacked and MD5 sums checked
package ‘magrittr’ successfully unpacked and MD5 sums checked
package ‘stringi’ successfully unpacked and MD5 sums checked
package ‘evaluate’ successfully unpacked and MD5 sums checked
package ‘highr’ successfully unpacked and MD5 sums checked
package ‘markdown’ successfully unpacked and MD5 sums checked
package ‘stringr’ successfully unpacked and MD5 sums checked
package ‘yaml’ successfully unpacked and MD5 sums checked
package ‘knitr’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
	C:\Users\Stephanie\AppData\Local\Temp\RtmpEBqezg\downloaded_packages
Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
  no package 'knitr' was found

You know that scene in The Money Pit when the bathtub falls through the floor and Tom Hanks starts crazy-laughing? Yeah...

Regarding the first bit of the install: would specifying "lib" before I do this make a difference? I don't know how to do that, but if someone can tell me, I'll try.

And FYI, knitr DOES show up in the Packages pane, and if I select it (manually or with library(), I don't get any error.

Additional weirdness that might be instructive:

Whenever I click on "Install" in the Packages pane/tab, I get a dialog box asking: "Would you like to create a personal library '//D5H2PFP1/User$/Stephanie/win-library/3.5' to install packages into?"

Click Yes: Box blinks and comes back, nothing happens
Click No: "Unable to install packages (default library '//D5H2PFP1/User$/Stephanie/win-library/3.5' is not writeable).

When I go to that location, Properties>Security says every Group or User Name listed has full permission for every activity, e.g., Full control, Modify, Read & execute, List folder contents, Read, Write, and Special permissions all have a check under Allow. I believe I (Stephanie) have administrator rights (I think I remember IT guy telling me this), so I'm stumped.

Uhhhh...I might have fixed it, but probably not properly, so I'm going to tell you what I did and maybe someone smarter can comment.

  1. Did what responder Eric Krantz said about creating R_LIBS_USER in Windows environmental variables here: https://stackoverflow.com/questions/31707941/how-do-i-change-the-default-library-path-for-r-packages/42643674

  2. Opened RStudio as an administrator.

  3. Opened Tools>Install packages and changed Install to Library to the new location I pointed to in step 1. Also disabled the packages pane. I don't know why.

  4. Tried installing knitr using the Tools>Install Packages method. Worked; no error message.

  5. Re-enabled the packages pane. Now when I click on Install from the packages pane, I don't get the dialog box asking if I want to create a new folder. I get the same dialog box as when you click Tools>Install Packages.

  6. Tried creating a new Rmarkdown file; no errors, no updates required. Seems to work fine.

I also changed the default directory to a new place where I have full permissions under Tools>Global Options>Default Working Directory. Pointed to the mother folder of the new library I created for the process above.

Is all of this okay? Have I exposed myself to new and different problems in the future to fix the current problem?

Thanks again!

2 Likes

I'm not a certified Windows sysadmin, so I cannot give you a formal guarantee, but I'm 95% sure you haven't exposed yourself to new problems in the future! As a matter of fact, this step

was the next thing I was going to suggest you to attempt. Well, all is well what ends well! :beers:

2 Likes

Yeah, I agree—although it might mean a talk with your IT person at some point down the line, I think relocating your R library is probably the most sensible solution :smiley:

1 Like