Zhiwen Liang | 15 Jul 22:35

Problems on Installing New Fipy

Dear Fipy developers,

Sorry for bothering. I was trying to update fipy to the current trunk subversion but failed. I noticed the setup.py uses "setuptools" which is not in my machine yet. So I downloaded the egg for python 2.3 and installed it. But I still could not install fipy. I got it build though. The message I got after I say "python setup.py install --prefix=..." is:

running install
running bdist_egg
running egg_info
writing FiPy.egg-info/PKG-INFO
writing top-level names to FiPy.egg-info/top_level.txt
writing dependency_links to FiPy.egg-info/dependency_links.txt
Traceback (most recent call last):
  File "setup.py", line 743, in ?
    classifiers = [
  File "/sw/src/root-python23-2.3.5-12/sw/lib/python2.3/distutils/core.py", line 149, in setup
  File "/sw/src/root-python23-2.3.5-12/sw/lib/python2.3/distutils/dist.py", line 907, in run_commands
  File "/sw/src/root-python23-2.3.5-12/sw/lib/python2.3/distutils/dist.py", line 927, in run_command
  File "/sw/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg/setuptools/command/install.py", line 76, in run
    self.do_egg_install()
  File "/sw/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg/setuptools/command/install.py", line 96, in do_egg_install
    self.run_command('bdist_egg')
  File "/sw/lib/python2.3/cmd.py", line 333, in run_command
    
  File "/sw/src/root-python23-2.3.5-12/sw/lib/python2.3/distutils/dist.py", line 927, in run_command
  File "/sw/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg/setuptools/command/bdist_egg.py", line 167, in run
    self.run_command("egg_info")
  File "/sw/lib/python2.3/cmd.py", line 333, in run_command
    
  File "/sw/src/root-python23-2.3.5-12/sw/lib/python2.3/distutils/dist.py", line 927, in run_command
  File "/sw/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg/setuptools/command/egg_info.py", line 171, in run
    self.find_sources()
  File "/sw/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg/setuptools/command/egg_info.py", line 252, in find_sources
    mm.run()
  File "/sw/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg/setuptools/command/egg_info.py", line 306, in run
    self.add_defaults()
  File "/sw/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg/setuptools/command/egg_info.py", line 333, in add_defaults
    rcfiles = list(walk_revctrl())
  File "/sw/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg/setuptools/command/sdist.py", line 45, in walk_revctrl
    for item in ep.load()(dirname):
  File "/sw/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg/setuptools/command/sdist.py", line 52, in _default_revctrl
    for path in finder(dirname,path):
  File "/sw/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg/setuptools/command/sdist.py", line 98, in entries_finder
    log.warn("unrecognized .svn/entries format in %s", dirname)
NameError: global name 'log' is not defined

Thank you in advance for any advice. 

Have a nice day!

Zhiwen
Jonathan Guyer | 16 Jul 03:39

Re: Problems on Installing New Fipy


On Jul 15, 2008, at 4:38 PM, Zhiwen Liang wrote:

>> Sorry for bothering. I was trying to update fipy to the current  
>> trunk subversion but failed. I noticed the setup.py uses  
>> "setuptools" which is not in my machine yet. So I downloaded the  
>> egg for python 2.3 and installed it. But I still could not install  
>> fipy. I got it build though. The message I got after I say "python  
>> setup.py install --prefix=..." is:

>>
>> NameError: global name 'log' is not defined

I don't know what that error message means, and I'm also not clear on  
what egg you mean. The installation procedure for setuptools that I  
know about is at

   http://peak.telecommunity.com/DevCenter/EasyInstall#installation-instructions

I recommend that you delete /sw/lib/python2.3/site-packages/ 
setuptools-0.6c8-py2.3.egg and then follow those instructions.

Once trunk/ is stabilized, the use and installation of setuptools  
should be automated, but we're not there yet.

LUK ShunTim | 16 Jul 06:09

Re: Problems on Installing New Fipy


Jonathan Guyer wrote:
> 
> 
> On Jul 15, 2008, at 4:38 PM, Zhiwen Liang wrote:
> 
>>> Sorry for bothering. I was trying to update fipy to the current trunk
>>> subversion but failed. I noticed the setup.py uses "setuptools" which
>>> is not in my machine yet. So I downloaded the egg for python 2.3 and
>>> installed it. But I still could not install fipy. I got it build
>>> though. The message I got after I say "python setup.py install
>>> --prefix=..." is:
> 
> 
>>>
>>> NameError: global name 'log' is not defined
> 
> I don't know what that error message means, and I'm also not clear on
> what egg you mean. The installation procedure for setuptools that I know
> about is at
> 
>  
> http://peak.telecommunity.com/DevCenter/EasyInstall#installation-instructions
> 
> 
> I recommend that you delete
> /sw/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg and then
> follow those instructions.
> 
> Once trunk/ is stabilized, the use and installation of setuptools should
> be automated, but we're not there yet.
> 
> 

Hello,

I ran into this a few days ago. It appears the subversion 1.5 is not
recognised by setuptools. The patch here fixes it.

http://bugs.python.org/issue2770

Regards,
ST
--

Jonathan Guyer | 16 Jul 15:14

Re: Problems on Installing New Fipy


On Jul 16, 2008, at 12:09 AM, LUK ShunTim wrote:

> I ran into this a few days ago. It appears the subversion 1.5 is not
> recognised by setuptools. The patch here fixes it.
>
> http://bugs.python.org/issue2770

Very good to know. Thank you.

Zhiwen Liang | 16 Jul 21:14

Re: Problems on Installing New Fipy



On Wed, Jul 16, 2008 at 12:09 AM, LUK ShunTim <shuntim.luk-KoIT2pUv8WgCxDl3mouYzw@public.gmane.org> wrote:

Jonathan Guyer wrote:
>
>
> On Jul 15, 2008, at 4:38 PM, Zhiwen Liang wrote:
>
>>> Sorry for bothering. I was trying to update fipy to the current trunk
>>> subversion but failed. I noticed the setup.py uses "setuptools" which
>>> is not in my machine yet. So I downloaded the egg for python 2.3 and
>>> installed it. But I still could not install fipy. I got it build
>>> though. The message I got after I say "python setup.py install
>>> --prefix=..." is:
>
>
>>>
>>> NameError: global name 'log' is not defined
>
> I don't know what that error message means, and I'm also not clear on
> what egg you mean. The installation procedure for setuptools that I know
> about is at
>
>
> http://peak.telecommunity.com/DevCenter/EasyInstall#installation-instructions
>
>
> I recommend that you delete
> /sw/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg and then
> follow those instructions.
>
> Once trunk/ is stabilized, the use and installation of setuptools should
> be automated, but we're not there yet.
>
>

Hello,

I ran into this a few days ago. It appears the subversion 1.5 is not
recognised by setuptools. The patch here fixes it.

http://bugs.python.org/issue2770

Regards,
ST
--


Thank you very much for providing the information. I used the patch and now I can install fipy. I think except for the bug in setuptools, my biggest problem was I tried to install fipy in a directory that setuptools does not like. Please see:


However, if I install fipy in ~/Library/Python/2.3/site-packages/, as required, I have problem with my other modules. I really hope that I can install fipy in the place I want. So I wonder if there is a setup.py that does not use setuptools but still can install the new fipy? 

Sorry for the trouble. 

Zhiwen

Jonathan Guyer | 16 Jul 21:28

Re: Problems on Installing New Fipy


On Jul 16, 2008, at 3:14 PM, Zhiwen Liang wrote:

> Thank you very much for providing the information. I used the patch  
> and now I can install fipy. I think except for the bug in  
> setuptools, my biggest problem was I tried to install fipy in a  
> directory that setuptools does not like. Please see:
>
> http://peak.telecommunity.com/DevCenter/EasyInstall#mac-os-x-user-installation
>
> However, if I install fipy in ~/Library/Python/2.3/site-packages/,  
> as required, I have problem with my other modules.

What problems? What other modules?

> I really hope that I can install fipy in the place I want.

Which is where?

For the record, we never install FiPy at all. We simply adjust our  
$PYTHONPATH to point to whichever copy we want to use. Installing is  
fine, and can simplify a few things, but it's not necessary.

Depending on exactly what you are trying to do, you might want to look  
into http://pypi.python.org/pypi/virtualenv

(I have not had good luck with virtual-python.py)

> So I wonder if there is a setup.py that does not use setuptools but  
> still can install the new fipy?

No, we will not be supporting two different setup.py systems. We  
certainly are interested, however, in correcting any problems.

Zhiwen Liang | 16 Jul 22:37

Re: Problems on Installing New Fipy

Hi,

On Wed, Jul 16, 2008 at 3:28 PM, Jonathan Guyer <guyer-R3+/ord2DXQ@public.gmane.org> wrote:


On Jul 16, 2008, at 3:14 PM, Zhiwen Liang wrote:

Thank you very much for providing the information. I used the patch and now I can install fipy. I think except for the bug in setuptools, my biggest problem was I tried to install fipy in a directory that setuptools does not like. Please see:

http://peak.telecommunity.com/DevCenter/EasyInstall#mac-os-x-user-installation

However, if I install fipy in ~/Library/Python/2.3/site-packages/, as required, I have problem with my other modules.

What problems? What other modules?

I tried the diffusion example but got the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/Users/liangz/Library/Python/2.3/site-packages/fipy/viewers/__init__.py", line 112, in make
    raise ImportError, "Failed to import a viewer: %s" % str(errors)        
ImportError: Failed to import a viewer: ['gistViewer: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()', 'gnuplotViewer: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()', "matplotlibViewer: 'module' object has no attribute 'ion'", 'mayaviViewer: Mayavi does not display useful 1D data', "multiViewer: 'module' object has no attribute 'make'", "tsvViewer: 'module' object has no attribute 'make'"]

This error will appear whenever I tried "viewers.make". This might not be relevant to the installation problem but it never happened to me before. 



I really hope that I can install fipy in the place I want.

Which is where?

It would be more convenient to use "stow" to have different versions of the same application and then "stow" the version you like. This will require installing things in a stow directory. 
 


For the record, we never install FiPy at all. We simply adjust our $PYTHONPATH to point to whichever copy we want to use. Installing is fine, and can simplify a few things, but it's not necessary.

Depending on exactly what you are trying to do, you might want to look into http://pypi.python.org/pypi/virtualenv

(I have not had good luck with virtual-python.py)



So I wonder if there is a setup.py that does not use setuptools but still can install the new fipy?

No, we will not be supporting two different setup.py systems. We certainly are interested, however, in correcting any problems.


Thanks again,
Zhiwen

Jonathan Guyer | 16 Jul 23:04

Re: Problems on Installing New Fipy


On Jul 16, 2008, at 4:37 PM, Zhiwen Liang wrote:

> I tried the diffusion example but got the following error:
:
:

>  "matplotlibViewer: 'module' object has no attribute 'ion'"

leads me to believe that you have a module (or something) called  
"pylab" somewhere on your PYTHONPATH that is confusing matters. What  
does

  $ ls -l ~/Library/Python/2.3/site-packages/

return?

> It would be more convenient to use "stow" to have different versions  
> of the same application and then "stow" the version you like. This  
> will require installing things in a stow directory.

I've never heard of "stow", but found this:

   http://www.velocityreviews.com/forums/t331589-is-there-any-way-to-make-python-play-well-with-stow.html

I've used FiPy with virtualenv and it works fine (I will do some  
confirmatory tests, however)

