Import error: No modules named rpy2.robjects

4,183 views
Skip to first unread message

Jennifer Huang

unread,
Sep 24, 2017, 2:02:10 PM9/24/17
to LEfSe-users
Hi,

When I try to run run_lefse.py, I get an error like this:

Traceback (most recent call last):
  File "run_lefse.py", line 4, in <module>
    from lefse import *
  File "/Users/jenniferhuang/lefse/lefse.py", line 3, in <module>
    import rpy2.robjects as robjects
ImportError: No module named rpy2.robjects

This is my first time running lefse in terminal, so any advice or guidance would be helpful. I am running python3.6, R-3.3, and rpy2v2.9.

Thank you,
Jenn

Leah Reshef

unread,
Sep 24, 2017, 3:37:29 PM9/24/17
to LEfSe-users
Amazing, I have the same problem. Am trying to run it through virtualbox (ubuntu), tomorrow mean to upgrade the version ; will update if that helps.
What platform are you running on?

Jennifer Huang

unread,
Sep 24, 2017, 9:57:35 PM9/24/17
to LEfSe-users
I am on macOS Sierra. Do you think it could be platform related?

Jincheng Wang

unread,
Oct 4, 2017, 10:34:27 AM10/4/17
to LEfSe-users
I had the same problem and it seems to be OS related. Although I can't solve the problem, I am able to run lefse using the docker method that suggested on lefse website. You have to install docker first on you Mac, and then run the command on lefse website in your terminal. It will create a container (which in my naive language, a virtual environment) in your terminal, you can run lefse from there. Also, since it is a virtual environment, you can share a folder from your host computer by adding a -v flag. The syntax is: docker run -v [host directory path]:[container directory path] -it [image name].
Hope this helps.

Jincheng

tacovand...@gmail.com

unread,
Nov 20, 2017, 3:14:38 PM11/20/17
to LEfSe-users
Hi,
I'm having the same proble as the first person starting the conversation (error mesage see below). I run Lefse in a QIIME 1.9.0 on a virtual Linux machine on my windows 10 laptop.
Can anyone help me with this problem? I installed it using koeken from the github site https://github.com/twbattaglia/koekens. Istalling it in qiime gave no errors and the koeken.py -h function is working fine. Since the Galaxy website doesn't work at the moment for Lefse, I would really like to get it working!
Thanks.
Taco 

Traceback (most recent call last):
  File "run_lefse.py", line 4, in <module>
    from lefse import *
  File "/Users/jenniferhuang/lefse/lefse.py", line 3, in <module>
    import rpy2.robjects as robjects
ImportError: No module named rpy2.robjects


Op woensdag 4 oktober 2017 16:34:27 UTC+2 schreef Jincheng Wang:

Khemlal Nirmalkar

unread,
Mar 2, 2018, 9:26:50 PM3/2/18
to LEfSe-users
Hi....
 To solve this issue....
please install rpy2 v2.8.6
like as
pip install rpy2==2.8.6

I hope it work

Khem

PaulineV

unread,
Mar 4, 2019, 1:19:42 PM3/4/19
to LEfSe-users
Hi everyone,
This is quite an old post but I didn't want to open a new one since I am having the exact same issue.
I tried to install rpy2 v2.8.6 but it didn't fix the problem.
I am on Ubuntu with R 3.4.4

  File "run_lefse.py", line 4, in <module>
    from lefse import *
  File "lefse.py", line 3, in <module>
    import rpy2.robjects as robjects
ImportError: No module named rpy2.robjects

Thank you very much !
Reply all
Reply to author
Forward
0 new messages