Torch7 user-defined package not found - torch

I am inside a directory structure where I have:
--train.lua
--utils
--sample.lua
train.lua has got an import line saying require('sample'), however when running the code Torch7 complains with the message
"module 'sample' not found:No LuaRocks module found for sample
I have tried changing instead to require('utils.sample'), but it still crashes. How to overcome this error?

I do not have the problem you described. Could you post the code in the files?
My three files:
main.lua
require 'utils.sample'
help()
utils/sample.lua
function help()
print("help")
end
I using th main.lua to run the code

Related

Created R Package, Unable to Display Photo

Update
Issue resolved
Update, still not working
Tried the following in R file
(1) deleted both library(...) packages
(2) Added #import jpeg before ShowPalettePhoto() and #import tidyverse before RanglaPunjab() so roxygen automatically adds to NAMESPACE.
After running devtools::document(), ran devtools::use_package("jpeg") and devtools::use_package("tidyverse") to automatically add to DESCRIPTION.
Unfortunately, even in testing, I cannot get JPEG photo.
Here is GitHub repository, https://github.com/ArtieLadie/RanglaPunjab
I created R package according to this tutorial
It worked and I was able to execute all commands, including a function to display photo in another directory.
I uploaded to my GitHub account. Anyone can install package in R environment with install_github("ArtieLadie/RanglaPunjab")
I am able to run functions by adding RanglaPunjab:: in front of it, i.e.
RanglaPunjab::PaintPalette("Jutti")
?RanglaPunjab::MergePalette
However, when I try to run ?RanglaPunjab::ShowPalettePhoto("Teej") I get
Error in readJPEG(x, native = TRUE) : could not find function "readJPEG"
Before creating the package I added function to set working directory to file location, but it was creating errors when I ran install("RanglaPunjab"), i.e. "Cannot execute"
Here are the exact commands I had, which I had to delete from code
library(rstudioapi)
current_path <- getActiveDocumentContext()$path
setwd(dirname(current_path ))
Please help
Your dependencies are not handled correctly. Here you explicitly load packages with library(...). That is not how one does that in an R package. You should add your dependencies to the Imports: section of the DESCRIPTION file and use the package::function() syntax when calling the function. c.f. http://r-pkgs.had.co.nz/description.html#dependencies.
In addition, if you want the images to be installed with your package, you should place them for example in inst/pics. You can then get the path to these files with
system.file("pics", <file-name>, package = "RanglaPunjab")

Jedox Integrator RScript Transform: Failed to retrieve data

Currently I'm working with Jedox and try to use the RScript Transform component.
The installation of R itself on the server was a little bit tricky, but after several attempts it finally worked.
For the installation helpful were the infos on this blog: jedoxtools.wordpress.com
The key challenge though was to enter the correct directory path in the 'Path' (C:\Program Files\R\R-3.4.1\bin\x64) and in the 'R_Home' (C:\Program Files\R\R-3.4.1) variables.
But now where the 'hard part' should already be done I simply can't get the transform component running.
Based on the example Rscript in this presentation everytime I try simple scripts, I got the following error message:
Failed to retrieve data from source [my RScript components name] : null
The script I run is as simple as this:
data <- my_datasource
Result <- data
There is data in the source and if I do the test locally in RStudio it works perfectly fine.
Anyone here with R experiences in Jedox?
A few attempts later I found the solution myself and it's of course super easy, u just have to know about it.
In the Jedox documentation the given example shows a script which indicates the returned result set is called 'result'.
Instead you can return any object, all you have to do is to name the result set in an extra field which is above the script-box.
The working script (input=output) is shown here:
rscript solution

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.

Load function Images doesn't recognize file

I'am trying to load an image in Julia using the package Images and the function load.
julia> load("/train/1.bpm")
ERROR: FileIO.File{FileIO.DataFormat{:UNKNOWN}}("/train/1.bpm") couldn't be recognized by FileIO.
I am using Julia 0.4.2.
How can I solve the problem?
Thanks a lot
According to the error statement: FileIO.DataFormat{:UNKNOWN}}("/train/1.bpm"), the file extension is wrong. (bpm used instead of bmp).
Use the correct file format (julia> load("/train/1.bmp")) and you'll be good.

How to solve this error message in rmarkdown?

I am just starting to explore the rmarkdown package. I don't use Rstudio. I use the default R environment. What I did was as follows.
I created a new R document.
Started typing few lines in rmarkdown format.
Saved the file with Rmd extension.
I saved the file in the working directory.
I installed the pandoc using the pkg file.
I installed 'rmarkdown' package. Loaded the package.
Used the following command to render the Rmd file.
rmarkdown::render("Untitled.Rmd")
I get the following error.
Error in tools::file_path_as_absolute(input) : file 'Untitled.Rmd'
does not exist
I tried all the possible ways such as giving the exact path instead of filename etc. But nothing worked out. I googled the error message and found that none had similar error. Can someone help me with this. What I am missing. What the error message mean?
Most of the time the error file not found is either a type error or a real missing file (as in your case, the real one is named in another way).
In order to discard those possibilities:
Copy the fullpath from your filebrowser.
Make sure the file exists, inside R you could type:
file.exists("/fullpath/to/file")
If that return TRUE and the error persists, then you suspect another thing is going on.

Resources