Python version mismatch in install?

173 views
Skip to first unread message

Gavin Ridley

unread,
Nov 16, 2017, 4:04:36 PM11/16/17
to OpenMC Users Group
Hi all,

I'm trying to get openMC running to easily deal with cross section data in a Jupyter notebook. I'd like to build from source rather than get code from the PPA. Hopefully everything will be using python3 on my Ubuntu 16.10 computer, but it appears something tries to use python 2.7:

Installed /usr/local/lib/python2.7/site-packages/openmc-0.9.0-py2.7.egg
Processing dependencies for openmc==0.9.0
Searching for ipython
Best match: ipython 6.2.1
Processing ipython-6.2.1.tar.gz
Writing /tmp/easy_install-ZBslmg/ipython-6.2.1/setup.cfg
Running ipython-6.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ZBslmg/ipython-6.2.1/egg-dist-tmp-apiu7d

IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
Beginning with IPython 6.0, Python 3.3 and above is required.

See IPython `README.rst` file for more information:


Python sys.version_info(major=2, minor=7, micro=13, releaselevel='final', serial=0) detected.


error: Setup script exited with 1


Where looking at the sys.version line reveals that 2.7 gets used at some point, which my Ipython 6.1 cannot use.

Can anyone help me set up the install to use the system-included python3, which is version 3.5?

Paul Romano

unread,
Nov 16, 2017, 7:05:08 PM11/16/17
to Gavin Ridley, OpenMC Users Group
Hi Gavin,

The problem probably has to do with which Python interpreter CMake finds when it runs. I believe you can hardwire it with the following:

cmake -DPYTHON_EXECUTABLE=python3 ....

Give that a try and let us know if it works out.

Best regards,
Paul

--
You received this message because you are subscribed to the Google Groups "OpenMC Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openmc-users+unsubscribe@googlegroups.com.
To post to this group, send email to openmc...@googlegroups.com.
Visit this group at https://groups.google.com/group/openmc-users.
For more options, visit https://groups.google.com/d/optout.

Gavin Ridley

unread,
Nov 16, 2017, 9:06:19 PM11/16/17
to OpenMC Users Group
Hey Paul,

Thanks, this seems to have immediately done the trick in terms of no error messages arriving. Unfortunately, after running with "cmake ../openmc -DPYTHON_EXECUTABLE=python3", I receive the error message:

[gavin][~/code/openmc-build]> make test
Running tests...
Test project /home/gavin/code/openmc-build
      Start  1: test_asymmetric_lattice.py
Could not find executable /home/gavin/code/openmc-build/python3

Moreover, attempting to use openmc after "sudo make install" gives

[gavin][~/code/openmc]> which openmc
/usr/local/bin/openmc
[gavin][~/code/openmc]> openmc
openmc: error while loading shared libraries: libopenmc.so: cannot open shared object file: No such file or directory



To unsubscribe from this group and stop receiving emails from it, send an email to openmc-users...@googlegroups.com.

Paul Romano

unread,
Nov 17, 2017, 8:37:10 AM11/17/17
to Gavin Ridley, OpenMC Users Group
Hi Gavin,

For the first issue, perhaps try using an absolute path, i.e., -DPYTHON_EXECUTABLE=/usr/bin/python3 and see if that helps. For the second issue, try adding the directory containing libopenmc.so (in your case, most likely /usr/local/lib/) to your LD_LIBRARY_PATH environment variable.

Another thing you may want to consider, and that I would generally recommend, is to use a virtual environment, either through Python itself (the venv module) or using a distribution like Anaconda. Anaconda has its own version of virtual environments (conda environments). When you use a virtual environment, 'which python' will show the Python interpreter that is installed as part of that environment, so when cmake is run there will be no confusion. The problem in your case is that in Ubuntu, /usr/bin/python is actually Python 2, not Python 3.

Hope this helps!

Best,
Paul

To unsubscribe from this group and stop receiving emails from it, send an email to openmc-users+unsubscribe@googlegroups.com.

Gavin Ridley

unread,
Nov 18, 2017, 2:48:04 PM11/18/17
to OpenMC Users Group
Paul,

Thanks, this seems to have done the trick. OpenMC seems to be working fine now.

Thanks again!
Reply all
Reply to author
Forward
0 new messages