Zhiwen Liang | 16 Jul 23:32

Re: Problems on Installing New Fipy


Hi,

On Wed, Jul 16, 2008 at 5:04 PM, Jonathan Guyer <guyer-R3+/ord2DXQ@public.gmane.org> wrote:


On Jul 16, 2008, at 4:37 PM, Zhiwen Liang wrote:

I tried the diffusion example but got the following error:
:
:



 "matplotlibViewer: 'module' object has no attribute 'ion'"

leads me to believe that you have a module (or something) called "pylab" somewhere on your PYTHONPATH that is confusing matters. What does

 $ ls -l ~/Library/Python/2.3/site-packages/

return?
 
 $ ls -l ~/Library/Python/2.3/site-packages/ returns the following:

 -rw-r--r--    1 liangz  liangz   214 Jul 16 14:39 easy-install.pth
drwxr-xr-x   19 liangz  liangz   646 Jul 16 14:53 fipy
drwxr-xr-x   10 liangz  liangz   340 Jul 16 14:39 setuptools-0.6c8-py2.3.egg
-rw-r--r--    1 liangz  liangz    29 Jul 16 14:39 setuptools.pth
-rw-r--r--    1 liangz  liangz  2362 Jul 16 14:39 site.py
-rw-r--r--    1 liangz  liangz  2025 Jul 16 14:39 site.pyc

