Installing

355 views
Skip to first unread message

Thomas Hocker

unread,
Dec 18, 2021, 11:51:07 AM12/18/21
to Cantera Users' Group
Hi all,

I'm  a  complete newbie to cantera and python, so forgive my ignorance. 

I'd like to access cantera from within jupyter python under macos 12.0.1 and followed the instructions given under  https://cantera.org/install/conda-install.html:

- installation of Anaconda
- conda create --name ct-env --channel cantera cantera ipython matplotlib jupyter
- conda activate ct-env

These steps worked fine, but  import cantera as ct generates the error No module named ‚cantera'

It turns out that I run python 3.9.7, but cantera seems to be associated with python 3.8:

/opt/anaconda3//envs/ct-env/lib/python3.8/site-packages/cantera

Any help to fix this is very much appreciated.
Thanks, Thomas


Shah Saud Alam

unread,
Dec 18, 2021, 12:28:47 PM12/18/21
to Cantera Users' Group
Hello Thomas,

I am a long time Cantera user (PC version) and recently installed it on a Mac for the first time. On my Mac, I followed the same steps that you've mentioned except installing cantera in a ct-env environment. Instead, I installed cantera in the "base" environment to avoid activating it every now and then. Of note, I am not a Python heavy user (e.g., data analysis, machine learning, etc. user); therefore, I am not worried about installing cantera in the base environment.

To troubleshoot the issue you're having, you could try this:

- conda --channel cantera cantera ipython matplotlib jupyter

Or, better still would be to launch Anaconda GUI --> on the Home tab, click on CHANNELS (right next to the base (root) environment dropdown) --> add "cantera" as a new channel (must be in lowercase) --> click Update --> go to Environments (from the left panel) --> select "All" from the dropdown above package listings --> search and install "Cantera."

This worked for me, and I am hoping it will work for you too.

Good luck!

Thomas Hocker

unread,
Dec 19, 2021, 8:34:57 AM12/19/21
to Cantera Users' Group
Hi Saud,

thank you very much for your reply! Because of your suggestion I realized that the Anaconda GUI allows one to chose different environments, see the attached screenshot. Before I had only tried the base environment which obviously does not contain cantera. Therefore, I tried the following options which however all produced some sort of error:

a) switching to the environment cantera25 in the Anaconda GUI > I get an error message "Multiple Errors Encountered." when trying to install jupyter

b) switching to the environment ct-env in the Anaconda GUI > I get an error message "500 : Internal Server Error" after launching jupyter

c) adding cantera to the base environment also didn't work. The command you suggested 

conda --channel cantera cantera ipython matplotlib jupyter

requires additional arguments such as shown under https://cantera.org/install/conda-install.html

conda create --name ct-env --channel cantera cantera ipython matplotlib jupyter

conda create --name base --channel cantera cantera ipython matplotlib jupyter might work, but I hesitate to try it since I don't want to mess up the base environment ;-)

In case you have any other ideas, please let me know.
Greetings, Thomas
Bildschirmfoto 2021-12-18 um 18.56.10.png

Thomas Hocker

unread,
Dec 19, 2021, 8:34:57 AM12/19/21
to Cantera Users' Group
... another update: I rebooted my computer and gave the ct-env environment in the Anaconda GUI another try. Now it works, see the attached screenshots!
Thanks again and greetings,
Thomas

On Saturday, December 18, 2021 at 6:28:47 PM UTC+1 saud...@gmail.com wrote:
Bildschirmfoto 2021-12-18 um 19.33.51.png
Bildschirmfoto 2021-12-18 um 19.33.01.png

Thomas Hocker

unread,
Dec 19, 2021, 8:34:57 AM12/19/21
to Cantera Users' Group
Just a quick update: after installing miniconda3 and running miniconda3/bin/conda create -n cantera25 -c cantera cantera I managed to call cantera within a python script using 

#!/Users/hoto/miniconda3/envs/cantera25/bin/python
import cantera as ct

So now I need to figure out how to link jupyter to the python version above.

Reply all
Reply to author
Forward
0 new messages