Subject: [FEniCS-dev] Problems with Fenics port to Debian/Etch

From: Balbir Thomas <[email-masked]>
Date: Sat, 7 Feb 2009 05:24:04 -0500

Hi,

I have recently managed to build and install debian packages of Dolfin, FFC,
FIAT, UFC, Instant, SyFI, FErari, and Viper on Debian/Etch. These were
mostly backport of the Debian/Ubuntu packages in the Fenics repository. Very
few changes were necessary (3 or 4) to ensure all the code worked with
python2.4 (I am pleasently surprised). I have also used backported packages
of hashlib (from pyton2.5) numpy and matplotlib etc. Debian source packages
are available for all and will be happy to share them with anyone interested
if you let me know where and how to upload. Presently I install them from a
local repository on my laptop hard disk.

I have not yet familiarized myself with the usage of Fenics as I am
presently concerned with making sure everything is working correctly. Hence
I am looking for some sought of test suite. Is there any such thing ?

Playing around I find some things work and some don't. In particular running
the demo in the dolfin tutorial ( http://www.fenics.org/wiki/Tutorial )
produces the following error

Checking mesh ordering (finished).
Traceback (most recent call last):
  File "demo.py", line 5, in ?
    V = FunctionSpace(mesh, "CG", 1)
  File "/usr/lib/python2.4/site-packages/dolfin/functionspace.py", line 183,
in __init__
    FunctionSpaceBase.__init__(self, mesh, element)
  File "/usr/lib/python2.4/site-packages/dolfin/functionspace.py", line 45,
in __init__
    self.__ufc_element, self.__ufc_dofmap = jit(self._element)
  File "/usr/lib/python2.4/site-packages/dolfin/jit.py", line 43, in jit
    return jit_compile(form, options)
  File "/usr/lib/python2.4/site-packages/ffc/jit/jit.py", line 52, in jit
    return jit_element(object, options)
  File "/usr/lib/python2.4/site-packages/ffc/jit/jit.py", line 115, in
jit_element
    (compiled_form, module, form_data) = jit_form(form, options)
  File "/usr/lib/python2.4/site-packages/ffc/jit/jit.py", line 70, in
jit_form
    module = instant.import_module(jit_object,
cache_dir=options["cache_dir"])
  File "/usr/lib/python2.4/site-packages/instant/cache.py", line 140, in
import_module
    module, moduleids = check_memory_cache(moduleid)
  File "/usr/lib/python2.4/site-packages/instant/cache.py", line 75, in
check_memory_cache
    module = memory_cached_module(moduleid)
  File "/usr/lib/python2.4/site-packages/instant/cache.py", line 48, in
memory_cached_module
    module = _memory_cache.get(moduleid, None)
TypeError: __hash__() should return an int

The only changes made to the Instant package are the following (patch)

+++ instant-0.9.5/src/instant/cache.py
@@ -37,8 +37,8 @@
     except:
         instant_warning("In instant.import_module_directly: Failed to
import module '%s' from '%s'." % (modulename, path))
         module = None
-    finally:
         sys.path.pop(0)
+    sys.path.pop(0)
     return module

--- instant-0.9.5.orig/src/instant/build.py
+++ instant-0.9.5/src/instant/build.py
@@ -23,7 +23,7 @@
 def assert_is_str_list(x):
     instant_assert(isinstance(x, (list, tuple)),
         "In instant.build_module: Expecting sequence.")
-    instant_assert(all(isinstance(i, str) for i in x),
+    instant_assert(not False in (isinstance(i, str) for i in x),
         "In instant.build_module: Expecting sequence of strings.")

 def strip_strings(x):

However I am able to successfully run the examples on
http://www.fenics.org/wiki/Instant .

Versions of the fenics packages being used/built by me are as follows

dolfin (0.9.0)
ferari (0.0.2)
ffc (0.6.0)
fiat (0.3.4)
instant (0.9.5)
viper (0.4.2)
ufc (0.4.2)
numpy (1.1.1)
matplotlib (0.98)
hashlib (20081119 from http://code.krypto.org/python/hashlib)

I would be grateful for pointers and assistance you can give me in fixing
these problems.

Sincerely
B Thomas

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Sat, 7 Feb 2009 14:30:20 +0100

> +++ instant-0.9.5/src/instant/cache.py

Seems like this will pop twice if an exception occurs?
Move the last sys.path.pop(0) to the end of the try block
just before except:, but keep the one the end of the except block.
I don't think this is your problem though.

Martin

---

From: Balbir Thomas <[email-masked]>
Date: Sat, 7 Feb 2009 16:11:03 -0500

Hi,

Thanks for pointing that out. I have been digging further. Looks like there
are a lot more python2.5 statements. So I will probably give up on porting
to python 2.4. I tired that because lots of modules in etch are for
python2.4. Instead I guess I am planning to upgrade to lenny and work from
there. Hopefully lenny is round the corner as it seems.

regards
balbir thomas

---

From: Harish Narayanan <[email-masked]>
Date: Sat, 07 Feb 2009 22:17:12 +0100

Balbir Thomas wrote:

> Thanks for pointing that out. I have been digging further. Looks like
> there are a lot more python2.5 statements. So I will probably give up on
> porting to python 2.4. I tired that because lots of modules in etch are
> for python2.4. Instead I guess I am planning to upgrade to lenny and
> work from there. Hopefully lenny is round the corner as it seems.

And if you absolutely cannot wait for Lenny, Etch is one of the
supported platforms of Dorsal (http://www.fenics.org/wiki/Dorsal).

(Lenny testing is as well, but I can see you're trying to stick with
stable.)

Harish