Cython installation instructions

1,372 views
Skip to first unread message

Thomas Fiala

unread,
Dec 19, 2012, 12:26:56 PM12/19/12
to canter...@googlegroups.com
The Cython interface appears to be quite advanced. I do like to test it at some point, but so far I couldn't find any installation instructions. Is there anything special to keep in mind when installing the Cython interface? Can I install it by just telling SCons to use a Python3 interpreter? Which version of Python3 should I use?

Thanks a lot!

Thomas

Ray Speth

unread,
Dec 26, 2012, 7:18:08 PM12/26/12
to canter...@googlegroups.com
Thomas (and everyone),

I've added a section on the new Python module to the compilation guide. You can view it at http://cantera.github.com/dev-docs/sphinx/html/compiling.html#python-module.

One slightly tricky thing to keep in mind is that you need to use Python 2 with SCons no matter what, but you can compile the new Python module for use with either Python 2 or Python 3 (or both).

The documentation for the new module is available at http://cantera.github.com/dev-docs/sphinx/html/cython/index.html. I haven't updated many of the sample programs to show how to use the new interface, but you can probably get an idea from looking at the unit tests (in interfaces/cython/cantera/test) and examples for the 1D flame module (in interfaces/cython/cantera/examples/). I've tried to make the new interface more "Pythonic", e.g. by making use of properties and adhering to PEP8 style as much as possible.

I would appreciate any feedback on the new API (from all users), as this is the best opportunity to make such changes since the new module breaks backwards compatibility anyway.

Regards,
Ray

Thomas Fiala

unread,
Feb 6, 2013, 9:53:54 AM2/6/13
to canter...@googlegroups.com
Ray,

thanks a lot for your documentation. The source code of the Cython interface looks great, and I read some convenient features that were missing in the python interface.
However, I did not manage to install the Cython interface. I tried it both on my Mac (10.8.2, MacPorts Python 2.7, Cython 0.16, Sundials 2.4.0, Cantera r2105) and on SuSe Linux (11.2, Python 2.6.2, Cython 0.18, Sundials 2.4.0, Cantera r2105). Here is what I got:

MAC

cantera.conf
prefix = '/Applications/calc/cantera'
python_package = 'new'
f90_interface = 'n'
use_sundials = 'y'
sundials_include = '/usr/local/include'     # alternatively left blank
sundials_libdir = '/usr/local/lib'          # alternatively left blank
boost_inc_dir = '/opt/local/include/'
boost_lib_dir = '/opt/local/lib'

Using scons build, Cantera compiles successfully. There are some warnings like
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -pipe -O2 -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -I../../include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -I/opt/local/include/ -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c cantera/_cantera.cpp -o ../../build/temp-py2/cantera/_cantera.o
cantera/_cantera.cpp:3914:14: warning: explicitly assigning a variable of type 'PyObject *' (aka '_object *') to itself [-Wself-assign]
  __pyx_self = __pyx_self;
  ~~~~~~~~~~ ^ ~~~~~~~~~~

but in general it seems to work fine. However, I then get two errors:

1. When importing the Cython interface in Python (e.g. while running scons test), I get the error:
scriptRunner(["build/test/python/cython2.passed"], ["test/python/runCythonTests.py"])
PYTHONPATH /Users/tf/Documents/td/cantera/build/python2
Traceback (most recent call last):
  File "/Users/tf/Documents/td/cantera/test/python/runCythonTests.py", line 19, in <module>
    import cantera
  File "/Users/tf/Documents/td/cantera/build/python2/cantera/__init__.py", line 1, in <module>
    from ._cantera import *
ImportError: dlopen(/Users/tf/Documents/td/cantera/build/python2/cantera/_cantera.so, 2): Symbol not found: _dgbcon_
  Referenced from: /Users/tf/Documents/td/cantera/build/python2/cantera/_cantera.so
  Expected in: flat namespace
 in /Users/tf/Documents/td/cantera/build/python2/cantera/_cantera.so

This is apparently due to some linking error to the Sundials library. So far, I did not find a way to fix it.

2. When running (sudo) scons install, I get this error:
cd interfaces/cython && /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python setup2.py build --build-lib=../../build/python2 --build-temp=../../build/temp-py2 install --record ../../build/python2-installed-files.txt --prefix="/Applications/calc/cantera"
running build
running build_py
running build_ext
skipping 'cantera/_cantera.cpp' Cython extension (up-to-date)
running install
Checking .pth file support in /Applications/calc/cantera/lib/python2.7/site-packages/
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -E -c pass
TEST FAILED: /Applications/calc/cantera/lib/python2.7/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /Applications/calc/cantera/lib/python2.7/site-packages/

and your PYTHONPATH environment variable currently contains:

    ''

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  http://packages.python.org/distribute/easy_install.html#custom-installation-locations

Please make the appropriate changes for your system and try again.
scons: *** [interfaces/cython/dummy2] Error 1

However, the path /Applications/calc/cantera/lib/python2.7/site-packages/ actually is in my $PYTHONPATH. Besides, when I just run the command
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python setup2.py build --build-lib=../../build/python2 --build-temp=../../build/temp-py2 install --record ../../build/python2-installed-files.txt --prefix="/Applications/calc/cantera"
it executes without problems. So, I assume that running the command from within scons, the actual value of $PYTHONPATH is not passed correctly or somewhere overwritten.



Linux

cantera.conf
prefix = '$USER/bin/cantera/'
python_package = 'new'
python_array_home = '/usr/lib64/python2.6/site-packages/numpy/core/include'
matlab_toolbox = 'n'
f90_interface = 'n'
use_sundials = 'y'
sundials_include = '/nfs/opt/cantera/cantera201/include'
sundials_libdir = '/nfs/opt/cantera/cantera201/lib64'
build_thread_safe = False

Under Linux, I'm not able to compile Cantera with Cython enabled. I instead get the following error:

...
building 'cantera._cantera' extension
creating ../../build/temp-py2
creating ../../build/temp-py2/cantera
gcc -pthread -fno-strict-aliasing -DNDEBUG -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fwrapv -fPIC -I. -I../../include -I/usr/lib64/python2.6/site-packages/numpy/core/include -I/nfs/opt/cantera/cantera201/include -I/usr/include -I/usr/include/python2.6 -c cantera/_cantera.c -o ../../build/temp-py2/cantera/_cantera.o
gcc: cantera/_cantera.c: No such file or directory
gcc: no input files
error: command 'gcc' failed with exit status 1
scons: *** [build/python2/cantera/_cantera.so] Error 1
scons: building terminated because of errors.

I expect this has something to do with Cython.Distutils, but I have no experience and no clue how to deal with this.


BOTH

With the legacy Python interface, the installation still worked smooth.
Besides:
The (optional) dependency on 3to2 is not listed on the Cantera Compilation Guide.
Somewhere while installing Cantera, probably while running scons test, the file test_problems/cxx_ex/gri30.xml is created, which then appears as a change in the git repository.


I know this is quite a lot, but I hope you find this feedback useful. It would be great if you find some time to look at the problems and give me a hint on how to get it to run.
Thanks a lot!

Thomas

Ray Speth

unread,
Feb 6, 2013, 11:31:43 AM2/6/13
to canter...@googlegroups.com
Hi Thomas,

Thanks for the detailed feedback. Support for OS X is as usual a challenge since I don't currently have access to a Mac, so reporting these issues is especially useful.

First, I would ignore any warnings encountered while compiling the code generated by Cython. I think those are going to be minor issues that the Cython developers might want to address, but aren't reflective of problems with Cantera. It might be worth looking into running the compiler with a lower warning level on this code.

The 'missing symbol' is one that's part of LAPACK, which I think means that the Cython module isn't being linked against the Accelerate framework. Can you try adding the following to 'cython/SConscript', around line 90:

if 'LDFLAGS' not in localenv['ENV']:
    localenv['ENV']['LDFLAGS'] = ''
for framework in localenv['FRAMEWORKS']:
    localenv['ENV']['LDFLAGS'] += ' -f ' + framework

Let me know if this works for you, and I'll update the build script accordingly.

Regarding the 'PYTHONPATH' issue, is that directory also on root's PYTHONPATH? Do you get the same error if you install as a non-root user to a directory that's on the user's PYTHONPATH, but not the system one? What happens if you specify the scons option 'env_vars=PYTHONPATH' in either case?

The issue you're having with building on Linux is strange. The setup.py file clearly specifies "language='c++'" when creating the Extension object. Can you try adding the following:

    import Cython, setuptools
    print('language =', exts[0].language)
    print('setutools version =', setuptools.__version__)
    print('cython version = ', Cython.__version__)

after line 15 of interfaces/cython/setup.py.in and let me know what it prints? I'm not sure whether the problem here is in setuptools or in Cython.Distutils.

I will add the dependence on 3to2 to the compilation guide.

I think the issue with 'test_problems/cxx_ex/gri30.xml' is that it is part of the repository in the 2.0 maintenance branch, but was removed from trunk. I can't remove it from the maintenance branch because the tests there aren't correctly set up to look for the input files in the default data file directory. This issue should go away once version 2.1 is released and we any switching is between the 2.1 maintenance branch and trunk.

Regards,
Ray

Thomas Fiala

unread,
Feb 6, 2013, 1:14:27 PM2/6/13
to canter...@googlegroups.com
Ray,

Thanks a lot for your fast reply!

I tried adding your LDFLAGS part for building under OSX, and now get an error while compiling:
/usr/bin/clang++ -bundle -undefined dynamic_lookup -L/opt/local/lib -f Accelerate ../../build/temp-py2/cantera/_cantera.o -L../../build/lib -L/usr/local/lib -L/opt/local/lib -lcantera -lsundials_cvodes -lsundials_ida -lsundials_nvecserial -o ../../build/python2/cantera/_cantera.so
clang: error: no such file or directory: 'Accelerate'
error: command '/usr/bin/clang++' failed with exit status 1

(before, the command that seemed to work was: /usr/bin/clang++ -bundle -undefined dynamic_lookup -L/opt/local/lib ../../build/temp-py2/cantera/_cantera.o -L../../build/lib -L/usr/local/lib -L/opt/local/lib -lcantera -lsundials_cvodes -lsundials_ida -lsundials_nvecserial -o ../../build/python2/cantera/_cantera.so)

There appear to be a few people having problems with the Accelerate Framework under OSX, but I couldn't find an easy solution by googling.


Thank you for the hint to set env_vars='PYTHONPATH'! That actually did the trick (for Linux as well).


Never mind the described Linux problem - I guess this is a strange issue of the machine I tested it on. It had setutools version 0.6c9 and cython version 0.18, and probably some strange settings. I tried it on a different machine with setutools version 0.6 and cython version 0.17.2, and here it worked just fine.
All tests run smoothly, except test_heat_transfer_1 where there is a Relative error of 2.322792e-07 compared to rtol = 1.000000e-07 (but I guess this is still OK).
The only thing is that I actually also had to specify env_vars='PYTHONPATH' in order to install it in a custom directory.


I guess this leaves me to try the Cython interface under Linux. If you have an idea on how to fix the linking problem under OSX, please let me know! I'll be glad to test it.

Ray Speth

unread,
Feb 6, 2013, 1:38:27 PM2/6/13
to canter...@googlegroups.com
Thomas,

What if you try this in cython/SConscript instead:

if 'LDFLAGS' not in localenv['ENV']:
    localenv['ENV']['LDFLAGS'] = ''
for framework in localenv['FRAMEWORKS']:
    localenv['ENV']['LDFLAGS'] += ' -framework ' + framework

Regards,
Ray

Thomas Fiala

unread,
Feb 7, 2013, 5:03:17 AM2/7/13
to canter...@googlegroups.com
Hi Ray,

Thanks a lot, that did it! With this snippet and the trick for setting $PYTHONPATH, I get it to install smoothly.

When running scons test, I get a few failures, but I guess those are just minor problems:

test_reacting (cantera.test.test_reactor.TestFlowReactor) ...
[CVODES ERROR]  CVode
  At t = 0.938902 and h = 1.1561e-08, the error test failed repeatedly or with |h| = hmin.

