Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: package or namespace load failed for 'shinyURL' #7

Open
dkulp2 opened this issue Jun 18, 2016 · 11 comments
Open

ERROR: package or namespace load failed for 'shinyURL' #7

dkulp2 opened this issue Jun 18, 2016 · 11 comments

Comments

@dkulp2
Copy link

dkulp2 commented Jun 18, 2016

Any clue why shinyURL fails to load in a server environment?
The library loads and the functionality works nicely in my RStudio development environment.
When I deploy to a remote server running shiny, I get the "load failed" error. Log files literally disappear on error, suggesting a crash.
Interactive R on the remote server loads shinyURL just fine.

@aoles
Copy link
Owner

aoles commented Jun 18, 2016

Thank you for reporting your problems! I'm not sure what could be the reason for shinyURL failing to load in an app deployed on a server, but otherwise working just fine. I've never experienced this before. If you provide me with the example app which fails for you, I could deploy it on some other system to see whether this is reproducible.

Cheers,
Andrzej

@dkulp2
Copy link
Author

dkulp2 commented Jun 20, 2016

Thanks for the reply, Andrzej.
The example app that fails only in the server environment is the Add-URL-state branch of my repo called opex. It would be a great help if you could try it yourself, which would help me determine whether it is a problem specifically with my server environment.

@aoles
Copy link
Owner

aoles commented Jun 20, 2016

Hi David,

I just tried your app and I didn't experience any problems. It runs just fine on my local linux machine, and I was also able to successfully deploy it on my shinyapps.io account. There must be something specific to your server configuration. Not sure what could help, but maybe it just needs a fresh restart or R package updates?

If the problem persists, I suggest that you try to boil it down to some minimal example to simplify debugging. For instance, you could try one of the sample apps distributed with shinyURL, see https://github.com/aoles/shinyURL/tree/master/inst/examples

I hope this helps. Once this is resolved, please let me know what the actual problem was.

Cheers,
Andrzej

@dkulp2
Copy link
Author

dkulp2 commented Jun 22, 2016

Hi Andrzej,
I've updated to the most recent shiny-server, rebuilt and reinstalled. No luck.
When I tried to reinstall shinyURL, I get the following warning:

devtools::install_github("aoles/shinyURL", force=TRUE)
devtools::install_github("aoles/shinyURL", force=TRUE)
Downloading GitHub repo aoles/shinyURL@master
from URL https://api.github.com/repos/aoles/shinyURL/zipball/master
Installing shinyURL
'/usr/gsl/user4/dkulp/local/lib64/R/bin/R' --no-site-file --no-environ  \
  --no-save --no-restore CMD INSTALL  \
  '/tmp/RtmpH4HEys/devtools4b6c4e742b39/aoles-shinyURL-1928454'  \
  --library='/usr/gsl/user4/dkulp/local/lib64/R/library' --install-tests

* installing *source* package 'shinyURL' ...
** R
**Warning: unable to re-encode 'shinyURL.R' line 11**
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (shinyURL)

Is that a clue? I don't see this warning in my development environment.
Thank you very much for your patience.

@aoles
Copy link
Owner

aoles commented Jun 22, 2016

Hi,
the error message you get indicates that there might be a problem with the encoding of non-ASCII characters, in particular line 11 of 'shinyURL.R' contains 'ś' in my name. The package correctly specifies UTF-8 encoding in the DESCRIPTION file, but for some reason this doesn't seem to work on your system. What's the result of running Sys.getlocale('LC_CTYPE') in your R session?

@dkulp2
Copy link
Author

dkulp2 commented Jun 22, 2016

Sys.getlocale('LC_CTYPE')
[1] "en_US"

On Wed, Jun 22, 2016 at 4:02 AM Andrzej Oleś [email protected]
wrote:

