import error via python

1,088 views
Skip to first unread message

büşra zaza

unread,
May 12, 2018, 9:24:10 AM5/12/18
to Cantera Users' Group
Hi,

Before this message, I've red other shares several times about it, but couldn't solve.

I have a OS X Yosemite 10.10.5. According to 'Option 3: Install the development version of Cantera' in the installation guide,
I downloaded and installed Anaconda, then run the command given below;
conda install -c cantera/label/dev cantera

 But when i try any example in Python's IDLE or ipython, it gives error;
 Traceback (most recent call last):
  File "/Users/busracetin/anaconda3/pkgs/cantera-2.4.0b1-np114py36_0/lib/python3.6/site-packages/cantera/examples/onedim/premixed_counterflow_flame.py", line 8, in <module>
    import cantera as ct
ModuleNotFoundError: No module named 'cantera'
 Also I can see, a Cantera folder exists in Anaconda packages folder and python is in Cantera's lib folder.

I can't understand this error is about installation or compiling.

Waiting your feedbacks

Büşra Çetin

Nick Curtis

unread,
May 12, 2018, 10:56:22 AM5/12/18
to Cantera Users' Group
Hi Busra,

Can you show us the output of:

python -c "import sys; print(sys.executable); print(sys.path)"

when you run it on the command line? I think it's likely you're either not using anaconda python (i.e., you must run source activate your_conda_env_name) or your IPython / Idle were installed through another python install?

Best,

Nick

büşra zaza

unread,
May 12, 2018, 11:10:44 AM5/12/18
to Cantera Users' Group
Nick,

Thanks for your answer.

This is the output of the command;

/Users/busracetin/anaconda3/bin/python

['', '/Users/busracetin/anaconda3/lib/python36.zip', '/Users/busracetin/anaconda3/lib/python3.6', '/Users/busracetin/anaconda3/lib/python3.6/lib-dynload', '/Users/busracetin/anaconda3/lib/python3.6/site-packages', '/Users/busracetin/anaconda3/lib/python3.6/site-packages/aeosa']


Python has already existed before cantera installation.



12 Mayıs 2018 Cumartesi 17:56:22 UTC+3 tarihinde Nick Curtis yazdı:

Nick Curtis

unread,
May 12, 2018, 12:07:28 PM5/12/18
to Cantera Users' Group
Hi Busra,

It looks like you are indeed using anaconda python,
Some more things to check:

conda list
will give you a list of packages in your current conda environment, make sure you see Cantera & IPython in that list

conda env list
Will show you the list of conda environments you currently have installed.  If conda list doesn't show you cantera, check in other environments you have installed, e.g. via:

source activate my_other_conda_env
# show list of packages in the new env
conda list

Best,
Nick

büşra zaza

unread,
May 12, 2018, 12:48:57 PM5/12/18
to Cantera Users' Group
Hi Nick,

conda list

Cantera & IPython exist in this list.


conda env list

Cantera does not include in list of environments. When I activate the environment which I have installed and again run the command;


conda list
it shows that cantera exists in the list.



12 Mayıs 2018 Cumartesi 19:07:28 UTC+3 tarihinde Nick Curtis yazdı:

Nick Curtis

unread,
May 12, 2018, 12:56:51 PM5/12/18
to Cantera Users' Group
Busra,

Does the command:

python -c "import cantera as ct; print(ct.__version__)"

work? Or do you get the same error as before?

Nick

büşra zaza

unread,
May 12, 2018, 1:00:16 PM5/12/18
to Cantera Users' Group
Nick,

Same error occurs.  :/

I don't want to set up Ubuntu etc., please help me.

12 Mayıs 2018 Cumartesi 19:56:51 UTC+3 tarihinde Nick Curtis yazdı:

Bryan W. Weber

unread,
May 13, 2018, 12:25:03 AM5/13/18
to Cantera Users' Group
Hi,

Please provide the exact output of the conda commands that Nick suggested (conda list, conda env list, and conda list for some particular environment) by copy-pasting into the post. Can you also please clarify how you are trying to run the example?

