[MMTK] Error compiling Pyrex modules in ForceField folder

khinsen at cea.fr khinsen at cea.fr
Fri Nov 25 11:59:42 CET 2005

On 23.11.2005, at 20:05, vanitha at cs.wisc.edu wrote:

> I have installed Pyrex and I'm trying to compile the .pyx file in the
> Examples/ForceField/ElectricField/Pyrex but I run into the following
> error:
> python2.4 $HOME/bin/pyrexc MMTK_electric_field.pyx
> /afs/cs.wisc.edu/u/v/a/vanitha/private/MMTK-2.5.11/Examples/ 
> Forcefield/ElectricField/Pyrex/MMTK_electric_field.pyx:8:0:
> ield/Pyrex/MMTK_electric_field.pyx:8:0: 'MMTK/forcefield.pxi' not  
> found

You need to specify the include path for MMTK:

pyrexc -I ../../../Include MMTK_electric_field.pyx

> I'm not sure what the problem is. Also, I'm not sure how to go about
> compiling a Pyrex file and invoke it from within Python. These are the

All it takes is

	python setup.py build_ext --inplace

to run all the steps.

> I've never used a .so file before. What do I do with this? If I  
> need to
> import the functions (compiled using Pyrex) within Python, what  
> extension
> would it look for?

The .so file is the compiled Python module, and its name is the  
module name. You can put it anywhere on $PYTHONPATH, just like a  
Python module, and import it.

Konrad Hinsen
Laboratoire Leon Brillouin (CEA-CNRS), CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: khinsen at cea.fr

More information about the mmtk mailing list