Pull #2210 adding namespace package mpl_toolkits and Python 2.7

I've built matplotlib-1.4.3 with Python 2.7.5, 3.3.2, 3.4.3. Python
3.3.2 and 3.4.3 work ok. With Python 2.7.5, I get:
    File "/tmp/lines3d_demo.py", line 2, in <module>
      from mpl_toolkits.mplot3d import Axes3D
  ImportError: No module named mpl_toolkits.mplot3d

There is no __init__.py in the mpl_toolkits directory unlike with
matplotlib-1.3.1:
  $ ls -l /opt/TWWfsw/matplotlib14/lib/python27/mpl_toolkits
  total 64
  drwxr-xr-x+ 2 root root 53 Jul 14 13:51 axes_grid
  drwxr-xr-x+ 2 root root 32 Jul 14 13:51 axes_grid1
  drwxr-xr-x+ 2 root root 29 Jul 14 13:51 axisartist
  -rw-r--r--+ 1 root root 3830 Dec 23 2014 exceltools.py
  -rw-r--r--+ 1 root root 3817 Jul 14 13:51 exceltools.pyc
  -rw-r--r--+ 1 root root 3817 Jul 14 13:51 exceltools.pyo
  -rw-r--r--+ 1 root root 19346 Dec 23 2014 gtktools.py
  -rw-r--r--+ 1 root root 19745 Jul 14 13:51 gtktools.pyc
  -rw-r--r--+ 1 root root 19706 Jul 14 13:51 gtktools.pyo
  drwxr-xr-x+ 2 root root 17 Jul 14 13:51 mplot3d
  drwxr-xr-x+ 3 root root 12 Jul 14 13:51 tests

If I copy the matplotlib-1.3.1 __init__.py to
/opt/TWWfsw/matplotlib14/lib/python27/mpl_toolkits, then everything
works ok.

···

--
albert chin (china@...319...)

I suspect this results from some aspect of your system; we routinely build and test with python 2.7.x. Maybe your python 2.7 setuptools needs to be updated?

Eric

···

On 2015/07/14 3:59 AM, Albert Chin wrote:

I've built matplotlib-1.4.3 with Python 2.7.5, 3.3.2, 3.4.3. Python
3.3.2 and 3.4.3 work ok. With Python 2.7.5, I get:
     File "/tmp/lines3d_demo.py", line 2, in <module>
       from mpl_toolkits.mplot3d import Axes3D
   ImportError: No module named mpl_toolkits.mplot3d

There is no __init__.py in the mpl_toolkits directory unlike with
matplotlib-1.3.1:
   $ ls -l /opt/TWWfsw/matplotlib14/lib/python27/mpl_toolkits
   total 64
   drwxr-xr-x+ 2 root root 53 Jul 14 13:51 axes_grid
   drwxr-xr-x+ 2 root root 32 Jul 14 13:51 axes_grid1
   drwxr-xr-x+ 2 root root 29 Jul 14 13:51 axisartist
   -rw-r--r--+ 1 root root 3830 Dec 23 2014 exceltools.py
   -rw-r--r--+ 1 root root 3817 Jul 14 13:51 exceltools.pyc
   -rw-r--r--+ 1 root root 3817 Jul 14 13:51 exceltools.pyo
   -rw-r--r--+ 1 root root 19346 Dec 23 2014 gtktools.py
   -rw-r--r--+ 1 root root 19745 Jul 14 13:51 gtktools.pyc
   -rw-r--r--+ 1 root root 19706 Jul 14 13:51 gtktools.pyo
   drwxr-xr-x+ 2 root root 17 Jul 14 13:51 mplot3d
   drwxr-xr-x+ 3 root root 12 Jul 14 13:51 tests

If I copy the matplotlib-1.3.1 __init__.py to
/opt/TWWfsw/matplotlib14/lib/python27/mpl_toolkits, then everything
works ok.

Most likely our fault. I rebuilt with setuptools-18.0.1 and that
didn't help. Looking at a Fedora 22 system,
matplotlib-1.4.3-py2.7-nspkg.pth is read, but not on our system. This
is the problem. If I move this file out of the way on the Fedora 22
system, the failure is the same as above. Just need to figure out how
Python reads this file.

···

On Tue, Jul 14, 2015 at 09:22:07AM -1000, Eric Firing wrote:

On 2015/07/14 3:59 AM, Albert Chin wrote:
> I've built matplotlib-1.4.3 with Python 2.7.5, 3.3.2, 3.4.3. Python
> 3.3.2 and 3.4.3 work ok. With Python 2.7.5, I get:
> File "/tmp/lines3d_demo.py", line 2, in <module>
> from mpl_toolkits.mplot3d import Axes3D
> ImportError: No module named mpl_toolkits.mplot3d
>
> [[ snip snip ]]

I suspect this results from some aspect of your system; we routinely
build and test with python 2.7.x. Maybe your python 2.7 setuptools
needs to be updated?

--
albert chin (china@...319...)

Ok, found the problem. Python only reads .pth files in the default
Python prefix (sys.prefix and sys.exec_prefix), not from any other
path in PYTHONPATH. I'll need to create sitecustomize.py to fix this.

···

On Tue, Jul 14, 2015 at 02:53:13PM -0500, Albert Chin wrote:

On Tue, Jul 14, 2015 at 09:22:07AM -1000, Eric Firing wrote:
> On 2015/07/14 3:59 AM, Albert Chin wrote:
> > I've built matplotlib-1.4.3 with Python 2.7.5, 3.3.2, 3.4.3. Python
> > 3.3.2 and 3.4.3 work ok. With Python 2.7.5, I get:
> > File "/tmp/lines3d_demo.py", line 2, in <module>
> > from mpl_toolkits.mplot3d import Axes3D
> > ImportError: No module named mpl_toolkits.mplot3d
> >
> > [[ snip snip ]]
>
> I suspect this results from some aspect of your system; we routinely
> build and test with python 2.7.x. Maybe your python 2.7 setuptools
> needs to be updated?

Most likely our fault. I rebuilt with setuptools-18.0.1 and that
didn't help. Looking at a Fedora 22 system,
matplotlib-1.4.3-py2.7-nspkg.pth is read, but not on our system. This
is the problem. If I move this file out of the way on the Fedora 22
system, the failure is the same as above. Just need to figure out how
Python reads this file.

--
albert chin (china@...319...)