importing matplotlib gives warning

Bug #299381 reported by Sebastian Busch
16
Affects Status Importance Assigned to Milestone
matplotlib (Ubuntu)
Undecided
Unassigned

Bug Description

I am running Ubuntu 8.10, updated from 8.04 -- installed python and matplotlib with aptitude from the repositories. This warning also occurs when starting "ipython -pylab".

Best,
Sebastian.

sbusch@tof8:~$ uname -a
Linux tof8 2.6.24-21-generic #1 SMP Tue Oct 21 23:09:30 UTC 2008 x86_64 GNU/Linux
sbusch@tof8:~$ python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
/usr/lib/python2.5/site-packages/pytz/__init__.py:29: UserWarning: Module dateutil was already imported from /var/lib/python-support/python2.5/dateutil/__init__.py, but /var/lib/python-support/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
>>> matplotlib.__version__
'0.98.3'
>>>

Revision history for this message
tobal (lopeztobal) wrote :

I have the same problem in Intrepid Ibex with my python programs when i load pylab in my projects, it doesn't occur in Hardy

Benjamin Drung (bdrung)
Changed in matplotlib:
status: New → Confirmed
Revision history for this message
Michele Mattioni (mattions) wrote :

Same problem here on Intrepid Ibex.

mattions@triton:~$ uname -a
Linux triton 2.6.27-10-generic #1 SMP Fri Nov 21 12:00:22 UTC 2008 i686 GNU/Linux
mattions@triton:~$ python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
/usr/lib/python2.5/site-packages/pytz/__init__.py:29: UserWarning: Module dateutil was already imported from /var/lib/python-support/python2.5/dateutil/__init__.py, but /var/lib/python-support/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
>>> matplotlib.__version__
'0.98.3'
>>>

Revision history for this message
John D Hunter (jdh2358) wrote :

Hi,

I'm a matplotlib developer and I will posit a guess about what is going on. matplotlib optionally installs pytz and datetuil if it is not found on the system at install time. You can override the default behavior by copying the file setup.cfg.template to setup.cfg and editing it to turn off the pytz and dateutil installs::

  ## Date/timezone support:
  pytz = False
  dateutil = False

It looks like perhaps you are getting the ubuntu datetutil and the matplotlib datetuil, but this is just a guess. The ubuntu packager will probably want to rely on the upstream pytz and datetutil, and turn off matplotlib's install by modifying setup.cfg as described above.

JDH

Revision history for this message
Alan Jackson (alan-ajackson) wrote :

I installed matplotlib a few weeks ago into a fresh Intrepid install (I always do a fresh install instead of an update), and I don't see the reported issue. It could be I'm not loading some other python packages. I also run kubuntu instead of stock ubuntu.

- Alan

Revision history for this message
michael, liao (michael-hliao) wrote :

It's turned out that this issue is caused by outdated *.pyc files. I have the same issue after upgrading from Hardy to Inprepid. But, after running python in root (sudo python -c 'import matplotlib'), which will regenerate *.pyc files after checking timestamp, the problem disappear.

- Michael

Revision history for this message
Michele Mattioni (mattions) wrote :

Solution proposed by Michael

sudo python -c 'import matplotlib'

works here!

Thanks

Revision history for this message
michael, liao (michael-hliao) wrote :

yeah, I confirmed this on another machine upgraded from Hardy to Intrepid. The warning is caused by outdated *.pyc files.

It seems that the current manner to install/remove python libraries has potential issue, especially during system upgrading. Since some python packages' *.pyc files are generated somewhere else from where their *.py files is installed. Does these packages' cleanup script take care of these places?

Revision history for this message
Matthias Klose (doko) wrote :

this is only a problem with a custom install of matplotlib. the Ubuntu packages has proper dependencies on pytz and dateutil.

Changed in matplotlib:
status: Confirmed → Invalid
Revision history for this message
Václav Šmilauer (eudoxos) wrote :

Sorry, not the case here. I have matplotlib installed from package. Whe I run "import matplotlib" inside a program with embedded python interpreter, I get the warning, even though I made sure to delete all *.pyo and *.pyc files:

/usr/lib/python2.5/site-packages/pytz/__init__.py:29: UserWarning: Module dateutil was already imported from /var/lib/python-support/python2.5/dateutil/__init__.py, but /var/lib/python-support/python2.5 is being added to sys.path
  from pkg_resources import resource_stream

I don't get it in python/ipython prompt, however. Maybe it is not bug in matplotlib after all, but I would like to know the cause. Can you propose a solution, if you know of any?

Thanks, V.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers