[Matplotlib-users] Import error: Cannot import pylab modules

Benjamin Root ben.v.root at gmail.com
Mon Apr 25 17:39:56 EDT 2016


Yup, I think that is your problem. You will want to do a "sudo pip
uninstall pylab". By the way, it is really a bad idea to do any pip
installs with sudo. Pip installs execute arbitrary code, and you don't want
to give arbitrary code sudo access. Furthermore, it is probably best to
maintain a distinction between the "user's python" and the "system's
python". This is why virtual environments or anaconda has been so valuable
because it helps with maintaining that distinction.

I hope that helps!
Ben Root


On Mon, Apr 25, 2016 at 5:28 PM, blavergar <blancaverag at gmail.com> wrote:

> Thank you for the answer!
>
> This is the output:
>
> /usr/local/lib/python2.7/site-packages/pylab/__init__.pyc
>
> 2016-04-25 21:31 GMT+02:00 Benjamin Root [via matplotlib] <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=47021&i=0>>:
>
>> Can you do the following (from the python interpreter)
>>
>> import pylab
>> print pylab.__file__
>>
>> There has been a rogue package on pypi called "pylab" that we have been
>> trying to get taken off of the listing, since it conflicts with our
>> long-standing package and trademark. Nothing nefarious, just some person's
>> collection of dependencies that he decided to call pylab and uploaded to
>> pypi for his personal use.
>>
>> Ben Root
>>
>>
>> On Mon, Apr 25, 2016 at 5:00 AM, blavergar <[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=47019&i=0>> wrote:
>>
>>> Dear all,
>>>
>>> I want to use two programs (GroopM and QIIME) requiring matplotlib
>>> >=1.1.0
>>> and python 2.7, which I have installed. My OS is Centos 6.
>>>
>>> They both give similar errors:
>>>
>>> 1.
>>> (...)
>>> *** ERROR RAISED DURING STEP: Plot Taxonomy Summary
>>> Command run was:
>>>  plot_taxa_summary.py -i
>>>
>>> taxa_summary2/OTU_L2.txt,taxa_summary2/OTU_L3.txt,taxa_summary2/OTU_L4.txt,taxa_summary2/OTU_L5.txt,taxa_summary2/OTU_L6.txt
>>> -o taxa_summary2/taxa_summary_plots/
>>> Command returned exit status: 1
>>> Stdout:
>>>
>>> Stderr
>>> Traceback (most recent call last):
>>>   File "/usr/local/bin/plot_taxa_summary.py", line 20, in <module>
>>>     from qiime.plot_taxa_summary import make_all_charts
>>>   File
>>> "/usr/local/lib/python2.7/site-packages/qiime/plot_taxa_summary.py",
>>> line 24, in <module>
>>>     from pylab import rc, axis, title, axes, pie, figlegend, clf,
>>> savefig,
>>> figure\
>>> *ImportError: cannot import name rc*
>>>
>>>
>>>
>>> Pylab is imported in plot_taxa_summary.py as follows:
>>>
>>> (...)
>>>
>>> import matplotlib
>>> import re
>>> matplotlib.use('Agg', warn=False)
>>> from matplotlib.font_manager import FontProperties
>>> from pylab import rc, axis, title, axes, pie, figlegend, clf, savefig,
>>> figure\
>>>     , close
>>>
>>> (...)
>>>
>>>
>>> 2.
>>> (...)
>>> File "/usr/local/lib/python2.7/site-packages/groopm/cluster.py", line
>>> 54, in
>>> <module>
>>> from pylab import show
>>>
>>> *ImportError: cannot import name show*
>>>
>>>
>>>
>>> And the content of cluster.py involving the importing of pylab is:
>>> (...)
>>> from sys import stdout, exit
>>>
>>> from colorsys import hsv_to_rgb as htr
>>> import matplotlib.pyplot as plt
>>> from pylab import show
>>> from numpy import (abs as np_abs,
>>>  (...)
>>>
>>>
>>>
>>> As I read that pylab is installed directly with matplotlib I have already
>>> tried different versions and installations (conda, pip, yum...) but none
>>> of
>>> them got those programs working.
>>>
>>>
>>> Could someone help with this, please?
>>>
>>> Thank you!
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://matplotlib.1069221.n5.nabble.com/Import-error-Cannot-import-pylab-modules-tp47010.html
>>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> [hidden email] <http:///user/SendEmail.jtp?type=node&node=47019&i=1>
>>> https://mail.python.org/mailman/listinfo/matplotlib-users
>>>
>>
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> [hidden email] <http:///user/SendEmail.jtp?type=node&node=47019&i=2>
>> https://mail.python.org/mailman/listinfo/matplotlib-users
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://matplotlib.1069221.n5.nabble.com/Import-error-Cannot-import-pylab-modules-tp47010p47019.html
>> To unsubscribe from Import error: Cannot import pylab modules, click here
>> .
>> NAML
>> <http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
> ------------------------------
> View this message in context: Re: Import error: Cannot import pylab
> modules
> <http://matplotlib.1069221.n5.nabble.com/Import-error-Cannot-import-pylab-modules-tp47010p47021.html>
>
> Sent from the matplotlib - users mailing list archive
> <http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html> at
> Nabble.com.
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160425/29c2be97/attachment-0001.html>


More information about the Matplotlib-users mailing list