Hi,
the error message you get indicates that there might be a problem with the
encoding of special characters, in particular line 11 of 'shinyURL.R'
https://github.com/aoles/shinyURL/blob/master/R/shinyURL.R#L11 contains
'ś' in my name. The package correctly specifies UTF-8 encoding in the
description file, but for some reason this doesn't seem to work on your
system. What's the result of running Sys.getlocale('LC_CTYPE') in your R
session?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#7 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ABl4TMT7J8k9M-Z9BjsW4QhHYdzo8jt5ks5qOOvLgaJpZM4I49Yw
.

@aoles
Copy link
Owner

aoles commented Jun 22, 2016

As mentioned before, you're most probably experiencing some problems with UTF-8 encoding on the server. Maybe a good starting point in tracking this down is to compare the output of locale on the server and on your development environment. Below I include the output on my system for reference.

[oles@localhost ~]$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

@dkulp2
Copy link
Author

dkulp2 commented Jun 23, 2016

Thanks again for your patience. Problem mostly solved. First, the locale issue was a red herring. My locale was en_US and when I set it to en_US.UTF-8, then I did not get the build warning, but I still had the problem with the package load, as described above.
(Debugging the problem was confounded by a shiny-server bug in which the log file disappears on error. It was only after rapid fire "cat" that I displayed the error before the file disappeared!)
I discovered that the problem is that the RCurl package could not load the necessary shared libraries. Shiny-server sets a minimal LD_LIBRARY_PATH. My libcurl and libssh are located in non-standard locations on the server. No matter if I started shiny-server with an exported or prefaced LD_LIBRARY_PATH or if I tried to Sys.setenv(LD_LIBRARY_PATH=...), I can not get these .so files to be found unless I move them to one of the directories that shiny-server includes in its custom LD_LIBRARY_PATH. So that's what I did. shinyURL loads and the application works!

Sort of.

The remaining problem is that I'm using the DT package to use the DataTable JQuery plugin. There seems to be a conflict between the ajax URL and shinyURL as follows.

ShinyURL will mask fields that begin with ".". Although not explicitly shiny input values, I discovered that the DT package creates input fields corresponding to each datatable in order to maintain state via ajax. And these values are encoded by shinyURL. However, a large DT creates a very long list of name/value pairs encoded in the URL (1000s of chars). If I preface the table names with a dot, then they are excluded from the URL... and this works fine in RStudio's development environment. But on a remote server running the shiny-server node.js application, then the URLs with dots in them are blocked with a "403 forbidden". (I don't know why you were successful using shinyapps.io. There might be a difference between the open source DIY release of shiny-server and shinyapps.io that's hosted by RStudio.)

One solution might be to add a method in the ShinyURL package that lists the names of inputs to exclude as an alternative to the dot convention.

Any thoughts?

@aoles
Copy link
Owner

aoles commented Aug 8, 2016

Hi,
Please excuse my delayed answer. I'm happy that you've eventually managed to overcome the server configuration issues.

Re the DT-related issue: I'm not sure I follow. When a DT table name starts with a dot, e.g. .mytable, all the DT-specific inputs associated with it are masked and they do not appear in the app's URL query string. Therefore, I don't quite understand the problem: the URLs with dots in them are blocked with a "403 forbidden". Can you clarify, please?

Cheers,
Andrzej

@yonicd
Copy link

yonicd commented Sep 2, 2016

I am getting the same error. I am running on the shiny-server code from here https://github.com/yonicd/shiny_apps/tree/master/ggtree and when i move to the table the ajax crashes. when i look at the error on the network log it shows a 403 error for the .table object.

this runs fine on shinyapps.io and localhost but not on shiny-server

screen shot 2016-09-02 at 09 29 28
screen shot 2016-09-02 at 09 31 22

on shinyapps.io it looks like this:
screen shot 2016-09-02 at 10 36 31

@ramindehghanpoor
Copy link

Hi,
I have the same problem. How did you move libssh to one of the directories that shiny-server includes in its custom LD_LIBRARY_PATH?
Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants