[CCPPETMR/CCPPETMR_VM] use python3 (#122)

0 views
Skip to first unread message

Kris Thielemans

unread,
Apr 9, 2019, 7:06:18 PM4/9/19
to CCPPETMR/CCPPETMR_VM, Subscribed

Python2 becomes more and more of a problem. We now fail to install spyder, see #121.

Sadly, on Ubuntu 18.04, default python is still python2.7. I guess we can easily tell the SuperBuild to use python3. But what about jupyter? Will it just work when we use

python3 -m pip install jupyter

Possibly easiest would be to do

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
sudo update-alternatives  --set python /usr/bin/python3.6

before doing anything python-like at all.

@casperdcl @bathomas what do you think?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Kris Thielemans

unread,
Jan 24, 2020, 7:13:01 AM1/24/20
to CCPPETMR/CCPPETMR_VM, Subscribed

A complication might be that the SIRF-exercises notebooks had to include python2 kernel name, even though some of them have python3, e.g.

"metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },

in https://raw.githubusercontent.com/CCPPETMR/SIRF-Exercises/master/notebooks/Reg/sirf_registration.ipynb


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Casper da Costa-Luis

unread,
Jan 24, 2020, 7:59:56 AM1/24/20
to CCPPETMR/CCPPETMR_VM, Subscribed

update-alternatives for a system library is risky; it may break something else. jupyter will "just work" (with a warning about selecting a new kernel in case the name changes)


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Casper da Costa-Luis

unread,
Jan 24, 2020, 8:00:56 AM1/24/20
to CCPPETMR/CCPPETMR_VM, Subscribed

also I presume ubuntu 20.04LTS will default to py3.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Ede1994

unread,
Jan 24, 2020, 8:29:09 AM1/24/20
to CCPPETMR/CCPPETMR_VM, Subscribed

So I tested with a jupyter notebook based on python2 and the following code was issued by the terminal:

[IPKernelApp] ERROR | Failed to create history session in /home/sirfuser/.ipython/profile_default/history.sqlite. History will not be saved.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/IPython/core/history.py", line 549, in __init__
    self.new_session()
  File "</usr/local/lib/python2.7/dist-packages/decorator.pyc:decorator-gen-22>", line 2, in new_session
  File "/usr/local/lib/python2.7/dist-packages/IPython/core/history.py", line 60, in needs_sqlite
    return f(self, *a, **kw)
  File "/usr/local/lib/python2.7/dist-packages/IPython/core/history.py", line 575, in new_session
    NULL, "") """, (datetime.datetime.now(),))
OperationalError: database is locked


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Kris Thielemans

unread,
Jan 26, 2020, 4:02:07 AM1/26/20
to CCPPETMR/CCPPETMR_VM, Subscribed

This seems unrelated. Best to try again after a reboot of the VM.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Kris Thielemans

unread,
Jan 26, 2020, 4:04:48 AM1/26/20
to CCPPETMR/CCPPETMR_VM, Subscribed

@casperdcl you say

jupyter in python3 wll just work

After python3 -m pip install jupyter, I presume that will override an existing python2 install, and that the new one wlil have python3 as default kernel? (A volunteer for trying this?)


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Kris Thielemans

unread,
Jan 26, 2020, 4:05:42 AM1/26/20
to CCPPETMR/CCPPETMR_VM, Subscribed

The other thing though is to make sure that CMake picks up python3 in the build. That might need a change in UPDATE.sh etc.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Kris Thielemans

unread,
Jan 26, 2020, 5:24:35 AM1/26/20
to CCPPETMR/CCPPETMR_VM, Subscribed

We're using CMake 3.13. We should probably by using FindPython now, which would then default to using python3 apparently.

See CCPPETMR/SIRF-SuperBuild#313


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Casper da Costa-Luis

unread,
Jan 26, 2020, 6:29:00 AM1/26/20
to CCPPETMR/CCPPETMR_VM, Subscribed

After python3 -m pip install jupyter, I presume that will override an existing python2 install, and that the new one wlil have python3 as default kernel?

Assuming

  1. there's also still a py2 jupyter installed
  2. The launch command is just jupyter
  3. the launch is not within a conda/venv

Then it would depend on the order in PATH whether jupyter py2 or 3 took precedence. Otherwise there would be no conflict.

For our purposes (vm/docker) we can definitely fully control this (incl. e.g. setting a default py2 kernel for py3 jupyter)


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Reply all
Reply to author
Forward
0 new messages