how do I find out what path R is searching when it give the error: The system cannon find the path specified?

I want to know where R is looking for the path. If I could figure that out, I think this error message could be solved and also the fact that if I use the "build" button, it also cannot filnd my RTools40.

Thanks.

hnelson3@ICWWOLFRAM01VG MINGW64 ~/projects
$ R CMD build test1
The system cannot find the path specified.
* checking for file 'test1/DESCRIPTION' ... OK
* preparing 'test1':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
Omitted 'LazyData' from DESCRIPTION
* building 'test1_0.1.0.tar.gz'

In general R uses the path just like any other program.

Do you know what program R is looking for? It apparently does not cause a fatal error, in fact this does not even look like an error, it is just a message on the screen.

Did you put Rtools40 on the path, as described here in "Putting Rtools on the PATH":
https://cran.r-project.org/bin/windows/Rtools/rtools40.html

Yes I went through all the steps on that page. This is why if I could figure out what path R was looking for, I could figure out why it isn't being found. It is clear that when it looks for RTools40 it is also looking in that unknown same path. By the way, the install.packages('json') listed that page fails for the same reason. Everything else works including the part that locates the RTools executable.

I have asked this question about four or five times with different versions and never gotten an answer. Also if you search the questions, lots of people have similar problems. But knowing what R is trying to do would definitely help figure out why it is unable to do it.

So, if I could influence a little, the the error message "could not find the path" would also indicate what path it was trying to find.

What is the output of these commands from R?

Sys.getenv("PATH")
dir("C:\rtools40")

It is jsonlite, not json, and it does not use rtools40, unless you also specify type = "source".

Sys.getenv('PATH')
[1] "C:\\R\\rtools40\\\\usr\\bin;C:\\R\\rtools40\\\\usr\\bin;C:\\Program Files\\R\\R-4.1.2\\bin\\x64;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Oracle\\app\\client\\product\\12.2.0\\client_1;C:\\Oracle\\app\\client\\product\\12.2.0\\client_1\\bin;C:\\Program Files\\Microsoft MPI\\Bin\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Microsoft SQL Server\\130\\DTS\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\130\\DTS\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\dotnet\\;C:\\Program Files (x86)\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\140\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\140\\DTS\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\140\\Tools\\Binn\\ManagementStudio\\;C:\\Program Files (x86)\\Microsoft SQL Server\\150\\DTS\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn\\;C:\\Program Files (x86)\\Wolfram Research\\WolframScript\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\nodejs\\;C:\\Program Files (x86)\\dotnet\\;C:\\Program Files\\Wolfram Research\\WolframScript\\;C:\\Program Files\\Azure Data Studio\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\R\\rtools40\\\\usr\\bin\\;C:\\Users\\hnelson3\\AppData\\Local\\Programs\\Azure Data Studio\\bin;C:\\Program Files\\Azure Data Studio\\bin;C:\\Users\\hnelson3\\AppData\\Local\\Programs\\Microsoft VS Code Insiders\\bin;C:\\R\\rtools40\\\\usr\\bin\\;C:\\Users\\hnelson3\\AppData\\Roaming\\TinyTeX\\bin\\win32"

Looks that the path can be cleaned up, I can try doing that

dir("C:\rtools40")

returns character(0) most likely because that command is not actually doing what it seems to be doing. For example, does the \ have to be escaped?

Thanks for your response. If this problem got solved it would be great. Having worked at many organizations, the biggest problem with using r/RStudio is there is no IT support, so solving problems like this are left to me and eventually I encounter a problem that I cannot solve and that becomes the barrier making use of r less that optimal.

dir("C:\\rtools40")
 [1] "autorebase.bat"  "clang32"         "clang32.exe"     "clang32.ico"     "clang32.ini"     "clang64"         "clang64.exe"     "clang64.ico"    
 [9] "clang64.ini"     "clangarm64"      "clangarm64.ico"  "dev"             "etc"             "home"            "mingw32"         "mingw32.exe"    
