How to run orca from R? - r

I have installed orca using npm and if I go to my R project folder and type orca --version, I see 1.3.1.
In Rstudio I have installed the processx package. Having produced a fig with plot_ly if I try capture a plot I see the following
orca(fig, 'temp.svg')
Error in processx::run("orca", "-h") :
System command 'orca' failed, exit status: 127, stderr:
E> env: node: No such file or directory
Type .Last.error.trace to see where the error occurred
If I type .Last.error.trace I see the following
Stack trace:
1. plotly:::orca(fig, "temp.svg")
2. plotly:::orca_available()
3. plotly:::correct_orca()
4. processx::run("orca", "-h")
5. throw(new_process_error(res, call = sys.call(), echo = echo, ...
x System command 'orca' failed, exit status: 127, stderr:
E> env: node: No such file or directory
I have restarted Rstudio and restarted R, but still see the problem. How do I fix this?

From your description, I assume that you already installed both orca and processx library. The next steps are:
install standalone Orca desktop app and
Makes the path of the installation accessible from Rstudio
You may skip the step one and directly go to the second step since you mentioned that you already installed the desktop app using NPM. However, I recommend you to reinstall it as I did.
For doing step one with regular installation method, you can download Orca installer (windows-release.zip) from github: orca installer. Then, install the app inside the zip folder.
After installing it, you can go to the second step by doing:
Find your Orca app displayed on your desktop, right-click on the orca icon and select Properties from the context menu.
From the Shortcut tab, copy the directory in the Start in field.
(you need this for adding the app's PATH later in step-7).
hit "windows logo + X" to open Power-User menu, go to SETTING
go to ABOUT, click the Advanced system settings
click the Advanced tab, then click the Environment Variables button near the bottom of that tab
highlight the Path variable in the SYSTEM VARIABLES section and click the Edit button
Add path lines by paste your installation path (from step-2)
Restart your PC to ensure everything runs smoothly.
Finally, you can try your code again in Rstudio. Hope this can help some confusions.

Related

'flutterfire configure' command not working, I need to set firebase in my flutter project

I followed "https://firebase.flutter.dev/docs/overview" instruction to set firebase in my flutter project.
step i took:
"flutter pub add firebase_core" then dependencies were added, and generated_plugin_registrant.dart was created.
generated_plugin_registrant.dart file
2) "dart pub global activate flutterfire_cli" it showed an warnign message ie "Warning: Pub installs executables into C:\Users\Asus\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
A web search for "configure windows path" will show you how.
Activated flutterfire_cli 0.1.1+2."
then i added "C:\Users\Asus\AppData\Local\Pub\Cache\bin" in system; "path" environment variable.
"flutterfire configure" now it gives error "bash: flutterfire: command not found".
Step by step commands for getting flutterfire work in Mac:
dart pub global activate flutterfire_cli
export PATH="$PATH":"$HOME/.pub-cache/bin"
curl -sL https://firebase.tools | bash
firebase login
flutterfire configure
More details here
Windows Step-by-Step guide:
Open the Windows Search Bar, type in “env”, and choose “Edit the system environment variables”
Click the “Environment Variables…”
In System Variables box, search for "PATH" and double click on it
Click "New" and then paste the following line, replacing *USERNAME* with your Windows username
C:\Users\*USERNAME*\AppData\Local\Pub\Cache\bin
Click Ok and restart your IDE, then try flutterfire commands
I had the same problem. Following command worked for me (in Windows).
flutterfire.bat configure
I had same problem and I solved this by:
Added C:\Users\<username>\AppData\Local\Pub\Cache\bin to Environment Path.
Restarted IDE
Executed command: dart pub global activate flutterfire_cli
Here's a solution that worked for me:
From your terminal,open your bash profile in your home directory. Example home directory, Users/your-name/. I'm using macOS, so I typed typed the command sudo vim ~/.bash_profile from my home directory folder, followed by E to edit.
Scroll to the bottom of the file or below # Flutter ENV, on your keyboard, hit i to insert, then paste the following line, export PATH="$PATH":"$HOME/.pub-cache/bin". Press ESC, type ":wq!" then press Enter to save the changes and exit vim.
From the command line, reload your bash profile with source ~/.bash_profile. flutterfire configure should now work.
Hrishabh
This worked for me.
Close your IDE.
Restart IDE.
Re-run "flutter pub add firebase_core" in your terminal.
Finally run "dart pub global acttivate flutterfire_cli" in your terminal.
I had the same problem here is the way to solve it:
Warning: Pub installs executables into C:\Users\userName\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
Go the Windows searchbar and write var
Select modify system environment
Click on environment variables
On system variables click on Path
Click on Edit
On the modify the environment variable windows click on New
Copy paste C:\Users\userName\AppData\Local\Pub\Cache\bin
Close all the windows clicking on Ok
Restart Android Studio
Inside Android Studio terminal write this to check if succeed
dart pub global activate flutterfire_cli
You should have the following message:
The package flutterfire_cli is already activated at newest available version.
On windows, from flutter root folder, running 'flutterfire configure' I got the same error message.
The 'problem' was resolved when I removed the following lines from pubspec.yaml.
plugin:
platforms:
ios:
pluginClass: AppDelegate
(I added those lines in an attempt to create a "podfile" that is required in order to create a binary ios file. )
For me it required a little bit more work but this is what worked for me, I'm using Windows:
As mentioned already before I ran these steps:
1). Search for "Edit System Environment Variables"
2). Click on Environment Variables
3). Under System Variables, double click on "path."
4). Click on "New" and add C:\Users\USERNAME\AppData\Local\Pub\Cache\bin
5). Click OK and restart IDE
After restarting IDE I ran the following commands in the terminal and this time it worked
1). Firstly, flutter upgrade firebase_core
2). Then, I ran dart pub global activate flutterfire_cli again and this time when I ran flutterfire commands it worked.
For me it wasn't working in bash. When i switched over to the standard windows comand prompt it worked.

