ArgParse #add_arg_table not recognized in Julia - 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!

Related

Rcpp can't find nloptrAPI.h header

I'm trying to find an Rcpp replacement for the base optimize function. This link
https://github.com/eddelbuettel/rcppnloptexample/blob/master/src/nlopt.cpp
is a potential solution but I can't get past the sourceCpp error
Error in Rcpp::sourceCpp("R/nlopt.cpp") :
Error 1 occurred building shared library.
> library('nloptr')
> Rcpp::sourceCpp("R/nlopt.cpp")
nlopt.cpp:4:10: fatal error: 'nloptrAPI.h' file not found
The header file is in fact on my computer at /Library/Frameworks/R.framework/Versions/4.1/Resources/library/nloptr/include
I can include the whole path to the header and it seems to work fine but that seems a bit kludgy.
What do I need to do to tell R or Rcpp where to look?
This link as some useful discussion about the issue of finding headers.
https://stackoverflow.com/questions/13995266/using-3rd-party-header-files-with-rcpp has useful information.
To find out where your 'missing' header is located, the /Library/Frameworks ... link above is useful, replacing nloptr with the name of the package that has the header you are looking for.

XRJulia and findJulia in MacOSX

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")

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!

Resources