They are just setuptools and fipy that I just installed. But I did find "pylab.py" under another site-packages. And matplotlib is at that same directory. I don't know where it comes from. Maybe it is installed together with matplotlib. 




It would be more convenient to use "stow" to have different versions of the same application and then "stow" the version you like. This will require installing things in a stow directory.

I've never heard of "stow", but found this:

 http://www.velocityreviews.com/forums/t331589-is-there-any-way-to-make-python-play-well-with-stow.html


I've used FiPy with virtualenv and it works fine (I will do some confirmatory tests, however)


Thank you very much. I didn't know that before.

Thanks again,
Zhiwen 

Daniel Wheeler | 17 Jul 00:26

Re: Problems on Installing New Fipy


What happens when you do "python -c 'import matplotlib; print
matplotlib.__path__'"?

On Wed, Jul 16, 2008 at 5:32 PM, Zhiwen Liang <lzwpurdue@...> wrote:
>
> Hi,
> On Wed, Jul 16, 2008 at 5:04 PM, Jonathan Guyer <guyer@...> wrote:
>>
>>
>> On Jul 16, 2008, at 4:37 PM, Zhiwen Liang wrote:
>>
>>> I tried the diffusion example but got the following error:
>>
>> :
>> :
>>
>>
>>>  "matplotlibViewer: 'module' object has no attribute 'ion'"
>>
>> leads me to believe that you have a module (or something) called "pylab"
>> somewhere on your PYTHONPATH that is confusing matters. What does
>>
>>  $ ls -l ~/Library/Python/2.3/site-packages/
>>
>> return?
>
>
>  $ ls -l ~/Library/Python/2.3/site-packages/ returns the following:
>
>  -rw-r--r--    1 liangz  liangz   214 Jul 16 14:39 easy-install.pth
> drwxr-xr-x   19 liangz  liangz   646 Jul 16 14:53 fipy
> drwxr-xr-x   10 liangz  liangz   340 Jul 16 14:39 setuptools-0.6c8-py2.3.egg
> -rw-r--r--    1 liangz  liangz    29 Jul 16 14:39 setuptools.pth
> -rw-r--r--    1 liangz  liangz  2362 Jul 16 14:39 site.py
> -rw-r--r--    1 liangz  liangz  2025 Jul 16 14:39 site.pyc
> They are just setuptools and fipy that I just installed. But I did find
> "pylab.py" under another site-packages. And matplotlib is at that same
> directory. I don't know where it comes from. Maybe it is installed together
> with matplotlib.
>>
>>
>>
>>> It would be more convenient to use "stow" to have different versions of
>>> the same application and then "stow" the version you like. This will require
>>> installing things in a stow directory.
>>
>> I've never heard of "stow", but found this:
>>
>>
>>  http://www.velocityreviews.com/forums/t331589-is-there-any-way-to-make-python-play-well-with-stow.html
>>
>> I've used FiPy with virtualenv and it works fine (I will do some
>> confirmatory tests, however)
>>
>
> Thank you very much. I didn't know that before.
> Thanks again,
> Zhiwen
>

--

-- 
Daniel Wheeler

Zhiwen Liang | 17 Jul 02:28

Re: Problems on Installing New Fipy

Hi,

I used fink to install matplotlib, so the path is:
['/sw/lib/python2.3/site-packages/matplotlib']
And the version is 0.87.3.

Thanks,
Zhiwen

On Wed, Jul 16, 2008 at 6:26 PM, Daniel Wheeler <daniel.wheeler2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

What happens when you do "python -c 'import matplotlib; print
matplotlib.__path__'"?

