1

I have anaconda installed and many libraries of python, between those mpmath. When I try to run powerlaw package I get the following error:

-> 1466         from mpmath import erfc
   1467 #        from scipy.special import erfc
   1468         from scipy.constants import pi

ImportError: No module named mpmath

Furthermore when I simply try to do import mpmath I get the same error.

I'm using Fedora, I have already tried yum remove python-mpmath and then yum install python-mpmath. But I'm getting the same error.

I have seen in other questions that this might be because I have multiple paths and that I must add them both with a sys.path=['', etc].

What does "sys.path=['', etc]" mean?

When I do:

print(sys.path)

I get:

 ['', '/home/rm/anaconda/bin', '/home/rm/anaconda/lib/python27.zip',  '/home/rm/anaconda/lib/python2.7', '/home/rm/anaconda/lib/python2.7/plat-linux2', '/home/rm/anaconda/lib/python2.7/lib-tk', '/home/rm/anaconda/lib/python2.7/lib-old', 
'/home/rm/anaconda/lib/python2.7/lib-dynload', '/home/rm/anaconda/lib/python2.7/site-packages',  '/home/rm/anaconda/lib/python2.7/site-packages/PIL', '/home/rm/anaconda/lib/python2.7/site-packages/runipy-0.1.0-py2.7.egg', '/home/rm/anaconda/lib/python2.7/site-packages/setuptools-3.6-py2.7.egg', '/home/rm/anaconda/lib/python2.7/site-packages/IPython/extensions', 
'/home/rm/.ipython']
John Saunders
  • 160,644
  • 26
  • 247
  • 397
RM-
  • 986
  • 1
  • 13
  • 30
  • http://stackoverflow.com/questions/26599443/module-successfully-installed-but-not-found-in-ipython – Ashalynd Jan 11 '15 at 01:03
  • How can I add both paths? and how do I know which ones they are? edited question with further info – RM- Jan 11 '15 at 01:18
  • 1
    Do you have a separate Python installation from the one installed w/ anaconda? Based on the question above, try running the IDLE interpreter and doing `import sys; print(sys.path)`. Do you get a different set of paths? – zehnpaard Jan 11 '15 at 06:42
  • I believe so: '/home/rm/.ipython' and '/home/rm/anaconda/lib/python27.zip' – RM- Jan 12 '15 at 00:39
  • You get '/home/rm/.ipython/' from IDLE? – zehnpaard Jan 12 '15 at 04:31
  • I don't think I have IDLE, I just ran 'print(sys.path)' in python and got the above... – RM- Jan 12 '15 at 04:38
  • Ah, the SO post in the comment above was specifically for cases where you had two separate installations of Python. If you don't then it's probably not relevant. btw, why do you think anaconda contains mpmath? http://docs.continuum.io/anaconda/pkg-docs.html doesn't list it. – zehnpaard Jan 12 '15 at 04:44
  • I don't know is anaconda has it... but I do seem to have it installed. I did yum install python-mpmath and also updated. I get the following message when doing ` yum install python-mpmath --version ` : `Installed: rpm-4.11.3-2.fc20.x86_64 at 2015-01-11 01:05 Built : Fedora Project at 2014-12-12 16:25 Committed: Lubos Kardos at 2014-12-12 Installed: yum-3.4.3-152.fc20.noarch at 2014-08-12 15:40 Built : Fedora Project at 2014-06-18 12:25 Committed: James Antill at 2014-06-18` – RM- Jan 12 '15 at 05:10
  • you're on a linux machine right? so I imagine you already had a native installation of Python included out of the box. My guess is that mpmath was installed under that Python installation, rather than the anaconda one. Try finding that Python install, run the interactive prompt, check sys.path and see if it's different. – zehnpaard Jan 12 '15 at 05:23
  • Yes, I'm on Fedora. I think the two paths are: ` '/home/rm/anaconda/bin'` (anaconda) and `'/home/rm/.ipython'` (Fedora default I guess). Is this correct? Do I have to merge them somehow now? – RM- Jan 12 '15 at 06:12
  • Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). BTW, it's "Thanks in advance", not "Thanks in advanced". – John Saunders Jan 17 '15 at 06:00

1 Answers1

1

You should use conda to install Python packages into anaconda, or pip if they are not available via conda. conda install mpmath should fix your issue.

asmeurer
  • 86,894
  • 26
  • 169
  • 240