Importing a Python library with reticulate

I'm trying to import a python library LDpred from Github ( I used pip install ldpred and so I am able to run ldpred from the terminal, but I can't figure out how to use reticulate in an .Rmd chunk to import ldpred. I've tried reading the reticulate guides and using use_python() but nothing so far has worked. I just get: No module named 'ldpred' - so I guess the ldpred package didn't install to the same version of python that R is using. I can't figure out how to fix this problem.

If anyone could give some tips on this I would really appreciate it. I've spent awhile trying to figure this out.


Hi @kylec1729,
Use the following to check that R can find Python, and that the Python package (here pandas) can be found and is available:

# Had to run this on command line first to install Python package
# py -3.7 pip install pandas


py_discover_config()   # ??Need this after each new Python package install


Also, remember that Python needs directories specified with "forward_slash" separators, not double "backslash" as R may use. My experience is on Windows 10, 64 bit.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.