Can't compile Go application using cgo through TDM-GCC on Windows

I've got the TDM-GCC-64 distribution installed, and set to the PATH variable. I still can't install the cgo distribution github.com/mattn/go-sqlite3. I had CygWin installed before I read the most relevant answer to the question (This). However, installing the tdm distrubution has made no difference.
I get the following error on trying to run the application:
c:\go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lmingwex
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lmingw32
collect2: error: ld returned 1 exit status
It seems that your Go installation is still using Cygwin distribution to invoke gcc very likely because of PATH environment variable setting. Try prepending your PATH environment variable with path to Mingw64 distribution bin\ directory (this will not persist so you need to try go run in same Command Line window):
set PATH=C:\Path\To\Mingw64\Installation\bin;%PATH%
go run whatever.go
(NOTE: make sure you have \bin there. If your Mingw64 distro is installed in C:\Mingw64 it will be C:\Mingw64\bin)
If above helped and you want to fix this permanently (and you don't depend on Cygwin tools in Command Line as doing below will replace some commands with Mingw64 ones) make sure that in your PATH environment variable path to Mingw64 is before the Cygwin path. You can do this by doing following:
Press Windows Key + R to bring up Run dialog
Type rundll32.exe sysdm.cpl,EditEnvironmentVariables and press Enter to bring System variables dialog
In the top section called User variables for USERNAME double-click the row where Variable column is Path to bring up Edit Environment Variable dialog
Now check if row where is path to your Mingw64 installation /bin directory is above the row where path to your Cygwin installation /bin directory is. If it is below click on it to select it and click Move Up button as many times as needed to bring it above Cygwin path.
Once done close both dialogs with OK button
While you can install mingw64 packages in Cygwin it is very likely not compatible with Go tooling and official documentation recommends Mingw64/MSYS as a compiler suite to get gcc - I strongly recommend using latest distribution linked in documentation.

run R as administrator

I was using my own laptop to install R and I found that it only has one library. Evne though this library is still read only, everytime when I use Rstudio: install.packages("abc"), I can see that the new packages are stored automatically into that read only library folder.
In my office's desktop, I "believe" I also have administrator role, as I can install and remove anything (by far). I download the latest version of R and I right click the R-3.4.1-win.exe, there is an item "run as administrator", then it is installed in my desktop. However, when I use R studio to install new packages as in my laptop, it always automatically create a personal folder to store the new packages. I don't know why. Is that a way to only have one folder for library? I also tried on the desktop in the plain R mode (without using Rstudio). When I want to install new packages, it always says
Warning in install.packages("devtools") :
'lib = "C:/Program Files/R/R-3.4.1/library"' is not writable
And there is a window pops up to ask me "would you like to create a personal folder?" And if I say no, then
Error in install.packages("devtools") : unable to install packages.
Is there a ways to solve this problem? To just maintain one folder for library
What version of Windows are you using? You should be able to right-click on the Rstudio.exe icon, click Properties, and select an option to always run Rstudio as administrator. Be sure you use that same icon whenever you want to open Rstudio.
Incase of Mac, go to Applications, then right click on RStudio and
Select "Show Package Contents"
Go to Contents/MacOS
Now open terminal(in bash mode). Type sudo and drag the RStudio.exec into terminal and press on ENTER
Now RStudio will have admin access!
For completeness, I think there should be an Ubuntu answer to go along with the Microsoft and Apple answers. (Note:I'm using 18.06, and not 20.x.)
What doesn't work:
On my Ubuntu/Linux system, when Rstudio is installed the call start RStudio from a terminal looks something like the following:
(base) username#sysname:~$ rstudio
It starts, but has the permissions of the user, and can have access errors.
What gives admin power:
To give it better permissions, you can use sudo.
(base) username#sysname:~$ sudo rstudio
[sudo] password for username: <enter password here>
It starts in a different user location, but has more power. After it is installed you can run it the regular way and the packages are still installed.
Extra credit:
Here are some (currently) relevant links for RStudio on Ubuntu:
https://linuxhint.com/rstudio-for-ubuntu/
https://www.r-bloggers.com/2013/03/download-and-install-r-in-ubuntu/
What is the command to invoke RStudio from Command Line in linux environment?
http://web.cs.ucla.edu/~gulzar/rstudio/index.html

Python bindings not loaded issue in Rstudio

I want to use Tensorflow package for R in Windows.
Done with Python 3.5.x installation from python.org and have installed the Tensorflow R package from devtools::install_github("rstudio/tensorflow")as per the official source https://rstudio.github.io/tensorflow/
I know I am not setting the environment variable in the right way in the windows and/or in the sys.setenv function of R.
Above link says it should be set to Sys.setenv(TENSORFLOW_PYTHON="/usr/local/bin/python").
See below the location of my Python35 folder which includes all the python stuff including the tensorflow library downloaded from the python side:
Python35 folder location:C:\Users\rgupta6\AppData\Local\Programs\Python\Python35
tensorflow folder location: C:\Users\rgupta6\AppData\Local\Programs\Python\Python35\Lib\site-packages\tensorflow
Code I used:
Sys.setenv(TENSORFLOW_PYTHON="C:\\Users\\rgupta6\\AppData\\Local\\Programs\\Python\\Python35")
Sys.setenv(TENSORFLOW_PYTHON="C:\\Users\\rgupta6\\AppData\\Local\\Programs\\Python\\Python35\\Lib\\site-packages\\tensorflow")
I use library(tensorflow) and get no error.
Then I use sess = tf$Session() and get an error:
Error in initialize_python(required_module) : Installation of Python not found, Python bindings not loaded*.
What should I do to make it work?
If you are getting errors such as:
Error in initialize_python(required_module) : Installation of Python not found, Python bindings not loaded
Error: Installation of TensorFlow not found
Python environments searched for 'tensorflow' package:
C:\Users\rgupta6\AppData\Local\Programs\Python\Python35\python.exe
Some error related to file does not exist
While trying to make Tensorflow package to work in Rstudio, the problem is with your environment variable in Windows.
What you need to do is:
From the desktop, right click the Computer icon.
Choose Properties from the context menu.
Click the Advanced system settings link.
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit.
A new pop up will open. Variable name will remain Path. We will change the Variable value to the location of the folder where your tensorflow folder is located. Find it.
For e.g. I changed its value to:
C:\Users\rgupta6\AppData\Local\Programs\Python\Python35\Lib\site-packages\tensorflow
Close all remaining windows. Open Rstudio, and run your "Hello World" program to see if your tensorflow works fine in R:
library(tensorflow)
sess = tf$Session()
hello <- tf$constant('Hello, TensorFlow!')
sess$run(hello)

Rstudio cant detect git

I trying to create a project from version control. However when I click git I get the following error:
Git was not detected on the system path.
Googling showed me that I to specify my git executable in my options:
So therefore I filled in "C:/Program Files/Git/bin/git.exe" in the field named: Git executable.
Having done this I still receive the same error however.
Any thoughts on what goes wrong here?
Configure RStudio to use git
Open RStudio
Click Tools -> Global Options -> Git/SVN
If Git executable shows (none), click Browse and select the git executable installed on your system
Important:
Restart RStudio if you make any changes.
Read this for more info:
https://stat545-ubc.github.io/git03_rstudio-meet-git.html

Resources