Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6019943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:29:42+00:00 2026-05-23T03:29:42+00:00

Here’s what should and does happen using rpy2.robjects.packages.importr for base R-packages (e.g. stats ):

  • 0

Here’s what should and does happen using rpy2.robjects.packages.importr for base R-packages (e.g. stats):

>>> from rpy2.robjects.packages import importr
>>> importr('stats')
<rpy2.robjects.packages.SignatureTranslatedPackage object at 0x7f3810>

but with an external package (e.g. ggplot2) this is the result:

>>> importr('ggplot2')
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called 'ggplot2'
Error in .Primitive("as.environment")("package:ggplot2") : 
  no item called "package:ggplot2" on the search list
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/site-packages/rpy2/robjects/packages.py", line 100, in importr
    env = _as_env(rinterface.StrSexpVector(['package:'+name, ]))
rpy2.rinterface.RRuntimeError: Error in .Primitive("as.environment")("package:ggplot2") : 
  no item called "package:ggplot2" on the search list

A complication is that in my home directory I have the file .Renviron define my user library location (where, for instance, ggplot2 libs are), and I have no problems with either of the R-commands library() or require() using R and Rscript. The path looks something like this:

R_LIBS_USER="/path/to/my/packages"

So my question is why my user-library path excluded from the “search list” Rpy2 uses? Or, rather, how do I direct Rpy2 to look in the R_LIBS_USER path as well?

I assume the problem stems from the environment Rpy2 uses, but my ignorance is high in that regard.

R: 2.13.0
Platform: x86_64-apple-darwin9.8.0/x86_64 (Mac, 10.6, 64-bit)

replicated with

Rpy2: 2.1.8, 2.2.1 (dev)

I use R, ggplot2, and python regularly, so any insight is very much welcome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:29:43+00:00Added an answer on May 23, 2026 at 3:29 am

    By default, rpy2 is initializing in “vanilla” mode, and this ignores R_LIBS and friends.

    >>> import rpy2.rinterface 
    >>> rpy2.rinterface.get_initoptions()
    ('rpy2', '--quiet', '--vanilla', '--no-save')
    >>> 
    

    You can use ‘rinterface.set_initoptions()’ to change those.

    For example:

    import rpy2.rinterface as ri
    ri.set_initoptions(('rpy2', '--verbose', '--no-save'))
    ri.initr()
    
    # from now on, just import the rest of rpy2 modules without thinking of the above.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a dump of the stats provided my mod_pagespeed from one of my sites.
Here is my query: SELECT * FROM [GeoName] WHERE ((-26.3665122100029-Lat)*(-26.3665122100029-Lat))+((27.5978928658078-Long)*(27.5978928658078-Long)) < 0.005 ORDER BY
Here is what is supposed to happen: The moment the user chooses an option
Here's a query that works fine: SELECT rowid as msg_rowid, a, b, c FROM
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Here is my situation: I am using telerik with winform. I have a dataset
Here my problem: @Assert\Regex( * pattern=/^[A-Za-z0-9][A-Za-z0-9\]*$/, * groups={creation, creation_logged} * ) I'm using the
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.