Thanks!
Bryan
Message has been deleted

büşra zaza

unread,
May 13, 2018, 3:47:21 PM5/13/18
to Cantera Users' Group
Hİ,
Outputs are for
conda list

# packages in environment at /Users/busracetin/anaconda3:

#

# Name                    Version                   Build  Channel

_ipyw_jlab_nb_ext_conf    0.1.0            py36h2fc01ae_0  

alabaster                 0.7.10           py36h174008c_0  

anaconda                  5.1.0                    py36_2  

anaconda-client           1.6.9                    py36_0  

anaconda-navigator        1.7.0                    py36_0  

anaconda-project          0.8.2            py36h9ee5d53_0  

appnope                   0.1.0            py36hf537a9a_0  

appscript                 1.0.1            py36h9e71e49_1  

asn1crypto                0.24.0                   py36_0  

astroid                   1.6.1                    py36_0  

astropy                   2.0.3            py36h1de35cc_0  

attrs                     17.4.0                   py36_0  

babel                     2.5.3                    py36_0  

backports                 1.0              py36ha3c1827_1  

backports.shutil_get_terminal_size 1.0.0            py36hd7a2ee4_2  

beautifulsoup4            4.6.0            py36h72d3c9f_1  

bitarray                  0.8.1            py36h1de35cc_1  

bkcharts                  0.2              py36h073222e_0  

blaze                     0.11.3           py36h02e7a37_0  

bleach                    2.1.2                    py36_0  

bokeh                     0.12.13          py36h2f9c1c0_0  

boto                      2.48.0           py36hdbc59ac_1  

bottleneck                1.2.1            py36hbd380ad_0  

bzip2                     1.0.6                hd86a083_4  

ca-certificates           2017.08.26           ha1e5d58_0  

cantera                   2.4.0b1             np114py36_0    cantera/label/dev

certifi                   2018.1.18                py36_0  

cffi                      1.11.4           py36h342bebf_0  

chardet                   3.0.4            py36h96c241c_1  

click                     6.7              py36hec950be_0  

cloudpickle               0.5.2                    py36_1  

clyent                    1.2.2            py36hae3ad88_0  

colorama                  0.3.9            py36hd29a30c_0  

conda                     4.4.10                   py36_0  

conda-build               3.4.1                    py36_0  

conda-env                 2.6.0                h36134e3_0  

conda-verify              2.0.0            py36he837df3_0  

contextlib2               0.5.5            py36hd66e5e7_0  

cryptography              2.1.4            py36h842514c_0  

curl                      7.58.0               ha441bb4_0  

cycler                    0.10.0           py36hfc81398_0  

cython                    0.27.3           py36h6ecb376_0  

cytoolz                   0.9.0            py36h1de35cc_0  

dask                      0.16.1                   py36_0  

dask-core                 0.16.1                   py36_0  

datashape                 0.5.4            py36hfb22df8_0  

dbus                      1.12.2               h5243cc1_1  

decorator                 4.2.1                    py36_0  

distributed               1.20.2                   py36_0  

docutils                  0.14             py36hbfde631_0  

entrypoints               0.2.3            py36hd81d71f_2  

et_xmlfile                1.0.1            py36h1315bdc_0  

expat                     2.2.5                hb8e80ba_0  

fastcache                 1.0.2            py36h1de35cc_2  

filelock                  2.0.13           py36hf9de95b_0  

flask                     0.12.2           py36h5658096_0  

flask-cors                3.0.3            py36h7387b97_0  

freetype                  2.8                  h12048fb_1  

get_terminal_size         1.0.0                h7520d66_0  

gettext                   0.19.8.1             h15daf44_3  

gevent                    1.2.2            py36ha70b9d6_0  

glib                      2.53.6               h33f6a65_2  

glob2                     0.6              py36h94c9186_0  

gmp                       6.1.2                hb37e062_1  

gmpy2                     2.0.8            py36hf9c35bd_2  

greenlet                  0.4.12           py36hf09ba7b_0  

h5py                      2.7.1            py36h39cdac5_0  

hdf5                      1.10.1               ha036c08_1  

heapdict                  1.0.0                    py36_2  

html5lib                  1.0.1            py36h2f9c1c0_0  

icu                       58.2                 h4b95b61_1  

idna                      2.6              py36h8628d0a_1  

imageio                   2.2.0            py36h5e01289_0  

imagesize                 0.7.1            py36h3495948_0  

intel-openmp              2018.0.0             h8158457_8  

ipykernel                 4.8.0                    py36_0  

ipython                   6.2.1            py36h3dda519_1  

ipython_genutils          0.2.0            py36h241746c_0  

ipywidgets                7.1.1                    py36_0  

isort                     4.2.15           py36hceb2a01_0  

itsdangerous              0.24             py36h49fbb8d_1  

jbig                      2.1                  h4d881f8_0  

jdcal                     1.3              py36h1986823_0  

jedi                      0.11.1                   py36_0  

jinja2                    2.10             py36hd36f9c5_0  

jpeg                      9b                   he5867d9_2  

jsonschema                2.6.0            py36hb385e00_0  

jupyter                   1.0.0                    py36_4  

jupyter_client            5.2.2                    py36_0  

jupyter_console           5.2.0            py36hccf5b1c_1  

jupyter_core              4.4.0            py36h79cf704_0  

jupyterlab                0.31.5                   py36_0  

jupyterlab_launcher       0.10.2                   py36_0  

lazy-object-proxy         1.3.1            py36h2fbbe47_0  

libcurl                   7.58.0               hf30b1f0_0  

libcxx                    4.0.1                h579ed51_0  

libcxxabi                 4.0.1                hebd6815_0  

libedit                   3.1                  hb4e282d_0  

libffi                    3.2.1                h475c297_4  

libgfortran               3.0.1                h93005f0_2  

libiconv                  1.15                 hdd342a3_7  

libpng                    1.6.34               he12f830_0  

libsodium                 1.0.15               hd9e47c5_0  

libssh2                   1.8.0                h322a93b_4  

libtiff                   4.0.9                h0dac147_0  

libxml2                   2.9.7                hab757c2_0  

libxslt                   1.1.32               hb819dd2_0  

llvmlite                  0.21.0           py36hff739e7_0  

locket                    0.2.0            py36hca03003_1  

lxml                      4.1.1            py36hef8c89e_1  

lzo                       2.10                 h362108e_2  

markupsafe                1.0              py36h3a1e703_1  

matplotlib                2.1.2            py36h6d6146d_0  

mccabe                    0.6.1            py36hdaeb55d_0  

mistune                   0.8.3                    py36_0  

mkl                       2018.0.1             hfbd8650_4  

mkl-service               1.1.2            py36h7ea6df4_4  

mpc                       1.0.3                h7a72875_5  

mpfr                      3.1.5                h711e7fd_2  

mpmath                    1.0.0            py36hf1b8295_2  

msgpack-python            0.5.1            py36h04f5b5a_0  

multipledispatch          0.4.9            py36hc5f92b5_0  

navigator-updater         0.1.0            py36h7aee5fb_0  

nbconvert                 5.3.1            py36h810822e_0  

nbformat                  4.4.0            py36h827af21_0  

ncurses                   6.0                  hd04f020_2  

networkx                  2.1                      py36_0  

nltk                      3.2.5            py36h1190bce_0  

nose                      1.3.7            py36h73fae2b_2  

notebook                  5.4.0                    py36_0  

numba                     0.36.2          np114py36hc2f221f_0  

numexpr                   2.6.4            py36habcfcfe_0  

numpy                     1.14.0           py36h8a80b8c_1  

numpydoc                  0.7.0            py36he54d08e_0  

odo                       0.5.1            py36hc1af34a_0  

olefile                   0.45.1                   py36_0  

openpyxl                  2.4.10                   py36_0  

openssl                   1.0.2n               hdbc3d79_0  