ERROR
...
test_save_restore (cantera.test.test_onedim.TestFreeFlame) ... FAIL
...
======================================================================
ERROR: test_reacting (cantera.test.test_reactor.TestFlowReactor)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "/Users/tf/Documents/td/cantera/build/python2/cantera/test/test_reactor.py", line 483, in test_reacting
    t = net.step(1.0)
  File "reactor.pyx", line 706, in cantera._cantera.ReactorNet.step (cantera/_cantera.cpp:29635)
RuntimeError:
***********************************************************************
CanteraError thrown by CVodesIntegrator:
 CVodes error encountered. Error code: -3
Components with largest weighted error estimates:
42: -31.5441
41: 30.3979
6: 4.26566
18: 2.39849
3: -0.260386
1: 0.184341
14: 0.0545089
20: 0.00554757
4: 0.00385395
22: -0.000474196
***********************************************************************


======================================================================
FAIL: test_save_restore (cantera.test.test_onedim.TestFreeFlame)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "/Users/tf/Documents/td/cantera/build/python2/cantera/test/test_onedim.py", line 213, in test_save_restore
    self.assertArrayNear(Y1, Y3, 1e-3)
  File "/Users/tf/Documents/td/cantera/build/python2/cantera/test/utilities.py", line 22, in assertArrayNear
    self.assertNear(a,b, rtol, atol, msg)
  File "/Users/tf/Documents/td/cantera/build/python2/cantera/test/utilities.py", line 13, in assertNear
    self.fail(message)
AssertionError: AssertNear: 1.0236145580759e-09 - 1.020765594227e-09 = 2.8489638489543e-12
Relative error of 1.408851e-03 exceeds rtol = 1.000000e-03

----------------------------------------------------------------------

I guess I will have to get used to some different function names, but I'll work that out somehow. The test files, which I use for reference, are a bit hidden in the source code.
Apparently, Python's cool feature for setting mass fractions by a string like 'H2:2,O2:1' has gone, or am I missing something?
There is a small error in test_onedim.py, line 237, where you set initial_grid two times, but that's not such a problem.

Thanks a lot again for your help, and the cool interface in general!

Thomas

Thomas Fiala

unread,
Feb 7, 2013, 6:38:49 AM2/7/13
to canter...@googlegroups.com
OK, I found that gas.X = 'H2:2,O2:1' actually works nicely;)

Ray Speth

unread,
Feb 14, 2013, 11:06:48 AM2/14/13
to canter...@googlegroups.com
Hi Thomas,

I think I've got most of the issues you found fixed in trunk, which I think just leaves us with failing tests. For the failure in TestFlowReactor.testReacting, can you try adding:

        net.max_err_test_fails = 10

near line 476 of test_reactor.py to see if that fixes it?

For the other tests, I'd like to know how much you need to relax the tolerances to get the tests to pass. If you can check those and the resulting tolerances aren't unreasonably loose, I'll update them. It's always a little tricky guessing how much variation to expect on different systems.

Regards,
Ray

Thomas Fiala

unread,
Feb 15, 2013, 11:05:32 AM2/15/13
to canter...@googlegroups.com
Hi Ray,

After implementing your line, test_reacting runs without problems on my Mac.

For the other error, I varied rtol in  self.assertArrayNear(Y1, Y3, 1e-3) in line 213. The maximum error I got was 2.709473e-03. After setting rtol to 3e-3, I got no error anymore.

On my Linux machine, I actually violated rtol in test_heat_transfer1. I had to increase it to self.assertNear(self.r1.T, self.r2.T, 3e-7) in line 157 in test_reactor.py.
Also on my Linux machine, test_multicomponent takes a really long time. The total time of all Cython tests is 252.758s (On my Mac: 15.887s)

Back on my Mac, I actually now get a new error in test_empty:

======================================================================
ERROR: test_empty (cantera.test.test_kinetics.TestEmptyKinetics)

----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/tf/Documents/td/cantera/build/python2/cantera/test/test_kinetics.py", line 126, in test_empty
    gas = ct.Solution('air-no-reactions.xml')
  File "base.pyx", line 21, in cantera._cantera._SolutionBase.__cinit__ (cantera/_cantera.cpp:4884)
RuntimeError:
***********************************************************************
CanteraError thrown by findInputFile:

