XRJulia and findJulia in MacOSX - r

I'm having problem in MacOSX when trying to use XRJulia package.
When I run FindJulia, I get the error:
"Error in findJulia() :
No julia executable in search path and JULIA_BIN environment variable not set"
There seems to be an answer here but I don't really understand it,
How do I add a "key" in MacOSX and how do I add Julia to the path? A step by step explanation would be very much appreciated,
Thanks
EDIT: I resolved the problem and here is the piece of code I used for setup:
julia_setup(JULIA_HOME="/Applications/Julia-1.0.app/Contents/Resources/julia/bin")

Related

Julia doesn't find packages in depot_path anymore

I have a problem with using packages in Julia. It has worked before, and I'm not really sure why this has changed or how to troubleshoot.
I have a folder
/my_path/julia/packages
with Julia packages. For example, there is a folder
/my_path/julia/packages/FFTW/
with the FFTW package.
Further, I have changed the depot path to point at this directory by assigning JULIA_DEPOT_PATH before starting julia, so that
Base.DEPOT_PATH = ["/my_path/julia/"]
However, if I run
julia> using FFTW
I get the following error message:
ERROR: ArgumentError: Package FFTW not found in current path:
- Run `import Pkg; Pkg.add("FFTW")` to install the FFTW package.
Any idea how I can troubleshoot or fix this?
Manipulating Base.DEPOT_PATH does not seem like a good idea.
The code proposed by #cmc will does not work (at least on Julia 1.3.1):
julia> Base.DEPOT_PATH = ["/some/path"]
ERROR: cannot assign variables in other modules
There is a workaround:
Base.DEPOT_PATH[1] = "/some/path"
However, the correct way is to assign the JULIA_DEPOT_PATH system variable before starting Julia, Windows:
set JULIA_DEPOT_PATH=c:\some\path
or
set JULIA_DEPOT_PATH=c:\some\path1;c:\some\path2
Linux/OSX:
export JULIA_DEPOT_PATH=/some/path
or
export JULIA_DEPOT_PATH=/some/path1:/some/path2
Unless you have a specific reason to do so (and if this is the case I'd be interested to hear it!), you don't need to fiddle with the DEPOT_PATH or LOAD_PATH variables: using Julia's package manager should be enough to cover your needs most of the time.
In this specific instance, have you tried to do what the error message suggests?
julia> import Pkg
julia> Pkg.add("FFTW")
LOAD_PATH, not DEPOT_PATH, will modify code loading.
You want to do something like push!(LOAD_PATH, /my_path/julia/packages).
I will echo #ffevotte and strongly suggest to not modify LOAD_PATH unless necessary. The benefits of organizing dependencies into Pkg environments far outweigh the small overhead of declaring them explicitly through Pkg.add.

kerasR giving error

I am trying to use kerasR for deep learning in R. I am trying to reproduce the examples in the package. Trying the following code produces error:
library(kerasR)
mod <- Sequential()
The error is:
Error in Sequential() : attempt to apply non-function
I'd suggest to look at this issue in KerasR Github repo:
https://github.com/statsmaths/kerasR/issues/1
Basically you should check where is located your version of python and then use reticulate::use_python("PATH_TO_PYTHON") to tell the system where to find Python.
Watch Out!
You can load just one Python interpreter per session and the use_python() function doesn't warn you if there already is a loaded interpreter.
Moreover if you run py_config() it automatically loads the first interpreter that he finds (which, in your case, seems to be the wrong one!), thus you'd better call reticulate::use_python("PATH_TO_PYTHON") before anything else.

Installing / Using R Packages in Sublime Text 3

I am trying to use the R function dmvnorm (found in the mvtnorm package) in Sublime Text 3. I installed it and ran my code in RStudio, so I know the code is fine. In sublime, I entered:
install.packages('mvtnorm',repos='http://cran.us.r-project.org')
library(mvtnorm)
It looked as though it worked, but when I ran my code it said:
Error: could not find function "dmvnorm"
I'm using a Mac and my hunch is this is somehow related to specifying the path in Preferences -> Package Settings -> Sublime REPL -> Settings - User. The current path displayed as part of the error reads:
[path: /usr/bin:/bin:/usr/sbin:/sbin]
Thanks!
I had a hard time with this recently as well. I'm very new to R so I'm not sure this is the best answer, but to hold you off until someone gives a better one, did you include library('package.name') in the file (in sublime)? require('package.name') also works, but this appears not to be best practice for reasons described, e.g., here.
I hope this helps!

ArgParse #add_arg_table not recognized in Julia

I'm using Julia v0.3.9 right now. I recently updated all my packages (I haven't opened Julia in a couple months), including ArgParse. The macro #add_arg_table isn't recognized though. In particular, I tried running example code here, but I get the following error:
ERROR: #add_arg_table not defined
in include at /Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib
in include_from_node1 at /Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib`
while loading /Users/Uthsav/Desktop/Walking The Interactome Work/arg.jl, in expression starting on line 42
This is essentially the problem I'm having in my own code. I looked but couldn't find any information about this besides what it says on the Github, which is that the macro #add_arg_table should still work. Any help would be greatly appreciated. Thanks a lot!

Error with setwd in R

When trying to use the sample code for SubgraphMining (the example is on 35th page), I get an error:
"Error in setwd(paste(Sys.getenv("R_HOME"), "library", "subgraphMining", :
cannot change working directory"
I'm using RStudio 0.97.551, 32-bit R (2.15.3 - this version of R was recommended to use with subgraphMining), igraph0 (was recommeded too, instead of igraph library), Java installed. Operation system is Windows 8.
Can anyone help me with the issue?
The error message is coming from the gspan function of subgraphMining, from here:
setwd(paste(Sys.getenv("R_HOME"), "library", "subgraphMining",
"parsemis", sep = "\\"))
The reason for it is that R uses / as path separator, and not \\, which only works on windows. A workaround is not modify the function and use / instead of \\.
Btw. this has nothing to do with the igraph package, so I'll remove that tag.
In my case, it displayed the error because I expected it to create a new folder which I mentioned in the path in setwd. Unfortunately, R does not have this functionality and the matter was resolved when I created the folder and then used setwd command.
I know it's almost 1 year since this question was posted. I encountered the same problem with subgraphMining package. A quick hack is: You can write "gspan" on RStudio's command line and it will show the function, copy that function and create your own function in your own script (of course with new name, let's say gspanNew) and fix it by replacing "\\" with "/", as Gabor Csardi pointed out.
Cheers! :)
You can always use file.path("path","with","code") instead of simple paste in order for your code to be OS independent.

Resources