0

At Jupyter Notebook, I try to import 'mrjob' Python 2.7 package after making sure that the package has been installed (pip2.7 list), but receive an error. Does anyone know what am I missing?

from mrjob.job import MRJob
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-45-77ddb811471e> in <module>()
----> 1 from mrjob.job import MRJob

ImportError: No module named mrjob.job
Fxs7576
  • 1,259
  • 4
  • 23
  • 31
  • What happens when you attempt to install the package again? Does it tell you it is already installed? `pip install mrjob` – Nick Jun 06 '16 at 21:52
  • Hi Nicarus, when I `pip2.7 install mrjob`, it says that "Requirement already satisfied". – Fxs7576 Jun 06 '16 at 21:57
  • Are you running this on Python 2.7 or do you have a different version also installed? – Nick Jun 06 '16 at 21:58
  • I have version 3.6 installed. Today I have just installed version 2.7 and am running this code on it. – Fxs7576 Jun 06 '16 at 22:04
  • Is Jupyter running in a virtualenv by chance? – Nick Jun 06 '16 at 22:05
  • I am not sure what Virtualenv is. Is there a way to check whether Jupyter is running in it? Initially I installed Python 3.5 by following this [link](https://www.continuum.io/downloads) for OS X. – Fxs7576 Jun 06 '16 at 22:13
  • You installed 3.5 or 2.7? Also, did you mean 3.5 earlier when you said you had 3.6 installed? (3.6 is only in alpha right now). – Nick Jun 06 '16 at 22:22
  • What do you get when you type: `pip --version` and also `python --version` ? – Nick Jun 06 '16 at 22:22
  • What about `python --version`? – Nick Jun 06 '16 at 22:28
  • Sorry for the confusion and 3.6 was a typo... I had version 3.5 first installed, and today I have installed 2.7. I get 3.5 when I type `pip --version', I get pip 8.1.2, and Python 3.5.1. – Fxs7576 Jun 06 '16 at 22:34
  • By all accounts, I would think you are running Python 3.5 on Jupyter. One way to test would be to `pip install mrjob` and then run your code to see if you still get the error. – Nick Jun 06 '16 at 22:39
  • There is no error when I import 'mrjob' on Python 3.5. But my code (wish I could show it in this comment) works only on Python 2.7, therefore I installed Python 2.7 and pip2.7 install 'mrjob'. – Fxs7576 Jun 06 '16 at 22:52
  • OK. But this tells you that your Jupyter Notebook is running 3.5 and not 2.7. You need to reconfigure Jupyter to use 2.7. I don't have any experience with that, but I'm sure you could read their docs or search to find an answer. – Nick Jun 06 '16 at 22:54
  • Check this out: http://stackoverflow.com/questions/28831854/how-do-i-add-python3-kernel-to-jupyter-ipython – Nick Jun 06 '16 at 22:56
  • Okay will do. :) Thank you very much for your time Nicarus. – Fxs7576 Jun 06 '16 at 22:57

0 Answers0