Install and use RPy2 (using conda) so that it uses default R installation in /usr/lib/R R












2















I want to call functions from my R packages in Python using RPy2. I installed RPy2 using conda and realized it installed a fresh copy of R inside conda... I don't want that. I just want to have and use one R, the default one in /usr/lib/R.



How to do that? How to force conda and Python and RPy2 to use default R installed in /usr/lib/R?










share|improve this question























  • Simply point library paths to the non-conda R's library or set needed environment variables to point to needed library.

    – Parfait
    Jul 23 '18 at 19:51











  • @Parfait Tried to do that but do not know how obviously, since it still does not work. Is there maybe an article or blog post detailing this? It seems this is all very well document and easy if you are primary using Python and would want to add some R stuff. If you are a pure R user with a lot of custom packages and default R installation there seems to be no details on how to set things up...

    – Samo
    Jul 25 '18 at 20:34











  • Did you try specifying R packages in importr call: importr("my_package", lib_loc="/path/to/non-conda/R/lib")? You can find this path by opening non-conda R session and call .libPaths().

    – Parfait
    Jul 26 '18 at 16:41













  • What's the downside of using the r conda package?

    – Nehal J Wani
    Aug 1 '18 at 19:04











  • If I install RPy2 with conda it also installs R (another version) changes R home folder and all sorts of stuff. I am an R user(meaning I have a working R installation with specific version that needs to be maintained on a system wide basis since I have many many many R jobs running and many proprietary R packages written and used. Now, I need to use Python and call functions from my proprietary R packages from Python. The issue I have is that it looks like people using RPy2 mostly use Python and just need to call some R functions and they do not care where and which version of R they have...

    – Samo
    Aug 2 '18 at 18:00
















2















I want to call functions from my R packages in Python using RPy2. I installed RPy2 using conda and realized it installed a fresh copy of R inside conda... I don't want that. I just want to have and use one R, the default one in /usr/lib/R.



How to do that? How to force conda and Python and RPy2 to use default R installed in /usr/lib/R?










share|improve this question























  • Simply point library paths to the non-conda R's library or set needed environment variables to point to needed library.

    – Parfait
    Jul 23 '18 at 19:51











  • @Parfait Tried to do that but do not know how obviously, since it still does not work. Is there maybe an article or blog post detailing this? It seems this is all very well document and easy if you are primary using Python and would want to add some R stuff. If you are a pure R user with a lot of custom packages and default R installation there seems to be no details on how to set things up...

    – Samo
    Jul 25 '18 at 20:34











  • Did you try specifying R packages in importr call: importr("my_package", lib_loc="/path/to/non-conda/R/lib")? You can find this path by opening non-conda R session and call .libPaths().

    – Parfait
    Jul 26 '18 at 16:41













  • What's the downside of using the r conda package?

    – Nehal J Wani
    Aug 1 '18 at 19:04











  • If I install RPy2 with conda it also installs R (another version) changes R home folder and all sorts of stuff. I am an R user(meaning I have a working R installation with specific version that needs to be maintained on a system wide basis since I have many many many R jobs running and many proprietary R packages written and used. Now, I need to use Python and call functions from my proprietary R packages from Python. The issue I have is that it looks like people using RPy2 mostly use Python and just need to call some R functions and they do not care where and which version of R they have...

    – Samo
    Aug 2 '18 at 18:00














2












2








2








I want to call functions from my R packages in Python using RPy2. I installed RPy2 using conda and realized it installed a fresh copy of R inside conda... I don't want that. I just want to have and use one R, the default one in /usr/lib/R.



How to do that? How to force conda and Python and RPy2 to use default R installed in /usr/lib/R?










share|improve this question














I want to call functions from my R packages in Python using RPy2. I installed RPy2 using conda and realized it installed a fresh copy of R inside conda... I don't want that. I just want to have and use one R, the default one in /usr/lib/R.



How to do that? How to force conda and Python and RPy2 to use default R installed in /usr/lib/R?







python r conda rpy2






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 23 '18 at 19:35









SamoSamo

9001132




9001132













  • Simply point library paths to the non-conda R's library or set needed environment variables to point to needed library.

    – Parfait
    Jul 23 '18 at 19:51











  • @Parfait Tried to do that but do not know how obviously, since it still does not work. Is there maybe an article or blog post detailing this? It seems this is all very well document and easy if you are primary using Python and would want to add some R stuff. If you are a pure R user with a lot of custom packages and default R installation there seems to be no details on how to set things up...

    – Samo
    Jul 25 '18 at 20:34











  • Did you try specifying R packages in importr call: importr("my_package", lib_loc="/path/to/non-conda/R/lib")? You can find this path by opening non-conda R session and call .libPaths().

    – Parfait
    Jul 26 '18 at 16:41













  • What's the downside of using the r conda package?

    – Nehal J Wani
    Aug 1 '18 at 19:04











  • If I install RPy2 with conda it also installs R (another version) changes R home folder and all sorts of stuff. I am an R user(meaning I have a working R installation with specific version that needs to be maintained on a system wide basis since I have many many many R jobs running and many proprietary R packages written and used. Now, I need to use Python and call functions from my proprietary R packages from Python. The issue I have is that it looks like people using RPy2 mostly use Python and just need to call some R functions and they do not care where and which version of R they have...

    – Samo
    Aug 2 '18 at 18:00



















  • Simply point library paths to the non-conda R's library or set needed environment variables to point to needed library.

    – Parfait
    Jul 23 '18 at 19:51











  • @Parfait Tried to do that but do not know how obviously, since it still does not work. Is there maybe an article or blog post detailing this? It seems this is all very well document and easy if you are primary using Python and would want to add some R stuff. If you are a pure R user with a lot of custom packages and default R installation there seems to be no details on how to set things up...

    – Samo
    Jul 25 '18 at 20:34











  • Did you try specifying R packages in importr call: importr("my_package", lib_loc="/path/to/non-conda/R/lib")? You can find this path by opening non-conda R session and call .libPaths().

    – Parfait
    Jul 26 '18 at 16:41













  • What's the downside of using the r conda package?

    – Nehal J Wani
    Aug 1 '18 at 19:04











  • If I install RPy2 with conda it also installs R (another version) changes R home folder and all sorts of stuff. I am an R user(meaning I have a working R installation with specific version that needs to be maintained on a system wide basis since I have many many many R jobs running and many proprietary R packages written and used. Now, I need to use Python and call functions from my proprietary R packages from Python. The issue I have is that it looks like people using RPy2 mostly use Python and just need to call some R functions and they do not care where and which version of R they have...

    – Samo
    Aug 2 '18 at 18:00

















Simply point library paths to the non-conda R's library or set needed environment variables to point to needed library.

– Parfait
Jul 23 '18 at 19:51





Simply point library paths to the non-conda R's library or set needed environment variables to point to needed library.

– Parfait
Jul 23 '18 at 19:51













@Parfait Tried to do that but do not know how obviously, since it still does not work. Is there maybe an article or blog post detailing this? It seems this is all very well document and easy if you are primary using Python and would want to add some R stuff. If you are a pure R user with a lot of custom packages and default R installation there seems to be no details on how to set things up...

– Samo
Jul 25 '18 at 20:34





@Parfait Tried to do that but do not know how obviously, since it still does not work. Is there maybe an article or blog post detailing this? It seems this is all very well document and easy if you are primary using Python and would want to add some R stuff. If you are a pure R user with a lot of custom packages and default R installation there seems to be no details on how to set things up...

– Samo
Jul 25 '18 at 20:34













Did you try specifying R packages in importr call: importr("my_package", lib_loc="/path/to/non-conda/R/lib")? You can find this path by opening non-conda R session and call .libPaths().

– Parfait
Jul 26 '18 at 16:41







Did you try specifying R packages in importr call: importr("my_package", lib_loc="/path/to/non-conda/R/lib")? You can find this path by opening non-conda R session and call .libPaths().

– Parfait
Jul 26 '18 at 16:41















What's the downside of using the r conda package?

– Nehal J Wani
Aug 1 '18 at 19:04





What's the downside of using the r conda package?

– Nehal J Wani
Aug 1 '18 at 19:04













If I install RPy2 with conda it also installs R (another version) changes R home folder and all sorts of stuff. I am an R user(meaning I have a working R installation with specific version that needs to be maintained on a system wide basis since I have many many many R jobs running and many proprietary R packages written and used. Now, I need to use Python and call functions from my proprietary R packages from Python. The issue I have is that it looks like people using RPy2 mostly use Python and just need to call some R functions and they do not care where and which version of R they have...

– Samo
Aug 2 '18 at 18:00





If I install RPy2 with conda it also installs R (another version) changes R home folder and all sorts of stuff. I am an R user(meaning I have a working R installation with specific version that needs to be maintained on a system wide basis since I have many many many R jobs running and many proprietary R packages written and used. Now, I need to use Python and call functions from my proprietary R packages from Python. The issue I have is that it looks like people using RPy2 mostly use Python and just need to call some R functions and they do not care where and which version of R they have...

– Samo
Aug 2 '18 at 18:00












1 Answer
1






active

oldest

votes


















0














Do not use the conda instal to install the rpy2, just use the pip install rpy2. Here are some additional packages you may need to install before the rpy2:



conda install -y PyHamcrest
sudo apt-get install -y libreadline6-dev
pip install rpy2


Some notes:




  1. The which pip should refer to anaconda's path

  2. The environment variable for R (R_HOME and PATH) should be properly set up before you install the rpy2


  3. After the installation, you may encounter an error when calling import rpy2.robjects as robjects:



    RRuntimeWarning: Error: package or namespace load failed for ‘stats’ in dyn.load(file, DLLpath = DLLpath, ...):
    unable to load shared object '/usr/local/lib/R/library/stats/libs/stats.so':
    libRlapack.so: cannot open shared object file: No such file or directory




To solve this, I found a solution in How I solved the error - libRlapack.so: cannot open shared object file: No such file or directory



You need to locate your libRlapack.so file (in my case this file is in /usr/local/lib/R/lib/), or the following command should show the path to this file:



R CMD ldd /usr/local/lib/R/library/stats/libs/stats.so


and then write this path to the /etc/ld.so.conf.d/libR.conf and then run ldconfig:



echo "/usr/local/lib/R/lib/" >> /etc/ld.so.conf.d/libR.conf && ldconfig


That should fix the problem.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51486081%2finstall-and-use-rpy2-using-conda-so-that-it-uses-default-r-installation-in-us%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Do not use the conda instal to install the rpy2, just use the pip install rpy2. Here are some additional packages you may need to install before the rpy2:



    conda install -y PyHamcrest
    sudo apt-get install -y libreadline6-dev
    pip install rpy2


    Some notes:




    1. The which pip should refer to anaconda's path

    2. The environment variable for R (R_HOME and PATH) should be properly set up before you install the rpy2


    3. After the installation, you may encounter an error when calling import rpy2.robjects as robjects:



      RRuntimeWarning: Error: package or namespace load failed for ‘stats’ in dyn.load(file, DLLpath = DLLpath, ...):
      unable to load shared object '/usr/local/lib/R/library/stats/libs/stats.so':
      libRlapack.so: cannot open shared object file: No such file or directory




    To solve this, I found a solution in How I solved the error - libRlapack.so: cannot open shared object file: No such file or directory



    You need to locate your libRlapack.so file (in my case this file is in /usr/local/lib/R/lib/), or the following command should show the path to this file:



    R CMD ldd /usr/local/lib/R/library/stats/libs/stats.so


    and then write this path to the /etc/ld.so.conf.d/libR.conf and then run ldconfig:



    echo "/usr/local/lib/R/lib/" >> /etc/ld.so.conf.d/libR.conf && ldconfig


    That should fix the problem.






    share|improve this answer






























      0














      Do not use the conda instal to install the rpy2, just use the pip install rpy2. Here are some additional packages you may need to install before the rpy2:



      conda install -y PyHamcrest
      sudo apt-get install -y libreadline6-dev
      pip install rpy2


      Some notes:




      1. The which pip should refer to anaconda's path

      2. The environment variable for R (R_HOME and PATH) should be properly set up before you install the rpy2


      3. After the installation, you may encounter an error when calling import rpy2.robjects as robjects:



        RRuntimeWarning: Error: package or namespace load failed for ‘stats’ in dyn.load(file, DLLpath = DLLpath, ...):
        unable to load shared object '/usr/local/lib/R/library/stats/libs/stats.so':
        libRlapack.so: cannot open shared object file: No such file or directory




      To solve this, I found a solution in How I solved the error - libRlapack.so: cannot open shared object file: No such file or directory



      You need to locate your libRlapack.so file (in my case this file is in /usr/local/lib/R/lib/), or the following command should show the path to this file:



      R CMD ldd /usr/local/lib/R/library/stats/libs/stats.so


      and then write this path to the /etc/ld.so.conf.d/libR.conf and then run ldconfig:



      echo "/usr/local/lib/R/lib/" >> /etc/ld.so.conf.d/libR.conf && ldconfig


      That should fix the problem.






      share|improve this answer




























        0












        0








        0







        Do not use the conda instal to install the rpy2, just use the pip install rpy2. Here are some additional packages you may need to install before the rpy2:



        conda install -y PyHamcrest
        sudo apt-get install -y libreadline6-dev
        pip install rpy2


        Some notes:




        1. The which pip should refer to anaconda's path

        2. The environment variable for R (R_HOME and PATH) should be properly set up before you install the rpy2


        3. After the installation, you may encounter an error when calling import rpy2.robjects as robjects:



          RRuntimeWarning: Error: package or namespace load failed for ‘stats’ in dyn.load(file, DLLpath = DLLpath, ...):
          unable to load shared object '/usr/local/lib/R/library/stats/libs/stats.so':
          libRlapack.so: cannot open shared object file: No such file or directory




        To solve this, I found a solution in How I solved the error - libRlapack.so: cannot open shared object file: No such file or directory



        You need to locate your libRlapack.so file (in my case this file is in /usr/local/lib/R/lib/), or the following command should show the path to this file:



        R CMD ldd /usr/local/lib/R/library/stats/libs/stats.so


        and then write this path to the /etc/ld.so.conf.d/libR.conf and then run ldconfig:



        echo "/usr/local/lib/R/lib/" >> /etc/ld.so.conf.d/libR.conf && ldconfig


        That should fix the problem.






        share|improve this answer















        Do not use the conda instal to install the rpy2, just use the pip install rpy2. Here are some additional packages you may need to install before the rpy2:



        conda install -y PyHamcrest
        sudo apt-get install -y libreadline6-dev
        pip install rpy2


        Some notes:




        1. The which pip should refer to anaconda's path

        2. The environment variable for R (R_HOME and PATH) should be properly set up before you install the rpy2


        3. After the installation, you may encounter an error when calling import rpy2.robjects as robjects:



          RRuntimeWarning: Error: package or namespace load failed for ‘stats’ in dyn.load(file, DLLpath = DLLpath, ...):
          unable to load shared object '/usr/local/lib/R/library/stats/libs/stats.so':
          libRlapack.so: cannot open shared object file: No such file or directory




        To solve this, I found a solution in How I solved the error - libRlapack.so: cannot open shared object file: No such file or directory



        You need to locate your libRlapack.so file (in my case this file is in /usr/local/lib/R/lib/), or the following command should show the path to this file:



        R CMD ldd /usr/local/lib/R/library/stats/libs/stats.so


        and then write this path to the /etc/ld.so.conf.d/libR.conf and then run ldconfig:



        echo "/usr/local/lib/R/lib/" >> /etc/ld.so.conf.d/libR.conf && ldconfig


        That should fix the problem.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 20 '18 at 1:53

























        answered Nov 19 '18 at 13:11









        qjgodsqjgods

        73056




        73056






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51486081%2finstall-and-use-rpy2-using-conda-so-that-it-uses-default-r-installation-in-us%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents