-
Notifications
You must be signed in to change notification settings - Fork 328
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
issue when using the MongoClient of the PyMongo package #81
Comments
My best guess is that the mongo library isn't loading due to an LD_LIBRARY_PATH difference between the shell and your R session. Can you provide a traceback associated with the error? |
By enabling debuging (Debug > On Error > Error Inspector ) in Rstudio I receive the following output, #-------------------------------------------------PYMONGO_reticulate.R
PyMng = reticulate::import("pymongo")
init_pym = PyMng$MongoClient(host = 'localhost', 27017L) # I added a break point here
#------------------------------------------------- > debugSource('~/PYMONGO_reticulate.R')
Called from: eval(expr, p)
Browse[1]> n
debug at ~/PYMONGO_reticulate.R#6: init_pym = PyMng$MongoClient(host = "localhost", 27017L)
Browse[2]> n
Error in evalq({ : attempt to apply non-function
>
The LD_LIBRARY_PATH using the ubuntu console is $ echo $LD_LIBRARY_PATH
/usr/local/cuda-8.0/lib64:
and from an R session, > Sys.getenv("LD_LIBRARY_PATH")
[1] "/usr/lib/R/lib::/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/jre/lib/amd64/server"
I even modified the .profile file exporting the paths that appear in the R session, however the error persists. Thanks for the response. |
I just tried to reproduce the error locally and couldn't (I can call the PyMng$MongoClient constructor with no errors). What about if you set |
I switched to another Linux OS with the same configuration. The first time I ran options(error = traceback)
PyMng = reticulate::import("pymongo")
init_pym = PyMng$MongoClient(host = "localhost", 27017L)
I got the following traceback, Error: attempt to apply non-function
9: stop(e)
8: value[[3L]](cond)
7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
6: tryCatchList(expr, classes, parentenv, handlers)
5: tryCatch(loadNamespace(name), error = function(e) stop(e))
4: getNamespace(ns)
3: asNamespace(ns)
2: getExportedValue(pkg, name)
1: reticulate::import
However, since then when I attempt to run the same code I get, Error: attempt to apply non-function
No traceback available
a message that I received in my first Linux OS, as well. Thanks for the response. |
Okay, I have now reproduce the error when using the CRAN version of reticulate (0.9). The good news is that I can't reproduce using the development version so it must be fixed there! You can install the development version with: devtools::install_github("rstudio/reticulate") |
yes, using the development version I don't get the error, PyMng = reticulate::import("pymongo")
init_pym = PyMng$MongoClient('localhost', 27017L)
init_pym
MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True)
thanks a lot for all the responses and for the useful reticulate package. |
First of all thank you for the useful package.
I face the following problem when trying to call the MongoClient() module from within an R-session,
Normally, I receive this error only if the module is not available, however the PyMongo package is installed in my default python version,
I'm also able to open a mongo session and do queries using an ubuntu console,
any ideas, why this error occurs?
The text was updated successfully, but these errors were encountered: