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

Question: Is it needed to manually add R installation directory to PATH on Windows? #121

Closed
hongyuanjia opened this issue Sep 13, 2022 · 8 comments

Comments

@hongyuanjia
Copy link

After I ran rig add release on Windows, I still could not run R directly in CMD or Powershell. I thought rig system make-links would add C:\Program Files\R\bin into system PATH but it did not. Do I miss step here? Or is it needed to manually add R installation directory to PATH? Thanks!

@gaborcsardi
Copy link
Member

rig adds c:\program files\R\bin and also c:\program files\rig to the PATH when it is installed:

rig/rig.iss

Line 48 in 8e4382a

ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{autopf}\rig;{autopf}\R\bin"; \

(You need to start a new terminal for this to take effect.)

Maybe you changed the PATH after that? Try to uninstall rig, and then install it again, and see if those directories are in the PATH. If they are not, that's probably a bug in rig.

@hongyuanjia
Copy link
Author

Btw, I installed rig via scoop install rig through the r-bucket scoop bucket. By default, scoop runs with user privilege. Thus, the downloaded rig installer maybe fail to modify the system PATH.

I tried to directly run rig installer and did see C:\Program Files\R\bin and C:\Program Files\rig was added to system PATH. So this seems like a scoop limitation?

It is possible to let rig modify the current user's PATH instead of the system one? This may bypass the permission issue?

@gaborcsardi
Copy link
Member

Oh, right, I didn't know that scoop does not run the installer, but of course this does make sense.

@cderv do you know a way to tell scoop to modify the path?

@cderv
Copy link
Contributor

cderv commented Sep 13, 2022

Yes. Scoop should be able to add C:\Program Files\R\bin to PATH when rig is installed. I see i have it setup on my side, so I did not pay attention it was missing.

@gaborcsardi
Copy link
Member

gaborcsardi commented Sep 13, 2022

@cderv oh, so you can do this in the package description in the bucket? That's what you mean?

@cderv
Copy link
Contributor

cderv commented Sep 13, 2022

Yes - sorry, I was not enough clear.

  • rig is not installed in C:\Program Files\rig but in Scoop folders, and it should already be available in PATH.
  • C:\Program Files\R\bin is currently not handle in the manifest. As it seems it is not handle during the installation, I need to make the addition in the manifest.

I'll check something before though as maybe I can make the installer run 🤔

@cderv
Copy link
Contributor

cderv commented Sep 13, 2022

@hongyuanjia can you try to update the bucket and reinstall

# Update buckets' manifest
scoop update
# Update rig
scoop update -f rig

This should tell you that it is added to User's PATH.

From my test

 scoop install .\bucket\rig.json                                                                                                                                                                                                                                                                                                                                          WARN  Scoop uses 'aria2c' for multi-connection downloads.                                                                                                                                                                                                                                                                                                                  
WARN  Should it cause issues, run 'scoop config aria2-enabled false' to disable it.
WARN  To disable this warning, run 'scoop config aria2-warning-enabled false'.
Installing 'rig' (0.5.1) [64bit]
Loading rig-windows-0.5.1.exe from cache.
Checking hash of rig-windows-0.5.1.exe ... ok.
Extracting rig-windows-0.5.1.exe ... done.
Linking ~\scoop\apps\rig\current => ~\scoop\apps\rig\0.5.1
Creating shim for 'rig'.
Running post_install script...
Adding C:\Program Files\R\bin to Machine Path
'rig' (0.5.1) was installed successfully!
Notes
-----
Usage: Add the following to the end of your PowerShell $profile to get autocompletion:

# Scoop  - rig autocompletion
$rig_ac=$(try { Join-Path -Path $(scoop prefix rig) -ChildPath _rig.ps1 } catch { '' })
if (Test-Path -Path $rig_ac)  { & $rig_ac }

@hongyuanjia
Copy link
Author

@cderv Thanks for the quick fix! I have tested and it works. Close now.

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

3 participants