Can we retire numerix?

Hi all,

I just ran into an issue with py2exe -- my app failed because various numpy sub-packages weren't included. However, I wasn't using them. But it failed because numerix imports them, and they weren't included because it imports them with __import__

Anyway, I can work around this, but it made me wonder: is it time to retire numerix? We all should be using numpy anyway.

note that the docstring is out of date, too:

"""
1. The value of numerix in matplotlibrc: either Numeric or numarray

2. If none of the above is done, the default array package is Numeric.
    Because the matplotlibrc always provides *some* value for numerix
    (it has it's own system of default values), this default is most
    likely never used.

To summarize: the commandline is examined first, the rc file second,
and the default array package is Numeric.
"""

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...236...

Chris Barker wrote:

Hi all,

I just ran into an issue with py2exe -- my app failed because various numpy sub-packages weren't included. However, I wasn't using them. But it failed because numerix imports them, and they weren't included because it imports them with __import__

Anyway, I can work around this, but it made me wonder: is it time to retire numerix? We all should be using numpy anyway.

Why was numerix getting imported? Is this inherent in py2exe--that it imports all subpackages of a base, if you use that base (matplotlib)?

Numerix is there only for the convenience of anyone who has code that depends on it; it is completely unused in matplotlib itself. I would be happy get it out of matplotlib, or phase it out if necessary. I don't think it should be left there forever.

Eric

···

note that the docstring is out of date, too:

"""
1. The value of numerix in matplotlibrc: either Numeric or numarray

2. If none of the above is done, the default array package is Numeric.
    Because the matplotlibrc always provides *some* value for numerix
    (it has it's own system of default values), this default is most
    likely never used.

To summarize: the commandline is examined first, the rc file second,
and the default array package is Numeric.
"""

-Chris

Eric Firing wrote:

Why was numerix getting imported?

Good question -- I just figured MPL was doing it!

Is this inherent in py2exe--that it imports all subpackages of a base, if you use that base (matplotlib)?

nope -- it imports the regular old python way --just with a different sys.path

I'll poke into it a bit more, now that I know it shouldn't be doing it.

Numerix is there only for the convenience of anyone who has code that depends on it; it is completely unused in matplotlib itself.

That's what I was hoping.

> I would be

happy get it out of matplotlib, or phase it out if necessary. I don't think it should be left there forever.

I agree.

- Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...236...

I think it can be removed. It lives on the maintenance branch 0.91.

JDH

···

On Tue, Feb 24, 2009 at 1:44 PM, Christopher Barker <Chris.Barker@...236...> wrote:

happy get it out of matplotlib, or phase it out if necessary. I don't
think it should be left there forever.

huzzah

···

On Tue, Feb 24, 2009 at 3:48 PM, John Hunter <jdh2358@…149…> wrote:

On Tue, Feb 24, 2009 at 1:44 PM, Christopher Barker > > <Chris.Barker@…236…> wrote:

happy get it out of matplotlib, or phase it out if necessary. I don’t

think it should be left there forever.

I think it can be removed. It lives on the maintenance branch 0.91.

John Hunter wrote:

happy get it out of matplotlib, or phase it out if necessary. I don't
think it should be left there forever.

I think it can be removed. It lives on the maintenance branch 0.91.

Good point. I am in the process of removing it from the trunk. I should be doing this slightly differently, with a single commit, but I got ahead of myself, so it will take more than one. Sorry.

Eric

···

On Tue, Feb 24, 2009 at 1:44 PM, Christopher Barker > <Chris.Barker@...236...> wrote:

JDH

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

Chris Barker wrote:

Hi all,

I just ran into an issue with py2exe -- my app failed because various numpy sub-packages weren't included. However, I wasn't using them. But it failed because numerix imports them, and they weren't included because it imports them with __import__

Anyway, I can work around this, but it made me wonder: is it time to retire numerix? We all should be using numpy anyway.

It has been purged from the svn trunk. Now, if you can run your app after building from svn, it should become obvious where the numerix import was coming from, assuming it was in your app or in some package it imports.

Eric

Eric Firing wrote:

It has been purged from the svn trunk.

Thanks. Has it been deprecated somehow? I don't want folks' code to break too fast!

Now, if you can run your app after building from svn,

Well, I'm not set up to build on Windows...

it should become obvious where the numerix import was coming from

Found it: it was wxmpl. I'm going to send a patch to Ken.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...236...

Christopher Barker wrote:

Eric Firing wrote:

It has been purged from the svn trunk.

Thanks. Has it been deprecated somehow? I don't want folks' code to break too fast!

No, I guess I was in a dangerous mood--I just ripped it out. I could put it back with a deprecation if necessary--is it? The only nod to deprecation at present is that a matplotlibrc file with a numerix entry will trigger a warning instead of bombing.

It is still in the 0.98.5 maintenance branch, which I presume will be the source of the next release. One option would be to put a deprecation warning there, but leave the trunk as-is.

What we probably *should* have done was to put a deprecation warning in back when 0.98 was first released.

Eric

···

Now, if you can run your app after building from svn,

Well, I'm not set up to build on Windows...

it should become obvious where the numerix import was coming from

Found it: it was wxmpl. I'm going to send a patch to Ken.

-Chris

Ken,

I've found Numerix used in wxmpl, but it's been deprecated, so I've replaced all the calls with direct numpy calls. However, I can't pretend that I've tested well at all -- all I know is that it's working for me. In particular, I haven't tested plotit beyond making sure it complies.

I've enclosed a zip archive with my modifications. If you have it in SVN somewhere I could give you a diff -- just let me know if I can help further.

Also, I see this a lot in your plotit code:

if not isinstance(x, (np.ndarray, np.ma.masked_array)):

(though you had Numerix equivalent)

What I like to do instead is call:

try:
     x = asarray(x, dtype=np.float)
except ValueError:
     raise your error here...

(and maybe a reshape call, too, to make sure it can be converted into that shape)

I usually don't care if I'm getting an array, as long as it can be turned into one...

If you do want to check the type, np.ma is a subclass of ndarray, so:

isinstance(x, np.ndarray)

should do it. That's what I've put in the code for now.

-Chris

wxmpl-1.3.1-chb.zip (44.1 KB)

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...236...

Christopher Barker wrote:

Eric Firing wrote:

It has been purged from the svn trunk.

Thanks. Has it been deprecated somehow? I don't want folks' code to break too fast!

I have restored a stripped-down numpy-only version of numerix, with a prominent deprecation warning.

Eric

···

Now, if you can run your app after building from svn,

Well, I'm not set up to build on Windows...

it should become obvious where the numerix import was coming from

Found it: it was wxmpl. I'm going to send a patch to Ken.

-Chris