business-science / modeltime.gluonts

GluonTS Deep Learning with Modeltime
https://business-science.github.io/modeltime.gluonts/
Other
39 stars 9 forks source link

`reticulate::py_module_available("gluonts")` always returns `[1] FALSE` in Linux (Lubuntu 22.04 LTS) #50

Open Nicholas-R-Sheriff opened 2 years ago

Nicholas-R-Sheriff commented 2 years ago

First of all, I would like to thank the author of this useful integration of GluonTs in R.

My issue concerns the Python Environment setup. As per the thread title: reticulate::py_module_available("gluonts") always returns [1] FALSE. I am working in Linux (Lubuntu 22.04 LTS) - a very fresh install by the way. This is not a fancy PC setup at all: an old ATI Radeon 5450 for an old HP Workstation with two AMD Opteron 2356 that still have life to spend, so GPU problems or similar hardware related stuff have nothing to do here (presumably), nonetheless I found this topic about PyTorch unable to be running on old CPUs because it is compiled against AVX instructions, but I don't know if it may be related.

I do have insalled build-essential on the system. I did have a full Ananconda distribution freshly installed before attempting install_gluonts().

I ran install_gluonts() multiple times seeing that it wouldn't work, but the console was not outputting anything about the need for a conda environment, meaning that the distribution was successfully discovered by the function, and also all the python packages have been installed, yet, again, as the title states... .

Moreover, installing the package from source gives non-zero exit status. Below the output of an attempt of doing so.

Many thanks for your time spent on this software, and many more if you would be so caring to help me!

> install_github("business-science/modeltime.gluonts")
Downloading GitHub repo business-science/modeltime.gluonts@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

 1: All                                 
 2: CRAN packages only                  
 3: None                                
 4: vctrs      (0.4.2  -> 0.5.0 ) [CRAN]
 5: digest     (0.6.29 -> 0.6.30) [CRAN]
 6: lmtest     (0.9-39 -> 0.9-40) [CRAN]
 7: tibble     (3.1.7  -> 3.1.8 ) [CRAN]
 8: yaml       (2.3.5  -> 2.3.6 ) [CRAN]
 9: jsonlite   (1.8.2  -> 1.8.3 ) [CRAN]
10: data.table (1.14.2 -> 1.14.4) [CRAN]
11: sys        (3.4    -> 3.4.1 ) [CRAN]
12: openssl    (2.0.3  -> 2.0.4 ) [CRAN]
13: recipes    (1.0.1  -> 1.0.2 ) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 3
✔  checking for file ‘/tmp/RtmpmAHvQ1/remotes161e13bb9b07/business-science-modeltime.gluonts-f4eec5f/DESCRIPTION’ (464ms)
─  preparing ‘modeltime.gluonts’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘modeltime.gluonts_0.3.1.tar.gz’

Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘modeltime.gluonts’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location

 *** caught illegal operation ***
address 0x7fa05dd3f79a, cause 'illegal operand'

Traceback:
 1: py_module_import(module, convert = convert)
 2: import(module)
 3: doTryCatch(return(expr), name, parentenv, handler)
 4: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 5: tryCatchList(expr, classes, parentenv, handlers)
 6: tryCatch({    import(module)    TRUE}, error = clear_error_handler(FALSE))
 7: reticulate::py_module_available("mxnet")
 8: doTryCatch(return(expr), name, parentenv, handler)
 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
12: try({    dependencies_ok <- all(reticulate::py_module_available("numpy"),         reticulate::py_module_available("pandas"), reticulate::py_module_available("gluonts"),         reticulate::py_module_available("mxnet"), reticulate::py_module_available("pathlib"))}, silent = TRUE)
13: check_gluonts_dependencies()
14: fun(libname, pkgname)
15: doTryCatch(return(expr), name, parentenv, handler)
16: tryCatchOne(expr, names, parentenv, handlers[[1L]])
17: tryCatchList(expr, classes, parentenv, handlers)
18: tryCatch(fun(libname, pkgname), error = identity)
19: runHook(".onLoad", env, package.lib, package)
20: loadNamespace(package, lib.loc)
21: doTryCatch(return(expr), name, parentenv, handler)
22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
23: tryCatchList(expr, classes, parentenv, handlers)
24: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)}, error = function(e) {    P <- if (!is.null(cc <- conditionCall(e)))         paste(" in", deparse(cc)[1L])    else ""    msg <- gettextf("package or namespace load failed for %s%s:\n %s",         sQuote(package), P, conditionMessage(e))    if (logical.return && !quietly)         message(paste("Error:", msg), domain = NA)    else stop(msg, call. = FALSE, domain = NA)})
25: library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE)
26: withCallingHandlers(expr, packageStartupMessage = function(c) tryInvokeRestart("muffleMessage"))
27: suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,     character.only = TRUE, logical.return = TRUE))
28: doTryCatch(return(expr), name, parentenv, handler)
29: tryCatchOne(expr, names, parentenv, handlers[[1L]])
30: tryCatchList(expr, classes, parentenv, handlers)
31: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
32: try(suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,     character.only = TRUE, logical.return = TRUE)))
33: tools:::.test_load_package("modeltime.gluonts", "/usr/local/lib/R/site-library/00LOCK-modeltime.gluonts/00new")
An irrecoverable exception occurred. R is aborting now ...
Illegal instruction
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/modeltime.gluonts’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/RtmpmAHvQ1/file161e497b8267/modeltime.gluonts_0.3.1.tar.gz’ had non-zero exit status
mvt-oviedo commented 1 year ago

Hello,

Similar problem. I am working with Debian Stable, R 4.1.2 and RStudio 2022.02.0 I installed all dependencies without error, but reticulate::py_module_available("gluonts") returns FALSE I solved it with reticulate::py_install("gluonts[mxnet,pro]")

But, when I want to run nbeats()

Error in rlang::env_get(): ! Can't find nbeats in environment.

marcozanotti commented 1 year ago

same problem here on Ubuntu 20