On Wed, Jul 16, 2008 at 5:32 PM, Zhiwen Liang <lzwpurdue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Hi,
> On Wed, Jul 16, 2008 at 5:04 PM, Jonathan Guyer <guyer-R3+/ord2DXQ@public.gmane.org> wrote:
>>
>>
>> On Jul 16, 2008, at 4:37 PM, Zhiwen Liang wrote:
>>
>>> I tried the diffusion example but got the following error:
>>
>> :
>> :
>>
>>
>>>  "matplotlibViewer: 'module' object has no attribute 'ion'"
>>
>> leads me to believe that you have a module (or something) called "pylab"
>> somewhere on your PYTHONPATH that is confusing matters. What does
>>
>>  $ ls -l ~/Library/Python/2.3/site-packages/
>>
>> return?
>
>
>  $ ls -l ~/Library/Python/2.3/site-packages/ returns the following:
>
>  -rw-r--r--    1 liangz  liangz   214 Jul 16 14:39 easy-install.pth
> drwxr-xr-x   19 liangz  liangz   646 Jul 16 14:53 fipy
> drwxr-xr-x   10 liangz  liangz   340 Jul 16 14:39 setuptools-0.6c8-py2.3.egg
> -rw-r--r--    1 liangz  liangz    29 Jul 16 14:39 setuptools.pth
> -rw-r--r--    1 liangz  liangz  2362 Jul 16 14:39 site.py
> -rw-r--r--    1 liangz  liangz  2025 Jul 16 14:39 site.pyc
> They are just setuptools and fipy that I just installed. But I did find
> "pylab.py" under another site-packages. And matplotlib is at that same
> directory. I don't know where it comes from. Maybe it is installed together
> with matplotlib.
>>
>>
>>
>>> It would be more convenient to use "stow" to have different versions of
>>> the same application and then "stow" the version you like. This will require
>>> installing things in a stow directory.
>>
>> I've never heard of "stow", but found this:
>>
>>
>>  http://www.velocityreviews.com/forums/t331589-is-there-any-way-to-make-python-play-well-with-stow.html
>>
>> I've used FiPy with virtualenv and it works fine (I will do some
>> confirmatory tests, however)
>>
>
> Thank you very much. I didn't know that before.
> Thanks again,
> Zhiwen
>



--
Daniel Wheeler


Jonathan Guyer | 17 Jul 04:57

Re: Problems on Installing New Fipy


On Jul 16, 2008, at 8:28 PM, Zhiwen Liang wrote:

> I used fink to install matplotlib, so the path is:
> ['/sw/lib/python2.3/site-packages/matplotlib']
> And the version is 0.87.3.

Please try the same thing with pylab. That's what has the ion() method.

Jonathan Guyer | 17 Jul 18:59

Re: Problems on Installing New Fipy


On Jul 16, 2008, at 10:57 PM, Jonathan Guyer wrote:

>
>
> On Jul 16, 2008, at 8:28 PM, Zhiwen Liang wrote:
>
>> I used fink to install matplotlib, so the path is:
>> ['/sw/lib/python2.3/site-packages/matplotlib']
>> And the version is 0.87.3.
>
> Please try the same thing with pylab. That's what has the ion()  
> method.

Correction. pylab doesn't have a __path__ attribute (I don't know why  
matplotlib has one, for that matter).

Please check pylab.__file__

Zhiwen Liang | 17 Jul 23:30

Re: Problems on Installing New Fipy

Hi, 

First I want to thank you for all the package management suggestions. I think my packages are getting a little messy here. 

Then I tried to find the pylab. There is only one pylab.py in my computer and it lives at the same site-packages directory as matplotlib, which is /sw/lib/python2.3/site-packages. But Jon is right, it is broken. I had trouble importing pylab. What I don't understand is, matplotlib and pylab are just viewers and the example of 1D diffusion should only use gistViewer. The code tries to use gistViewer before it tries matplotlib. Right?

Another problem I found is, after installing fipy, it creates a Fipy-2.0a1-py2.3.egg directory, instead of a single fipy directory, under the site-packages directory. But there is a fipy under Fipy-2.0a1-py2.3.egg. I can still import fipy. Is that normal?

I tried to install fipy in another machine, but with no luck. That machine has matplotlib working properly. The message I got was "Fatal Python error: Interpreter not initialized (version mismatch?)". The gcc compiler is the same as when python was built.

Again, sorry for all the trouble.

Zhiwen



On Thu, Jul 17, 2008 at 12:59 PM, Jonathan Guyer <guyer-R3+/ord2DXQ@public.gmane.org> wrote:


On Jul 16, 2008, at 10:57 PM, Jonathan Guyer wrote:



On Jul 16, 2008, at 8:28 PM, Zhiwen Liang wrote:

I used fink to install matplotlib, so the path is:
['/sw/lib/python2.3/site-packages/matplotlib']
And the version is 0.87.3.

Please try the same thing with pylab. That's what has the ion() method.

Correction. pylab doesn't have a __path__ attribute (I don't know why matplotlib has one, for that matter).

Please check pylab.__file__




Daniel Wheeler | 18 Jul 16:40

Re: Problems on Installing New Fipy


On Thu, Jul 17, 2008 at 5:30 PM, Zhiwen Liang <lzwpurdue@...> wrote:

> Then I tried to find the pylab. There is only one pylab.py in my computer
> and it lives at the same site-packages directory as matplotlib, which is
> /sw/lib/python2.3/site-packages.

I would say that python 2.3 is getting a little old at this point, not
that things shouldn't work of course, but a lot of people are using
2.5 now.

> But Jon is right, it is broken. I had
> trouble importing pylab.

What actually happens when you import pylab or matplotlib? You could
make fink reinstall matplotlib and see if it deals with any issues.

> What I don't understand is, matplotlib and pylab
> are just viewers and the example of 1D diffusion should only use gistViewer.

FiPy can use either gist, gnuplot, matplotlib and mayavi for all
dimensions, but I'm not sure about the precedence. You can specify
which viewer you prefer by setting a "FIPY_VIEWER" environment
variable to be one of "gist", "matplotlib", "gnuplot" or "mayavi".

> The code tries to use gistViewer before it tries matplotlib. Right?

Just specify the environment variable to be sure.

> Another problem I found is, after installing fipy, it creates a
> Fipy-2.0a1-py2.3.egg directory, instead of a single fipy directory, under
> the site-packages directory.

Why is that a problem?

> But there is a fipy under Fipy-2.0a1-py2.3.egg.
> I can still import fipy. Is that normal?

I don't know. Understanding the egg hocus-pocus seems unnecessary. The
important consideration is whether the fipy installation works. Does
it?

> I tried to install fipy in another machine, but with no luck. That machine
> has matplotlib working properly. The message I got was "Fatal Python error:
> Interpreter not initialized (version mismatch?)".

At what point did you get this message? Did "python setup.py install"
in the fipy directory do its thing without barfing?

--

-- 
Daniel Wheeler