packaging                 16.8             py36he5e8135_0  

pandas                    0.22.0           py36h0a44026_0  

pandoc                    1.19.2.1             ha5e8f32_1  

pandocfilters             1.4.2            py36h3b0b094_1  

parso                     0.1.1            py36hc90e01c_0  

partd                     0.3.8            py36hf5c4cb8_0  

path.py                   10.5             py36h7bcb313_0  

pathlib2                  2.3.0            py36h877a6d8_0  

patsy                     0.5.0                    py36_0  

pcre                      8.41                 hfb6ab37_1  

pep8                      1.7.1                    py36_0  

pexpect                   4.3.1                    py36_0  

pickleshare               0.7.4            py36hf512f8e_0  

pillow                    5.0.0            py36hfcce615_0  

pip                       9.0.1            py36h1555ced_4  

pkginfo                   1.4.1            py36h25bf955_0  

pluggy                    0.6.0            py36hb1d0581_0  

ply                       3.10             py36h10e714e_0  

prompt_toolkit            1.0.15           py36haeda067_0  

psutil                    5.4.3            py36h1de35cc_0  

ptyprocess                0.5.2            py36he6521c3_0  

py                        1.5.2            py36ha69170d_0  

pycodestyle               2.3.1            py36h83e8646_0  

pycosat                   0.6.3            py36hee92d8f_0  

pycparser                 2.18             py36h724b2fc_1  

pycrypto                  2.6.1            py36h1de35cc_7  

pycurl                    7.43.0.1         py36hdbc3d79_0  

pyflakes                  1.6.0            py36hea45e83_0  

pygments                  2.2.0            py36h240cd3f_0  

pylint                    1.8.2                    py36_0  

pyodbc                    4.0.22           py36h0a44026_0  

pyopenssl                 17.5.0           py36h51e4350_0  

pyparsing                 2.2.0            py36hb281f35_0  

pyqt                      5.6.0            py36he5c6137_6  

pysocks                   1.6.7            py36hfa33cec_1  

pytables                  3.4.2            py36hfbd7ab0_2  

pytest                    3.3.2                    py36_0  

python                    3.6.4                hc167b69_1  

python-dateutil           2.6.1            py36h86d2abb_1  

python.app                2                py36h54569d5_7  

pytz                      2017.3           py36hf0bf824_0  

pywavelets                0.5.2            py36h2710a04_0  

pyyaml                    3.12             py36h2ba1e63_1  

pyzmq                     16.0.3           py36he48b5ad_0  

qt                        5.6.2               h9975529_14  

qtawesome                 0.4.4            py36h468c6fb_0  

qtconsole                 4.3.1            py36hd96c0ff_0  

qtpy                      1.3.1            py36h16bb863_0  

readline                  7.0                  hc1231fa_4  

requests                  2.18.4           py36h4516966_1  

rope                      0.10.7           py36h68959ac_0  

ruamel_yaml               0.15.35          py36h1de35cc_1  

scikit-image              0.13.1           py36h1de35cc_1  

scikit-learn              0.19.1           py36hffbff8c_0  

scipy                     1.0.0            py36h1de22e9_0  

seaborn                   0.8.1            py36h595ecd9_0  

send2trash                1.4.2                    py36_0  

setuptools                38.4.0                   py36_0  

simplegeneric             0.8.1                    py36_2  

singledispatch            3.4.0.3          py36hf20db9d_0  

sip                       4.18.1           py36h2824476_2  

six                       1.11.0           py36h0e22d5e_1  

snowballstemmer           1.2.1            py36h6c7b616_0  

sortedcollections         0.5.3            py36he9c3ed6_0  

sortedcontainers          1.5.9                    py36_0  

sphinx                    1.6.6                    py36_0  

sphinxcontrib             1.0              py36h9364dc8_1  

sphinxcontrib-websupport  1.0.1            py36h92f4a7a_1  

spyder                    3.2.6                    py36_0  

sqlalchemy                1.2.1            py36h1de35cc_0  