[17] "mingw32.ico"     "mingw32.ini"     "mingw64"         "mingw64.exe"     "mingw64.ico"     "mingw64.ini"     "msys2.exe"       "msys2.ico"      
[25] "msys2.ini"       "msys2_shell.cmd" "opt"             "tmp"             "ucrt64"          "ucrt64.exe"      "ucrt64.ico"      "ucrt64.ini"     
[33] "unins000.dat"    "unins000.exe"    "usr"             "var"          
dir("C:\\r\\rtools40")
 [1] "autorebase.bat"  "clang32"         "clang32.exe"     "clang32.ico"     "clang32.ini"     "clang64"         "clang64.exe"     "clang64.ico"    
 [9] "clang64.ini"     "clangarm64"      "clangarm64.ico"  "dev"             "etc"             "home"            "mingw32"         "mingw32.exe"    
[17] "mingw32.ico"     "mingw32.ini"     "mingw64"         "mingw64.exe"     "mingw64.ico"     "mingw64.ini"     "msys2.exe"       "msys2.ico"      
[25] "msys2.ini"       "msys2_shell.cmd" "opt"             "tmp"             "ucrt64"          "ucrt64.exe"      "ucrt64.ico"      "ucrt64.ini"     
[33] "unins000.dat"    "unins000.exe"    "usr"             "var"       

I am not sure why you have it in c:\r\rtools40, that is not needed.

What version of R is this? Can you run getRversion() in RStudio?

What is the output if you press the 'Build' button in RStudio?

That c:\r\rtools40 was the result of following direction on a youtube.com video that promised to fix my problem. It didn't. But I also have rtools in c:\rtools40 so that is not what is causing the problem

The output of the "Build" Button that is asks to install rtools. If I let it do that, it will install rtools which I can verify by looking at the c: drive. If I build again, the exact same thing will happen.

getRversion()
[1] ‘4.1.2’

Can you install the pkgbuild package and run this?

pkgbuild::has_rtools(debug = TRUE)

What version of RStudio is this?

pkgbuild::has_rtools(debug = TRUE)
Found in Rtools 4.0 installation folder
[1] TRUE

Workaround Using CMD

In a way, It looks like I found a work around. The build works from the command line even though it doesn't work with the RStudio action button. I can create a tar.gz file for the package, then install it.

First Build the Package

hnelson3@ICWWOLFRAM01VG MINGW64 ~/projects
$ R CMD build test1
The system cannot find the path specified.
* checking for file 'test1/DESCRIPTION' ... OK
* preparing 'test1':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
Omitted 'LazyData' from DESCRIPTION
* building 'test1_0.1.0.tar.gz'


hnelson3@ICWWOLFRAM01VG MINGW64 ~/projects
$

Next Build the Package

hnelson3@ICWWOLFRAM01VG MINGW64 ~/projects
$ ls
test1  test1_0.1.0.tar.gz  testpackage

hnelson3@ICWWOLFRAM01VG MINGW64 ~/projects
$ R CMD INSTALL test1
The system cannot find the path specified.
* installing to library 'C:/Users/hnelson3/R/win-library/4.1'
* installing *source* package 'test1' ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'test1'
    finding HTML links ... done
    hello                                   html
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (test1)

hnelson3@ICWWOLFRAM01VG MINGW64 ~/projects
$

What is your RStudio version?

The RStudio Version is 2021.09.2 Build 382

This is clearly an RStudio issue, so maybe you are better off asking a new question (referring to this one) with the appropriate tag.

You could also check the project options in Tools -> Project options -> Build tools, to see if anything seems off there. You can try to delete the RStudio project file (make a backup first), and then re-create it, to start with a clean sheet.

FWIW I have the following here:
INSTALL and restart...: --no-multiarch --with-keep.source
check package: --timings
check package: empty (I have no clue why this is twice)
build binary: empty

Thanks. I keep wondering what path it is looking for when it says it cant find the path. If i knew that, I might be able to fix it. Could be some odd system configuration on my machine.

This topic was automatically closed after 45 days. 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.