Jonathan Guyer | 18 Jul 16:39

Re: Problems on Installing New Fipy


On Jul 17, 2008, at 5:30 PM, Zhiwen Liang wrote:

> Then I tried to find the pylab. There is only one pylab.py in my  
> computer and it lives at the same site-packages directory as  
> matplotlib, which is /sw/lib/python2.3/site-packages.

Python imports can be kind of tricky sometimes, which is why I asked  
you to report the result of

    >>> import pylab
    >>> pylab.__file__

> But Jon is right, it is broken. I had trouble importing pylab.

Meaning what? I don't believe it's possible to get the error "'module'  
object has no attribute 'ion'" without importing *something*. If  
`import pylab` fails, then you should have gotten a different error  
message from `viewers.make()`.

> What I don't understand is, matplotlib and pylab are just viewers  
> and the example of 1D diffusion should only use gistViewer. The code  
> tries to use gistViewer before it tries matplotlib. Right?

No, it doesn't only use gistViewer. It uses the first viewer that it  
can find that actually works. gistViewer and gnuplotViewer failed, so  
it tried matplotlibViewer. I addressed that one first, because the  
error was easier to diagnose.

I don't know why your other viewers are throwing "The truth value of  
an array with more than one element is ambiguous. Use a.any() or  
a.all()". examples/diffusion/mesh1D.py does not generate that error  
with any of our viewers. Have you modified the example in any way? Are  
you running the tip of trunk/?

To determine what is the problem, please edit fipy/viewers/__init__.py  
and at line 108, please add

         except Exception:
             raise

*above* the line that says `except Exception, s` and then report back  
the full text of the error trace.

> Another problem I found is, after installing fipy, it creates a  
> Fipy-2.0a1-py2.3.egg directory, instead of a single fipy directory,  
> under the site-packages directory. But there is a fipy under  
> Fipy-2.0a1-py2.3.egg. I can still import fipy. Is that normal?

Yes. It's one result of our switch to setuptools.

> I tried to install fipy in another machine, but with no luck. That  
> machine has matplotlib working properly. The message I got was  
> "Fatal Python error: Interpreter not initialized (version  
> mismatch?)". The gcc compiler is the same as when python was built.

gcc is not the problem. The Python interpreter has changed since some  
library was compiled against it. That's not FiPy because FiPy is not  
compiled. Likely candidates are PySparse, NumPy, SciPy, or any of the  
viewers.

Zhiwen Liang | 18 Jul 22:00

Re: Problems on Installing New Fipy

Hi,

Thank you for all the concerns. Let's get one thing at a time. I found the reason for error of "The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()". 
In the 'make' function of viewers/__init__.py, after it creates a viewer for one of the variable of the list of variables passed into the function, it will delete that variable and create viewer for the next one, until the list of variables is empty. So that's what Line 102-103 in viewers/__init__.py do. It is the "remove" in Line 103 that causes the problem. For example, if I run:

from fipy import *
mesh=Grid1D(nx=5)
var=CellVariable(mesh=mesh,value=[1,2,3,4,5])
varlist=[var]
varlist.remove(var)

Then I get the error of:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/Users/liangz/Library/Python/2.3/site-packages/FiPy-2.0a1-py2.3.egg/fipy/variables/variable.py", line 1112, in __nonzero__
    return bool(self.getValue())
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

which is the same as the error for making a gistViewer. 

The trace back shows that "remove" somehow uses the function of "__nonzero__" in variables/variables.py. And "var.getValue()" in that function returns a list. Taking the boolean of a list causes the error. But I am not sure why "remove" will use "__nonzero__". 

I tried "vars.remove(var)" in an older version of fipy and it works fine. 

I am still checking my other installation problems to see if I made some stupid mistakes.

Thanks again. 

Zhiwen



On Fri, Jul 18, 2008 at 10:39 AM, Jonathan Guyer <guyer-R3+/ord2DXQ@public.gmane.org> wrote:


On Jul 17, 2008, at 5:30 PM, Zhiwen Liang wrote:

Then I tried to find the pylab. There is only one pylab.py in my computer and it lives at the same site-packages directory as matplotlib, which is /sw/lib/python2.3/site-packages.

Python imports can be kind of tricky sometimes, which is why I asked you to report the result of

  >>> import pylab
  >>> pylab.__file__


But Jon is right, it is broken. I had trouble importing pylab.

Meaning what? I don't believe it's possible to get the error "'module' object has no attribute 'ion'" without importing *something*. If `import pylab` fails, then you should have gotten a different error message from `viewers.make()`.


What I don't understand is, matplotlib and pylab are just viewers and the example of 1D diffusion should only use gistViewer. The code tries to use gistViewer before it tries matplotlib. Right?

No, it doesn't only use gistViewer. It uses the first viewer that it can find that actually works. gistViewer and gnuplotViewer failed, so it tried matplotlibViewer. I addressed that one first, because the error was easier to diagnose.

I don't know why your other viewers are throwing "The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()". examples/diffusion/mesh1D.py does not generate that error with any of our viewers. Have you modified the example in any way? Are you running the tip of trunk/?

To determine what is the problem, please edit fipy/viewers/__init__.py and at line 108, please add

       except Exception:
           raise

*above* the line that says `except Exception, s` and then report back the full text of the error trace.


Another problem I found is, after installing fipy, it creates a Fipy-2.0a1-py2.3.egg directory, instead of a single fipy directory, under the site-packages directory. But there is a fipy under Fipy-2.0a1-py2.3.egg. I can still import fipy. Is that normal?

Yes. It's one result of our switch to setuptools.


I tried to install fipy in another machine, but with no luck. That machine has matplotlib working properly. The message I got was "Fatal Python error: Interpreter not initialized (version mismatch?)". The gcc compiler is the same as when python was built.

gcc is not the problem. The Python interpreter has changed since some library was compiled against it. That's not FiPy because FiPy is not compiled. Likely candidates are PySparse, NumPy, SciPy, or any of the viewers.



