AttributeError: 'module' object has no attribute 'CounterflowDiffusionFlame'

897 views
Skip to first unread message

tamer şener

unread,
Apr 29, 2015, 4:50:32 AM4/29/15
to canter...@googlegroups.com
Hi everyone;

I want to simulate non-premixed counterflow flame of CH4 and air, and I was examining the code on the link http://cantera.github.io/docs/sphinx/html/cython/examples/onedim_diffusion_flame.html

I have several problems with the code above, first  
 
p = ct.one_atm  # pressure
AttributeError: 'module' object has no attribute 'one_atm' it says for the pressure.
 
I can solve it by having the real value of 1 atm as pascals. 

second     

gas.TP = gas.T, p
AttributeError: Solution instance has no attribute 'T'. 

Third
  f = ct.CounterflowDiffusionFlame(gas, initial_grid=none)
AttributeError: 'module' object has no attribute 'CounterflowDiffusionFlame'

I do not know how to solve those. It is the code provided as tutorial.
I have ubuntu 12.04 and cantera-2.1.2. 

Appreciate your help,

Tamer Şener


Thomas Fiala

unread,
Apr 29, 2015, 12:23:04 PM4/29/15
to canter...@googlegroups.com
Hi Tamer,

It looks as if you don't have Cantera installed correctly. What is the output when you run
import cantera as ct
print(ct.__version__)
print(ct.__file__)
in a python interpreter?

Thomas

tamer şener

unread,
Apr 29, 2015, 4:37:20 PM4/29/15
to canter...@googlegroups.com
Hi Thomas;

Thanks for the quick reply.

I run the code that you suggest I got these as result.

test.py:1: UserWarning: 
This version of the Cantera Python module is deprecated and will not be
available in Cantera 2.2 or later. For details on the new module, see

  import Cantera as ct
2.1.2
/usr/local/lib/python2.7/dist-packages/Cantera/__init__.pyc

I am really new using ubuntu and python, could you please tell me the steps to solve the problem with detail.

Aprreciate your help,
Tamer 

Ray Speth

unread,
Apr 29, 2015, 4:51:57 PM4/29/15
to canter...@googlegroups.com
Tamer,

How did you install Cantera? It appears that you have the "legacy" Python module installed (Cantera with a capital C), but you're working with an example that's written for the "new" Python module (cantera with a lowercase c). I would recommend removing this copy of the Cantera Python module and installing the new one using the pre-compiled Ubuntu packages, as described in the installation instructions.

Regards,
Ray

tamer şener

unread,
Apr 30, 2015, 6:06:15 AM4/30/15
to canter...@googlegroups.com
Ray,

Thanks for your interest. I followed your advice and deleted all the cantera related items on my computer (I am not sure if it helps or not for removing). I downloaded cantera - 2.1.2-1+precise3 from the link you provided (also I am not sure this is the one you recommended.)

But here is the case; when I try to run the code from the link you provided sudo aptitude install python-software-properties I got an error message saying 0 upgrade found 0 installed 93 not upgrated. 0 folder will be taken form archieves etc etc.

 So  I did not continue and shearch what to do and run this code  g++ python scons libboost-all-dev libsundials-serial-dev subversion It says "there is no such folder" for every code.

I do not know what to do, and I am new in ubuntu. If you help me with details I appreciate you.

I am using Ubuntu 12.04.

Regards
tamer


Ray Speth

unread,
Apr 30, 2015, 9:33:51 AM4/30/15
to canter...@googlegroups.com
Tamer,

The idea isn't to download the package from the Launchpad website using your browser, but instead to use the Ubuntu package manager (aptitude) to download and install the package which is what the final "sudo aptitude install cantera-python ..." command does.

The message from the "aptitude install python-software-properties" command isn't an error. It just indicates that you already have that package installed, in which case you can just proceed to the next step.

The other command you ran isn't supposed to be a command, but a list of packages needed to compile Cantera from source. These would be passed as additional arguments to "aptitude install". However, you don't need to install these packages in order to install the pre-compiled Cantera packages from the Launchpad PPA.

Regards,
Ray

tamer şener

unread,
Apr 30, 2015, 4:47:36 PM4/30/15
to canter...@googlegroups.com
Ray,

Thank you for your information about Ubuntu. I understand now how it basicly works.

But, here is the thing, according to your information about the 0 upgrade found 0 installed folder etc etc, I already have the cantera, because when I try to run the last code sudo aptitude install cantera-python cantera-python3 cantera-dev I got the same message saying 0 upgrate found 0 install found etc etc.

When I examine the info above saying 
  • cantera-python - The Cantera Python module for Python 2. For Ubuntu 12.04, this is the “legacy” Python module. For Ubuntu 14.04 and newer, this is the “new” Python module.
I can only think about all the trouble is a reason of that I am using ubuntu 12.04 or I cannot remove the cantera properly.

Should I update my 12.04 ubuntu to 14, or is there any solution for me?

Thanks for your interest,
regars
Tamer
 

Ray Speth

unread,
Apr 30, 2015, 6:31:01 PM4/30/15
to canter...@googlegroups.com
Tamer,

My apologies, I had forgotten that the packaged version of Cantera for Ubuntu 12.04 includes only the legacy Python module. This is because one of the additional dependencies (Cython) does not have a new enough version in Ubuntu 12.04. To install the new Python package on Ubuntu 12.04, you would need to install a newer version of Cython from a different source (i.e. not using the Ubuntu package manager) and then compile Cantera from source, which is possibly more involved than you want. Upgrading to Ubuntu 14.04 would let you install the new version of Cantera, but I can't say what other pitfalls might be involved in doing that on your computer.

Regards,
Ray

tamer şener

unread,
May 2, 2015, 3:33:46 PM5/2/15
to canter...@googlegroups.com
Ray;

Thanks a lot for your detailed explanation, but I think that I am not able to solve it. I am going to get some help about it by using your answers.

Regards,
Tamer
Reply all
Reply to author
Forward
0 new messages