Input file air-no-reactions.xml not found in directories
'.',
'/Applications/Cantera/data',
'/Users/tf/Documents/td/cantera/build/data',
'/Applications/calc/cantera/share/cantera/data',
'/Users/tf/Documents/td/cantera/build/python2/cantera/data',
'/Users/tf/Documents/td/cantera/build/python2/cantera/test'

To fix this problem, either:
    a) move the missing files into the local directory;
    b) define environment variable CANTERA_DATA to
         point to the directory containing the file.
***********************************************************************

To me it appears that the mechanism air-no-reactions.xml does not installed in the right directory.

Thanks a lot for dealing with all those problems!

Thomas

Ray Speth

unread,
Feb 15, 2013, 2:05:59 PM2/15/13
to canter...@googlegroups.com
Thomas,

I believe all of the issues you've encountered should be fixed in trunk as of revision 2164. Please let me know if you find any additional problems.

Regards,
Ray

Thomas Fiala

unread,
Feb 18, 2013, 9:16:33 AM2/18/13
to canter...@googlegroups.com
Ray,

Thanks a lot! The tests run without errors (and fast) both on my Mac and on OpenSuSe Linux.

Thomas

Lee

unread,
Feb 18, 2013, 8:05:44 PM2/18/13
to canter...@googlegroups.com
Hi, Ray.
I tried to build the new python interface on OSX using revision 2168, but got the error below. It looks like the Cython module compiled for python3, but failed for python2. For some reason it is trying to compile "cantera/_cantera.c" instead of "cantera/_cantera.cpp". Any suggestions?

Thanks for all the support you provide.
-Lee

cantera.conf:
prefix = '/usr/local/cantera'
python_package = 'new'
matlab_path = '/Applications/MATLAB_R2011a.app'
use_sundials = 'y'

Output from $ scons build
...
copying cantera/test/data/units-custom.inp -> ../../build/python3/cantera/test/data
copying cantera/test/data/units-default.inp -> ../../build/python3/cantera/test/data
copying cantera/test/data/WallTest-integrateWithAdvance.csv -> ../../build/python3/cantera/test/data
running build_ext
skipping 'cantera/_cantera.cpp' Cython extension (up-to-date)
Substituting vars from interfaces/cython/setup.py.in to interfaces/cython/setup2.py
Delete("interfaces/cython/cantera/_cantera.cpp")
cd interfaces/cython && /usr/bin/python setup2.py build_ext --build-lib=../../build/python2 --build-temp=../../build/temp-py2
running build_ext
building 'cantera._cantera' extension
creating ../../build/temp-py2
creating ../../build/temp-py2/cantera
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I. -I../../include -I/Library/Python/2.7/site-packages/numpy-1.6.2-py2.7-macosx-10.7-intel.egg/numpy/core/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c cantera/_cantera.c -o ../../build/temp-py2/cantera/_cantera.o
i686-apple-darwin11-llvm-gcc-4.2: cantera/_cantera.c: No such file or directory
i686-apple-darwin11-llvm-gcc-4.2: no input files
i686-apple-darwin11-llvm-gcc-4.2: cantera/_cantera.c: No such file or directory
i686-apple-darwin11-llvm-gcc-4.2: no input files
lipo: can't figure out the architecture type of: /var/tmp//ccm5pJKW.out
error: command 'llvm-gcc-4.2' failed with exit status 1
scons: *** [build/python2/cantera/_cantera.so] Error 1
scons: building terminated because of errors.


Thomas Fiala

unread,
Feb 19, 2013, 2:22:39 AM2/19/13
to canter...@googlegroups.com
Lee,

The new Cython interface installed fine on my Mac, but I used Python 2.7 only. However, I once got a similar error to the one you reported while installing Cantera under Linux. That was due to some dependencies that were not up to date. If you use MacPorts, I'd recommend to run a sudo port update outdated. Hope this helps!

Thomas

Lee <lee....@gmail.com> wrote:
Hi, Ray.
I tried to build the new python interface on OSX using revision 2168, but got the error below. It looks like the Cython module compiled for python3, but failed for python2. For some reason it is trying to compile "cantera/_cantera.c" instead of "cantera/_cantera.cpp". Any suggestions?