Jonathan Guyer | 19 Jul 04:52

Re: Problems on Installing New Fipy


On Jul 18, 2008, at 4:00 PM, Zhiwen Liang wrote:

> So that's what Line 102-103 in viewers/__init__.py do.

Yes, I know. I wrote it. Can I suggest that both of our time would be  
better spent if you sent me the specific output that I asked for  
rather than trying figure out and then explain to me how my own code  
works?

> But I am not sure why "remove" will use "__nonzero__".

Nor am I. Python 2.4 and 2.5 don't do this. I suspect that it was a  
bug, or at least a bad design, in Python 2.3. As Daniel has said,  
Python 2.3 is quite old (3 1/2 years, now) and you would likely  
benefit in many ways from not using something so obsolete.

> I tried "vars.remove(var)" in an older version of fipy and it works  
> fine.

Variable.__nonzero__() was only introduced about a month ago.

> I am still checking my other installation problems to see if I made  
> some stupid mistakes.

Again. Please, Please, *PLEASE* send me the output that I asked for.  
What does

   >>> import pylab
   >>> pylab.__file__

output?

Seriously. I want to know.

Zhiwen Liang | 19 Jul 17:44

Re: Problems on Installing New Fipy

Hi Jon, 

When I "import pylab", I got:

>>> import pylab
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/sw/lib/python2.3/site-packages/pylab.py", line 1, in ?
    from matplotlib.pylab import *
  File "/sw/lib/python2.3/site-packages/matplotlib/pylab.py", line 196, in ?
    import cm
  File "/sw/lib/python2.3/site-packages/matplotlib/cm.py", line 5, in ?
    import colors
  File "/sw/lib/python2.3/site-packages/matplotlib/colors.py", line 33, in ?
    from numerix import array, arange, take, put, Float, Int, where, \
  File "/sw/lib/python2.3/site-packages/matplotlib/numerix/__init__.py", line 68, in ?
    from _sp_imports import nx, infinity
  File "/sw/lib/python2.3/site-packages/matplotlib/numerix/_sp_imports.py", line 1, in ?
    from numpy import Int8, UInt8, \
ImportError: cannot import name Int8

So I could not do "pylab.__file__". I confirmed there is only this pylab.py in my computer because if I uninstall matplotlib, there will be no module called pylab. 

I agreed that python 2.3 is too old. Matplotlib now only releases new versions for python 2.4 and higher. 

Thanks,
Zhiwen


On Fri, Jul 18, 2008 at 10:52 PM, Jonathan Guyer <guyer-R3+/ord2DXQ@public.gmane.org> wrote:


On Jul 18, 2008, at 4:00 PM, Zhiwen Liang wrote:

So that's what Line 102-103 in viewers/__init__.py do.

Yes, I know. I wrote it. Can I suggest that both of our time would be better spent if you sent me the specific output that I asked for rather than trying figure out and then explain to me how my own code works?



But I am not sure why "remove" will use "__nonzero__".

Nor am I. Python 2.4 and 2.5 don't do this. I suspect that it was a bug, or at least a bad design, in Python 2.3. As Daniel has said, Python 2.3 is quite old (3 1/2 years, now) and you would likely benefit in many ways from not using something so obsolete.


I tried "vars.remove(var)" in an older version of fipy and it works fine.

Variable.__nonzero__() was only introduced about a month ago.


I am still checking my other installation problems to see if I made some stupid mistakes.

Again. Please, Please, *PLEASE* send me the output that I asked for. What does

 >>> import pylab
 >>> pylab.__file__

output?

Seriously. I want to know.



Daniel Wheeler | 21 Jul 16:04

Re: Problems on Installing New Fipy


What happens when you do "python -c 'from numpy.oldnumeric import Int8'"?

What happens when you do "python -c 'from numpy import Int8'"?

What happens when you do "python -c 'import numpy; print numpy.__version__'"?

On Sat, Jul 19, 2008 at 11:44 AM, Zhiwen Liang <lzwpurdue@...> wrote:
> Hi Jon,
> When I "import pylab", I got:
>>>> import pylab
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/sw/lib/python2.3/site-packages/pylab.py", line 1, in ?
>     from matplotlib.pylab import *
>   File "/sw/lib/python2.3/site-packages/matplotlib/pylab.py", line 196, in ?
>     import cm
>   File "/sw/lib/python2.3/site-packages/matplotlib/cm.py", line 5, in ?
>     import colors
>   File "/sw/lib/python2.3/site-packages/matplotlib/colors.py", line 33, in ?
>     from numerix import array, arange, take, put, Float, Int, where, \
>   File "/sw/lib/python2.3/site-packages/matplotlib/numerix/__init__.py",
> line 68, in ?
>     from _sp_imports import nx, infinity
>   File "/sw/lib/python2.3/site-packages/matplotlib/numerix/_sp_imports.py",
> line 1, in ?
>     from numpy import Int8, UInt8, \
> ImportError: cannot import name Int8
> So I could not do "pylab.__file__". I confirmed there is only this pylab.py
> in my computer because if I uninstall matplotlib, there will be no module
> called pylab.
> I agreed that python 2.3 is too old. Matplotlib now only releases new
> versions for python 2.4 and higher.
> Thanks,
> Zhiwen
>
> On Fri, Jul 18, 2008 at 10:52 PM, Jonathan Guyer <guyer@...> wrote:
>>
>>
>> On Jul 18, 2008, at 4:00 PM, Zhiwen Liang wrote:
>>
>>> So that's what Line 102-103 in viewers/__init__.py do.
>>
>> Yes, I know. I wrote it. Can I suggest that both of our time would be
>> better spent if you sent me the specific output that I asked for rather than
>> trying figure out and then explain to me how my own code works?
>>
>>
>>> But I am not sure why "remove" will use "__nonzero__".
>>
>> Nor am I. Python 2.4 and 2.5 don't do this. I suspect that it was a bug,
>> or at least a bad design, in Python 2.3. As Daniel has said, Python 2.3 is
>> quite old (3 1/2 years, now) and you would likely benefit in many ways from
>> not using something so obsolete.
>>
>>> I tried "vars.remove(var)" in an older version of fipy and it works fine.
>>
>> Variable.__nonzero__() was only introduced about a month ago.
>>
>>> I am still checking my other installation problems to see if I made some
>>> stupid mistakes.
>>
>> Again. Please, Please, *PLEASE* send me the output that I asked for. What
>> does
>>
>>  >>> import pylab
>>  >>> pylab.__file__
>>
>> output?
>>
>> Seriously. I want to know.
>>
>>
>
>

