radiant-rstats / radiant

Business analytics using R and Shiny. The radiant app combines the menus from radiant.data, radiant.design, radiant.basics, radiant.model, and radiant.multivariate.
https://radiant-rstats.github.io/docs/
Other
453 stars 130 forks source link

Bug: ImportError: cannot import name 'SCHEME_KEYS' #183

Closed DSChip closed 1 year ago

DSChip commented 2 years ago

Issue from the log:

Full log file attached at the end of this post.

2022/08/01 08:40:19.078937030   File "/usr/lib/python3.6/site-packages/pip/_internal/locations/__init__.py", line 7, in <module>
2022/08/01 08:40:19.078981230     from pip._internal.models.scheme import SCHEME_KEYS, Scheme
2022/08/01 08:40:19.079031030 ImportError: cannot import name 'SCHEME_KEYS'

This issue only occurs in R Studio Connect server. It works well in my local system though.

Local system

> version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          4                           
minor          0.3                         
year           2020                        
month          10                          
day            10                          
svn rev        79318                       
language       R                           
version.string R version 4.0.3 (2020-10-10)
nickname       Bunny-Wunnies Freak Out     

Development:

Set up renv environment

# Initialize a empty renv environment
renv::init(bare = TRUE)
# Install radiant: this step also installs all packages mentioned in radiant/inst/app/for.shinyapps.io.R
renv::install(c("rsconnect", "radiant"))
# Save environment
renv::snapshot()
> search()
 [1] ".GlobalEnv"                   "package:htmltools"            "package:DT"                   "package:shinyFiles"           "package:shinyAce"             "package:rstudioapi"           "package:nnet"                
 [8] "package:radiant"              "package:radiant.multivariate" "package:radiant.model"        "package:radiant.basics"       "package:radiant.design"       "package:mvtnorm"              "package:radiant.data"        
[15] "package:dplyr"                "package:tidyr"                "package:lubridate"            "package:ggplot2"              "package:magrittr"             "package:shiny"                "tools:rstudio"               
[22] "package:stats"                "package:graphics"             "package:grDevices"            "package:datasets"             "renv:shims"                   "package:utils"                "package:methods"             
[29] "Autoloads"                    "org:r-lib"                    "package:base"         

Create app files:

server.R

server_path <- system.file("app", "server.R", package="radiant")
source(server_path)

ui.R

ui_path <- system.file("app", "ui.R", package="radiant")
source(ui_path)

global.R

library(radiant)
global_path <- system.file("app", "global.R", package="radiant")
source(global_path)

Edit .Rprofile

source("renv/activate.R")
# Source https://radiant-rstats.github.io/docs/
options(radiant.maxRequestSize = -1)  ## no file size limit
options(radiant.report = TRUE)

Deployment

Create manifest.json file for R Studio Connect

This is completed inside the renv environment.

rsconnect::writeManifest()

Publish code to GitLab

Git stage, commit and push to GitLab

Deploy in R Studio Connect from GitLab

Deploy app from GitLab to R Studio Connect (Not using "publish" button in R Studio IDE).

Deployment log from R Studio Connect:

rstudio-connect.158.0.539.run_app.JcdBbVuZVxE15W5W.log

DSChip commented 2 years ago

https://stackoverflow.com/questions/68480169/cannot-import-name-scheme-keys-from-pip-internal-models-scheme-error

vnijs commented 1 year ago

I'm afraid I don't use Rstudio Connect at all (yet). Don't know how to help you with this one I'm afraid.

vnijs commented 1 year ago

Please let me know if you were able to get this working with RStudio Connect.

DSChip commented 1 year ago

I was not able to solve this issue myself. I have not tried again since this ticket was created.

vnijs commented 1 year ago

The app runs on ShinyApps.io which, I believe, uses Rstudio Connect. It should be possible to run the app on connect. That said, I haven't tried it. Do you have a acces to shinyServer?

https://vnijs.shinyapps.io/radiant/

DSChip commented 1 year ago

Do you have a acces to shinyServer?

AFAIK, ShinyServer has been completely replaced by R Studio Connect. I do have access to R Studio Connect though.

vnijs commented 1 year ago

Do you mean, in your organization? From the below rstudio still offers and sells Shiny Server

https://posit.co/products/open-source/shinyserver/

DSChip commented 1 year ago

Yes, our organization has R Studio Connect. Sorry, I was not aware that Shiny Server was still available.