sqlite                    3.22.0               h3efe00b_0  

statsmodels               0.8.0            py36h9c68fc9_0  

sympy                     1.1.1            py36h7f3cf04_0  

tblib                     1.3.2            py36hda67792_0  

terminado                 0.8.1                    py36_1  

testpath                  0.3.1            py36h625a49b_0  

tk                        8.6.7                h35a86e2_3  

toolz                     0.9.0                    py36_0  

tornado                   4.5.3                    py36_0  

traitlets                 4.3.2            py36h65bd3ce_0  

typing                    3.6.2            py36haa2d9ef_0  

unicodecsv                0.14.1           py36he531d66_0  

unixodbc                  2.3.4                h4cb4dde_1  

urllib3                   1.22             py36h68b9469_0  

wcwidth                   0.1.7            py36h8c6ec74_0  

webencodings              0.5.1            py36h3b9701d_1  

werkzeug                  0.14.1                   py36_0  

wheel                     0.30.0           py36h5eb2c71_1  

widgetsnbextension        3.1.0                    py36_0  

wrapt                     1.10.11          py36hc29e774_0  

xlrd                      1.1.0            py36h336f4a2_1  

xlsxwriter                1.0.2            py36h3736301_0  

xlwings                   0.11.5                   py36_0  

xlwt                      1.2.0            py36h5ad1178_0  

xz                        5.2.3                h0278029_2  

yaml                      0.1.7                hc338f04_2  

zeromq                    4.2.2                ha360ad0_2  

zict                      0.1.3            py36h71da714_0  

zlib                      1.2.11               hf3cbc9b_2


13 Mayıs 2018 Pazar 07:25:03 UTC+3 tarihinde Bryan W. Weber yazdı:

büşra zaza

unread,
May 13, 2018, 3:49:16 PM5/13/18
to Cantera Users' Group
then;

13 Mayıs 2018 Pazar 22:47:21 UTC+3 tarihinde büşra zaza yazdı:

büşra zaza

unread,
May 13, 2018, 3:50:48 PM5/13/18
to Cantera Users' Group
conda env list

# conda environments:

#

base                  *  /Users/busracetin/anaconda3

spam                     /Users/busracetin/anaconda3/envs/spam


spam is the environment which I've installed.


13 Mayıs 2018 Pazar 07:25:03 UTC+3 tarihinde Bryan W. Weber yazdı:
Hi,

büşra zaza

unread,
May 13, 2018, 3:51:28 PM5/13/18
to Cantera Users' Group
source activate my_other_conda_env
# show list of packages in the new env
conda list

# packages in environment at /Users/busracetin/anaconda3/envs/spam:

#

# Name                    Version                   Build  Channel

appnope                   0.1.0            py36hf537a9a_0  

backcall                  0.1.0                    py36_0  

ca-certificates           2018.03.07                    0  

cantera                   2.3.0               np113py36_2    cantera

certifi                   2018.4.16                py36_0  

cycler                    0.10.0           py36hfc81398_0  

decorator                 4.3.0                    py36_0  

freetype                  2.8                  h12048fb_1  

intel-openmp              2018.0.0                      8  

ipython                   6.4.0                    py36_0  

ipython_genutils          0.2.0            py36h241746c_0  

jedi                      0.12.0                   py36_1  

kiwisolver                1.0.1            py36h792292d_0  

libcxx                    4.0.1                h579ed51_0  

libcxxabi                 4.0.1                hebd6815_0  

libedit                   3.1.20170329         hb402a30_2  

libffi                    3.2.1                h475c297_4  

libgfortran               3.0.1                h93005f0_2  

libpng                    1.6.34               he12f830_0  

matplotlib                2.2.2            py36ha7267d0_0  

mkl                       2018.0.2                      1  

mkl_fft                   1.0.1            py36h917ab60_0  

mkl_random                1.0.1            py36h78cc56f_0  

ncurses                   6.1                  h0a44026_0  

numpy                     1.13.3           py36ha9ae307_4  