--

-- 
Daniel Wheeler

Jonathan Guyer | 21 Jul 16:17

Re: Problems on Installing New Fipy


On Jul 19, 2008, at 11:44 AM, Zhiwen Liang wrote:

> When I "import pylab", I got:
>
> >>> import pylab
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/sw/lib/python2.3/site-packages/pylab.py", line 1, in ?
>     from matplotlib.pylab import *
>   File "/sw/lib/python2.3/site-packages/matplotlib/pylab.py", line  
> 196, in ?
>     import cm
>   File "/sw/lib/python2.3/site-packages/matplotlib/cm.py", line 5,  
> in ?
>     import colors
>   File "/sw/lib/python2.3/site-packages/matplotlib/colors.py", line  
> 33, in ?
>     from numerix import array, arange, take, put, Float, Int, where, \
>   File "/sw/lib/python2.3/site-packages/matplotlib/numerix/ 
> __init__.py", line 68, in ?
>     from _sp_imports import nx, infinity
>   File "/sw/lib/python2.3/site-packages/matplotlib/numerix/ 
> _sp_imports.py", line 1, in ?
>     from numpy import Int8, UInt8, \
> ImportError: cannot import name Int8

Interesting. I need to figure out why viewers.make() doesn't report  
this error message to you, instead of the one about pylab.io() (mind  
you, I'd have had no idea where this error message was coming from, so  
we'll need to figure out an easier way to report backtraces for  
failing viewers).

In the meantime, please do provide the diagnostics that Daniel asked  
for.

> So I could not do "pylab.__file__". I confirmed there is only this  
> pylab.py in my computer because if I uninstall matplotlib, there  
> will be no module called pylab.

Understood. I just wanted to be certain that you were getting the  
import you thought you were; I've had subtle things happen with .pth  
files and such.

> I agreed that python 2.3 is too old. Matplotlib now only releases  
> new versions for python 2.4 and higher.

While I'm glad you agree, I'm a little puzzled. I thought the whole  
point of fink was that it kept different packages consistent with one  
another. If you have python 2.3, then it should be loading an  
appropriate version of matplotlib or it should be insisting that you  
install a newer version of python.

Zhiwen Liang | 21 Jul 17:02

Re: Problems on Installing New Fipy

Hi

On Mon, Jul 21, 2008 at 10:17 AM, Jonathan Guyer <guyer-R3+/ord2DXQ@public.gmane.org> wrote:


On Jul 19, 2008, at 11:44 AM, Zhiwen Liang wrote:

When I "import pylab", I got:

>>> import pylab
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "/sw/lib/python2.3/site-packages/pylab.py", line 1, in ?
   from matplotlib.pylab import *
 File "/sw/lib/python2.3/site-packages/matplotlib/pylab.py", line 196, in ?
   import cm
 File "/sw/lib/python2.3/site-packages/matplotlib/cm.py", line 5, in ?
   import colors
 File "/sw/lib/python2.3/site-packages/matplotlib/colors.py", line 33, in ?
   from numerix import array, arange, take, put, Float, Int, where, \
 File "/sw/lib/python2.3/site-packages/matplotlib/numerix/__init__.py", line 68, in ?
   from _sp_imports import nx, infinity
 File "/sw/lib/python2.3/site-packages/matplotlib/numerix/_sp_imports.py", line 1, in ?
   from numpy import Int8, UInt8, \
ImportError: cannot import name Int8

Interesting. I need to figure out why viewers.make() doesn't report this error message to you, instead of the one about pylab.io() (mind you, I'd have had no idea where this error message was coming from, so we'll need to figure out an easier way to report backtraces for failing viewers).

In the meantime, please do provide the diagnostics that Daniel asked for.

 Regarding Daniel's question, I have the following output.

What happens when you do "python -c 'from numpy.oldnumeric import Int8'"?

I can import Int8  this way. 

What happens when you do "python -c 'from numpy import Int8'"?

The error is:
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: cannot import name Int8

What happens when you do "python -c 'import numpy; print numpy.__version__'"?

It is 1.0.1



So I could not do "pylab.__file__". I confirmed there is only this pylab.py in my computer because if I uninstall matplotlib, there will be no module called pylab.

Understood. I just wanted to be certain that you were getting the import you thought you were; I've had subtle things happen with .pth files and such.


I agreed that python 2.3 is too old. Matplotlib now only releases new versions for python 2.4 and higher.

While I'm glad you agree, I'm a little puzzled. I thought the whole point of fink was that it kept different packages consistent with one another. If you have python 2.3, then it should be loading an appropriate version of matplotlib or it should be insisting that you install a newer version of python.



Fink still provide matplotlib for python 2.3, but from the errors I got, I have a feeling that this version is not compatible with the numpy I have. So I tried to download the source code and install myself but could not find anything for python 2.3.  Sorry if I confused you.

Thanks again,
Zhiwen


Daniel Wheeler | 21 Jul 19:20

Re: Problems on Installing New Fipy


