OpenMOC installation problem

202 views
Skip to first unread message

pranto....@gmail.com

unread,
Oct 7, 2019, 11:00:21 PM10/7/19
to OpenMOC Users Group
I install all dependency for OpenMOC from openmoc manual instruction.
At the time of installation i get following message   

swig.png




Swig version 3.0.12

When i import openmoc from notebook i get following error

jupyter.png


Why this kind of error?

             

mark dennis

unread,
Oct 31, 2020, 9:49:10 AM10/31/20
to OpenMOC Users Group
I can confirm the same problem when using it with python 3.7.3 in conda.
The problem disappear when I'm using 2.7 but was replaced with

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

on the module subdivider.py for

class Subdivider(openmoc.Lattice):

Guillaume Giudicelli

unread,
Oct 31, 2020, 11:16:22 AM10/31/20
to OpenMOC Users Group
Hi Mark

Python2 support is deprecated so if you are going to use it you will have to fix a lot of things. 

It should work with python 3.7.3. 
Can you confirm that you are using the same python at install time and at runtime?
What does which python return?
Where is OpenMOC installed when you install it? (look for site-packages). 

Also make sure to install OpenMOC twice the first time, it's an issue we have with swig. 

Best,
Guillaume

Ariful Islam Pranto

unread,
Oct 31, 2020, 11:42:09 AM10/31/20
to OpenMOC Users Group
Hi Guillaume,

Yep, perfectly working on python 3.7.3.

But I have seen couple of syntax warning issue on python 3.9.

/home/pranto/github/OpenMOC/openmoc/process.py:400: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if solver_type is 'GPUSolver':
/home/pranto/github/OpenMOC/openmoc/process.py:450: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if not note is '':
/home/pranto/github/OpenMOC/openmoc/process.py:472: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if solver_type is 'GPUSolver':
/home/pranto/github/OpenMOC/openmoc/process.py:513: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if not note is '':
/home/pranto/github/OpenMOC/openmoc/process.py:535: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if solver_type is 'GPUSolver':
/home/pranto/github/OpenMOC/openmoc/process.py:678: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if solver_type is 'GPUSolver':

From python 3.8 release note

The compiler now produces a SyntaxWarning when identity checks (is and is not) are used with certain types of literals (e.g. strings, numbers). These can often work by accident in CPython, but are not guaranteed by the language spec. The warning advises users to use equality tests (== and !=) instead. (Contributed by Serhiy Storchaka

mark dennis

unread,
Nov 1, 2020, 1:31:13 AM11/1/20
to OpenMOC Users Group
Hi Guillaume,

Thanks for the response.
I can confirm that both python 3.7.3 are being used during install and runtime.
I've check the python version during install with python --version
During runtime, I use ipython and it showed that I'm using python 3.7.3
Since I'm using it in conda environment, all the dependencies are from conda as well.
The conda environment I'm using is running on Ubuntu 20.04.1 LTS.

When I invoke which python, the output is /home/mark/anaconda3/bin/python
As for ipython, the output is /home/mark/anaconda3/bin/ipython

On the first install with the command python setup.py install --user

ModuleNotFoundError: No module named 'openmoc.openmoc'

On the second install with python setup.py install --user

ImportError: /home/mark/.local/lib/python3.7/site-packages/openmoc-0.4.0-py3.7-linux-x86_64.egg/_openmoc.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZNSt7__cxx1118basic_stringstreamIcSt11char_trait
sIcESaIcEEC1Ev


Afterwards, all subsequent install suffer from the same issue.
It does seem related to swig.

Do you know when is the last working commit or branch with python 2.7 ?
Since we're using git anyway, it should not be too difficult for me to just revert to the last working commit.

regards,

Mark

Ariful Islam Pranto

unread,
Nov 1, 2020, 7:31:44 AM11/1/20
to OpenMOC Users Group
Hi Mark,

Try with

python setup.py install

and also install ipython on that conda environment by conda install ipython.

Guillaume Giudicelli

unread,
Nov 1, 2020, 12:56:31 PM11/1/20
to OpenMOC Users Group
Hi Mark

Ok the error on the first install is normal.
On the second install, I have not seen this error before. It could be that while using the same python version, we are still dealing with two pythons, one in your system and one from anaconda. I don't use ipython, it could be from that too. 

Can you try to import openmoc from a regular python shell?

I did not keep track of which was the last version of OpenMOC which worked with Python 2.7 and do not recommend reverting to an older commit of OpenMOC, too many bug fixes you'd miss out on. 

If you are comfortable with Python 2.7 you could just fix the compatibility. I'd be fine with a PR to do this. 
Another option would be to create a Python 3.8 environment in your conda and check if it works there. I'm using 3.8 with no issue. It's unlikely to be a Python version issue tbh, but starting from a fresh environment always helps. 

Also run python setup.py clean before trying Ariful's idea. 

Best,
Guillaume

mark dennis

unread,
Nov 2, 2020, 5:04:16 AM11/2/20
to OpenMOC Users Group
Hi Guillaume,

I'm happy to report that the conda environment with python 3.8 works perfect.
To be honest, I have no clue why it happens.

I've always clean the build before re-installing them, with occasional re-cloning of the git just for sanity check.
Before this, I've also tried Ariful idea with no success.

It might be related to swig itself as was mentioned in stack overflow. 
The issue was old but it might have fallen out of radar for python 3.7

Anyway, thanks for the ideas.

kind regards,

Mark Dennis Usang
Reply all
Reply to author
Forward
0 new messages