openssl                   1.0.2o               h26aff7b_0  

parso                     0.2.0                    py36_0  

pexpect                   4.5.0                    py36_0  

pickleshare               0.7.4            py36hf512f8e_0  

pip                       10.0.1                   py36_0  

prompt_toolkit            1.0.15           py36haeda067_0  

ptyprocess                0.5.2            py36he6521c3_0  

pygments                  2.2.0            py36h240cd3f_0  

pyparsing                 2.2.0            py36hb281f35_0  

python                    3.6.5                hc167b69_1  

python-dateutil           2.7.2                    py36_0  

pytz                      2018.4                   py36_0  

readline                  7.0                  hc1231fa_4  

setuptools                39.1.0                   py36_0  

simplegeneric             0.8.1                    py36_2  

six                       1.11.0           py36h0e22d5e_1  

sqlite                    3.23.1               hf1716c9_0  

tk                        8.6.7                h35a86e2_3  

tornado                   5.0.2                    py36_0  

traitlets                 4.3.2            py36h65bd3ce_0  

wcwidth                   0.1.7            py36h8c6ec74_0  

wheel                     0.31.0                   py36_0  

xz                        5.2.3                h727817e_4  

zlib                      1.2.11               hf3cbc9b_2


13 Mayıs 2018 Pazar 07:25:03 UTC+3 tarihinde Bryan W. Weber yazdı:
Hi,

büşra zaza

unread,
May 13, 2018, 3:56:18 PM5/13/18
to Cantera Users' Group
And the answer of "Can you also please clarify how you are trying to run the example?" is;

Firstly I open IDLE and then open any .py file in the folder of

/Users/busracetin/anaconda3/pkgs/cantera-2.4.0b1-np114py36_0/lib/python3.6/site-packages/cantera/examples

13 Mayıs 2018 Pazar 07:25:03 UTC+3 tarihinde Bryan W. Weber yazdı:
Hi,

Ray Speth

unread,
May 13, 2018, 10:54:28 PM5/13/18
to Cantera Users' Group

Hi,

I’m wondering whether the copy of Python that you’re getting through IDLE is actually your Anaconda python. What is the output of running the following commands in IDLE?

import sys
print(sys.version)
print(sys.executable)
print(sys.path)

And what happens if you try to run a Cantera example from the command prompt with the conda environment activated, e.g.:

python -m cantera.examples.onedim.premixed_counterflow_flame

Regards,
Ray

büşra zaza

unread,
May 14, 2018, 6:16:02 AM5/14/18
to Cantera Users' Group
Hi,

Answers are,
import sys
print(sys.version)
print(sys.executable)
print(sys.path)
3.7.0b4 (v3.7.0b4:eb96c37699, May  2 2018, 04:13:13) 
[Clang 6.0 (clang-600.0.57)]
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
['/Users/busracetin/Desktop', '/Users/busracetin/Documents', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages']


And when I run your command, it worked and gave the result on terminal.

14 Mayıs 2018 Pazartesi 05:54:28 UTC+3 tarihinde Ray Speth yazdı:

Nick Curtis

unread,
May 14, 2018, 10:56:03 AM5/14/18
to Cantera Users' Group
Ahhh there's the issue -- Idle isn't running on the anaconda python installation.
If you run:

which idle

in terminal, you should see that it's somewhere in /Library/Frameworks/Python.framework/Versions/3.7/bin/ (or the like) rather than your conda env.
It looks like you should use the full path when launching a conda-installed IDLE to get the appropriate python, you can make an alias to make life easy, e.g.:

alias aidle='$CONDA_PREFIX/bin/idle'

Nick

büşra zaza

unread,
May 14, 2018, 11:19:26 AM5/14/18
to Cantera Users' Group
Thank you Nick. Finally it worked with anaconda's idle.
I hope you will be so happy, and also for others who tried to make it easy.

14 Mayıs 2018 Pazartesi 17:56:03 UTC+3 tarihinde Nick Curtis yazdı:
Reply all
Reply to author
Forward
0 new messages