On Mon, Jul 21, 2008 at 11:02 AM, Zhiwen Liang <lzwpurdue@...> wrote:
>>> "/sw/lib/python2.3/site-packages/matplotlib/numerix/_sp_imports.py", line 1,
>>> in ?
>>>    from numpy import Int8, UInt8, \
>>> ImportError: cannot import name Int8
>>
>
>  Regarding Daniel's question, I have the following output.
> What happens when you do "python -c 'from numpy.oldnumeric import Int8'"?
>
> I can import Int8  this way.

Paste the contents of
"/sw/lib/python2.3/site-packages/matplotlib/numerix/_sp_imports.py" in
an email.
What version of matplotlib do you have? Look in
"/sw/lib/python2.3/site-packages/matplotlib/__init__.py" and look for
"__version__" to find out.

> What happens when you do "python -c 'from numpy import Int8'"?
> The error is:
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: cannot import name Int8
> What happens when you do "python -c 'import numpy; print
> numpy.__version__'"?
>
> It is 1.0.1

--

-- 
Daniel Wheeler

Zhiwen Liang | 21 Jul 23:16

Re: Problems on Installing New Fipy



On Mon, Jul 21, 2008 at 1:20 PM, Daniel Wheeler <daniel.wheeler2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

On Mon, Jul 21, 2008 at 11:02 AM, Zhiwen Liang <lzwpurdue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>> "/sw/lib/python2.3/site-packages/matplotlib/numerix/_sp_imports.py", line 1,
>>> in ?
>>>    from numpy import Int8, UInt8, \
>>> ImportError: cannot import name Int8
>>
>
>  Regarding Daniel's question, I have the following output.
> What happens when you do "python -c 'from numpy.oldnumeric import Int8'"?
>
> I can import Int8  this way.

Paste the contents of
"/sw/lib/python2.3/site-packages/matplotlib/numerix/_sp_imports.py" in
an email.

The contents of the file is:

from numpy import Int8, UInt8, \
     Int16, UInt16, \
     Int32, UInt32, \
     Float32, Float64, \
     Complex32, Complex64, \
     Float, Int, Complex

class _TypeNamespace:
    """Numeric compatible type aliases for use with extension functions."""
    Int8          = Int8
    UInt8         = UInt8
    Int16         = Int16
    UInt16        = UInt16
    Int32         = Int32
    UInt32        = UInt32
    Float32       = Float32
    Float64       = Float64
    Complex32     = Complex32
    Complex64     = Complex64

nx = _TypeNamespace()

from numpy import inf, infty, Infinity
infinity = Infinity



What version of matplotlib do you have? Look in
"/sw/lib/python2.3/site-packages/matplotlib/__init__.py" and look for
"__version__" to find out.

The version is 0.87.3. 

I replaced the import part in the file _sp_import.py to be:

try:
    from numpy.oldnumeric import Int8, UInt8, \
         Int16, UInt16, \
         Int32, UInt32, \
         Float32, Float64, \
         Complex32, Complex64, \
         Float, Int, Complex
except ImportError:
    from numpy import Int8, UInt8, \
         Int16, UInt16, \
         Int32, UInt32, \
         Float32, Float64, \
         Complex32, Complex64, \
         Float, Int, Complex

Then I can get through this file. But there are a lot of other files that need to be modified, i.e., replacing the numpy by numpy.oldnumeric. I guess this matplotlib is just too old but I could not find a right version for it. I think I will try to do it in another machine that use python2.4 or python2.5. Or use other viewers to view the results. 

Thank you very much for your times. I really appreciate it.

Zhiwen

 

> What happens when you do "python -c 'from numpy import Int8'"?
> The error is:
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: cannot import name Int8
> What happens when you do "python -c 'import numpy; print
> numpy.__version__'"?
>
> It is 1.0.1


--
Daniel Wheeler


LUK ShunTim | 17 Jul 13:08

Re: Problems on Installing New Fipy


Zhiwen Liang wrote:
> Hi,
> 
> On Wed, Jul 16, 2008 at 3:28 PM, Jonathan Guyer <guyer@... 
> <mailto:guyer@...>> wrote:
> 
> 
> 
>     On Jul 16, 2008, at 3:14 PM, Zhiwen Liang wrote:
> 
>         Thank you very much for providing the information. I used the
>         patch and now I can install fipy. I think except for the bug in
>         setuptools, my biggest problem was I tried to install fipy in a
>         directory that setuptools does not like. Please see:
> 
>         http://peak.telecommunity.com/DevCenter/EasyInstall#mac-os-x-user-installation
> 
>         However, if I install fipy in
>         ~/Library/Python/2.3/site-packages/, as required, I have problem
>         with my other modules.
> 
> 
>     What problems? What other modules?
> 
> I tried the diffusion example but got the following error:
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File 
> "/Users/liangz/Library/Python/2.3/site-packages/fipy/viewers/__init__.py", 
> line 112, in make
>     raise ImportError, "Failed to import a viewer: %s" % str(errors)        
> ImportError: Failed to import a viewer: ['gistViewer: The truth value of 
> an array with more than one element is ambiguous. Use a.any() or 
> a.all()', 'gnuplotViewer: The truth value of an array with more than one 
> element is ambiguous. Use a.any() or a.all()', "matplotlibViewer: 
> 'module' object has no attribute 'ion'", 'mayaviViewer: Mayavi does not 
> display useful 1D data', "multiViewer: 'module' object has no attribute 
> 'make'", "tsvViewer: 'module' object has no attribute 'make'"]
> 
> This error will appear whenever I tried "viewers.make". This might not 
> be relevant to the installation problem but it never happened to me before. 
> 
> 
> 
>         I really hope that I can install fipy in the place I want.
> 
> 
>     Which is where?

Hello,

I've not used mac os at all but your best guide of installing python 
modules (in non-standard places) is probably

Installing Python Modules
http://docs.python.org/inst/inst.html
		
And easy install respects distutils config files. You may want to setup 
a personal config file and modify PYTHONPATH.

Regards,
ST
--


Gmane