Thanks for all the support you provide.
-Lee

cantera.conf:
prefix = '/usr/local/cantera'
python_package = 'new'
matlab_path = '/Applications/MATLAB_R2011a.app'
use_sundials = 'y'

Output from $ scons build
...
copying cantera/test/data/units-custom.inp -> ../../build/python3/cantera/test/data
copying cantera/test/data/units-default.inp -> ../../build/python3/cantera/test/data
copying cantera/test/data/WallTest-integrateWithAdvance.csv -> ./../build/python3/cantera/test/data

Ray Speth

unread,
Feb 21, 2013, 10:55:16 PM2/21/13
to canter...@googlegroups.com
Hi Lee,

I'm not sure what causes the problem compiling the Cython extension, as it is clearly ignoring the "language='c++' argument in the setup2.py file. I wonder if this is a problem with the version of the setuptools package you have installed. Can you try installing the newer replacement for this package, called distribute (https://pypi.python.org/pypi/distribute) and let me know if it works?

Regards,
Ray

Lee Shunn

unread,
Feb 22, 2013, 5:49:58 PM2/22/13
to canter...@googlegroups.com
Ray,
Thanks for the tip. I updated from distribute-0.6.34 to distribute-0.6.35 and was able to compile without errors. "scons test" passed all tests, but I got the following error during installation:

........................................................................
running install
Checking .pth file support in /usr/local/cantera/lib/python2.7/site-packages/
/Users/shunn/.virtualenvs/cantera/bin/python -E -c pass
TEST FAILED: /usr/local/cantera/lib/python2.7/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/local/cantera/lib/python2.7/site-packages/

and your PYTHONPATH environment variable currently contains:

    ''

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:


Please make the appropriate changes for your system and try again.
scons: *** [interfaces/cython/dummy2] Error 1
scons: building terminated because of errors.

........................................................................

I tried adding /usr/local/cantera/lib/python2.7/site-packages/ to my PYTHONPATH and recompiling from the beginning, but it still says that PYTHONPATH is empty. This seems to be specific to the new python package because I reverted to "python_package = 'full'" in cantera.conf and was able to install without any errors. I am running python in virtualenv, but I don't think that it's an issue.

-Lee



--
You received this message because you are subscribed to the Google Groups "Cantera User's Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To post to this group, send email to canter...@googlegroups.com.
Visit this group at http://groups.google.com/group/cantera-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Thomas Fiala

unread,
Feb 25, 2013, 4:31:02 AM2/25/13
to canter...@googlegroups.com
Lee,

If you use the option python_package = 'full', then you're compiling the old (legacy) interface.

In order to install the cython interface in a custom location, you have to do this:

1. Run scons install and note the directory which scons/easy_install is complaining about.
2. If that directory doesn't exist, create it.
3. Do an echo $PYTHONPATH to see if the directory already is on your $PYTHONPATH. If not, add the requested path to it by running
export PYTHONPATH=/path/to/the/requested/directory:$PYTHONPATH
(assuming that you youse bash as your shell)
4. Add the following line to your cantera.conf:
env_vars = 'PYTHONPATH'
5. Run scons install again. It should work now.

Regards,

Thomas

Lee Shunn

unread,
Feb 25, 2013, 5:19:52 PM2/25/13
to canter...@googlegroups.com
Thanks for your help, Thomas. It worked!!

Ray Speth

unread,
Mar 4, 2013, 12:43:00 PM3/4/13
to canter...@googlegroups.com
Hi,

I made some modifications to how the Cython module is installed (r2173) so that it no longer relies on setuptools / distribute. I think it should install cleanly now without needing to set $PYTHONPATH or requiring the env_vars='PYTHONPATH' option to SCons.

Regards,
Ray

Lee Shunn

unread,
Mar 4, 2013, 7:14:51 PM3/4/13
to canter...@googlegroups.com
Thanks, Ray. I updated to r2184 and was able to install on OSX without problems.


Thomas Fiala

unread,
Mar 5, 2013, 9:46:59 AM3/5/13
to canter...@googlegroups.com
Works well for me as well (both on OS X and OpenSuSe). Thanks a lot!
Reply all
Reply to author
Forward
0 new messages