MikhailArkhipov / vscode-r

R Tools for VS Code
Other
82 stars 6 forks source link

command not found: Not supported on Mac? #19

Closed simplificate closed 4 years ago

simplificate commented 5 years ago

Hi there,

I was kicking the tires on this project and had trouble getting this (and, really, any) R-related extension working on Mac. I found this article on RTVS (from Jan 2018), which said:

RTVSis not presently supported on Visual Studio for Mac.

I know that this project is derived from RTVS, so I wondered if that was the root cause (although your extension says it supports Mac). I also tried this on two different Macs and got the same result. Here are the steps I took:

Error:

command 'r.createRTerm' not found

I found this page which suggested running an npm install in the extension folder. Here's the path where I found it:

/.vscode/extensions/mikhail-arkhipov.r-0.0.5

This didn't help. Here's a dump of what happened:

WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/isarray-1958e99d/package.json'
WARNWARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-glob-c65b67ee/package.json'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-extglob-3fd7b62d/package.json'
 tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/isarray-1958e99d/README.md'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-glob-c65b67ee/README.md'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-extglob-3fd7b62d/README.md'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/isarray-1958e99d/index.js'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-glob-c65b67ee/LICENSE'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-extglob-3fd7b62d/LICENSE'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-glob-c65b67ee/index.js'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-extglob-3fd7b62d/index.js'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/typescript-6ee193c8/lib/tsserver.js'
npm ERR! code E404
npm ERR! 404 Not Found: event-stream@3.3.6

I have a tech background and have used R Studio, but I'm not an expert in either of these. I'm an analyst and I mostly use VSC for writing SQL for my day job. I also understand this is a volunteer project, so I appreciate the help!

Thanks, Ken

hongooi73 commented 5 years ago

See #7. Waiting a bit before starting the terminal may make the problem go away.

MikhailArkhipov commented 5 years ago

Is startup complete as in

image

or the extension is still loading?

MikhailArkhipov commented 5 years ago

Also, you may have to save the new file with .r extension first since otherwise VS Code does not know that the file is in R.

simplificate commented 5 years ago

@MikhailArkhipov ah, thanks for the pointer to look in the Output for the Startup Log. Here's what it says:

> Checking for .NET Core... OK
> Installing libzip (required for the R process executable)... undefined

I'm going to try to install libzip and see if that helps.

simplificate commented 5 years ago

Ok, brew install libzip appeared to clear the libzip error. I quit and relaunched VSC and saw this:

R Tools Startup Log

> Checking for .NET Core... OK
> Activating R Language Server...

This time, though, the extension told me with a notification it couldn't be started. Here's a new error in the R Tools Output.

R Tools

> [Error - 5:18:45 PM] Starting client failed
> Launching server using command dotnet failed.

Going to google the second line in this log...

simplificate commented 5 years ago

I can run dotnet from the command line. I also installed the .Net Core 2.1 library (I already had 2.2) in case of weird incompatibility. That didn't fix the issue. Am I missing something else?

> $ dotnet --list-runtimes
> Microsoft.AspNetCore.All 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
> Microsoft.AspNetCore.App 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
> Microsoft.NETCore.App 2.1.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
> Microsoft.NETCore.App 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

As a sanity check, here's R:

> $ r
> 
> R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
> Copyright (C) 2018 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin15.6.0 (64-bit)
> 
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
> 
>   Natural language support but running in an English locale
> 
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
> 
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
> 
> > q()
> $ which r
> /usr/local/bin/r

I saw that Issue #2 was actually cited in the changelog as having to do with libzip. Reading through it, I saw Mikhail recommend checking the Microsoft R Host. I'm not sure if this means anything, but I tried it:

> $ pwd
> /Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/ls/Host/Mac
> $ ./Microsoft.R.Host 
> Segmentation fault: 11
MikhailArkhipov commented 5 years ago

Yep, that is missing libzip. Installing libzip (required for the R process executable)... undefined means extension attempted to install libzip via brew install libzip but failed. However, lack of "Installing Homebrew (required to install libzip library)... " tells that homebrew is installed.

simplificate commented 5 years ago

Thank you @MikhailArkhipov. Libzip is successfully installed now, but I can’t make heads or tails of the new error:

> [Error - 5:18:45 PM] Starting client failed
> Launching server using command dotnet failed.
MikhailArkhipov commented 5 years ago

Do you still get > Segmentation fault: 11?

simplificate commented 5 years ago

@MikhailArkhipov yes, same result

hmassalha commented 5 years ago

vscode-insider solved the problem for mac users

ECon87 commented 4 years ago

Hi, I am facing the same issue. Are there any updates? I am very new to vscode but is there a way to specify the directory for the libzip library?

hongooi73 commented 4 years ago

Unfortunately it looks like Mikhail has moved on to other projects. This was always meant to be more of a personal project anyway, not a Microsoft-supported extension.

You can try the other R extension for VSCode, which is still actively supported:

https://github.com/Ikuyadeu/vscode-R

It works very well in conjunction with the R LSP client, for tooltip help and language completion features:

https://github.com/REditorSupport/vscode-r-lsp

ECon87 commented 4 years ago

Thanks for the reply.

I think that I have found a workaround for MacOS. If you start VS Code via the terminal then "R Tools" seems to work (open -a Visual\ Studio\ Code). This is a workaround I found in the "LaTeX workplace" github, and it has to do with the PATH set by the different ways of launching the app.

I get a new error (see below) but r tools seems to work in the editor itself. Maybe I am wrong.

[Error - 10:39:41 AM] Connection to server is erroring. Shutting down server.

A fatal error occurred, the folder [/usr/local/share/dotnet/host/fxr] does not contain any version-numbered child folders

MikhailArkhipov commented 4 years ago

libzip dependency removed in 0.0.10