Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 628222 - dev-python/jupyter - Jupyter Notebooks always use the version of Python that was used to execute jupyter-notebook
Summary: dev-python/jupyter - Jupyter Notebooks always use the version of Python that ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Science Related Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-18 19:30 UTC by Eric Hermes
Modified: 2019-12-27 01:37 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
output of emerge --info (emerge-info.txt,5.86 KB, text/plain)
2017-08-18 19:30 UTC, Eric Hermes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Hermes 2017-08-18 19:30:23 UTC
Created attachment 489542 [details]
output of emerge --info

When trying to create a new Python notebook in Jupyter Notebook, the kernel version will always match the version of Python that was used to launch Jupyter Notebook itself, regardless of what the user requests. For example, if jupyter-notebook is launched with python2.7, both "Python 2" and "Python 3" notebooks will use python2.7. Similarly, if jupyter-notebook is launched with python3.4, both "Python 2" and "Python 3" notebooks will use python3.4.

Relevant package versions:
dev-python/jupyter-1.0.0-r1
dev-python/jupyter_client-5.1.0
dev-python/jupyter_console-5.1.0
dev-python/jupyter_core-4.3.0
dev-python/ipython-5.4.1
dev-python/ipykernel-4.6.1
dev-python/nbconvert-4.3.0
dev-python/nbformat-4.3.0
dev-python/widgetsnbextension-2.0.0

Steps to reproduce:
1) Install dev-python/jupyter and its dependencies with python2_7 and python3_4 in PYTHON_TARGETS
2) Run the command: EPYTHON="python2.7" jupyter-notebook
3) Create two new notebooks, one that is "Python 2" and one that is "Python 3"
4) In each new notebook, run "import sys; print(sys.version)"
5) Stop jupyter-notebook, and re-run it with: EPYTHON="python3.4" jupyter-notebook
6) Repeat steps 3 and 4

Expected results:
Python's version should match what was chosen when the notebook was created

Actual results:
Python's version matches the version of Python used to execute jupyter-notebook
Comment 1 Benda Xu gentoo-dev 2017-08-30 09:01:12 UTC
Hi Eric, thank you very much for the report.  Fixed in ipykernel-4.6.1-r2 by https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0438d76575de86cf88d45a0264214afa87781b53

Please test.
Comment 2 Eric Hermes 2017-08-30 15:05:36 UTC
> Please test.

Thanks, it's working now. On a related note, please take a look at https://bugs.gentoo.org/show_bug.cgi?id=629376.
Comment 3 Colin MacLean 2018-06-04 16:36:04 UTC
This patch breaks things when multiple versions of python3 are installed. When I install python3.5 and python3.6, the python implementation is hard coded to python3.6 and breaks running jupyter notebook with python3.5, causing it to hang.

I suggest changing 

sed -e "s:python:${EPYTHON}:" -i "${ED}"usr/share/jupyter/kernels/${EPYTHON%.*}/kernel.json || die

to

sed -e "s:python:${EPYTHON%.*}:" -i "${ED}"usr/share/jupyter/kernels/${EPYTHON%.*}/kernel.json || die

in the ebuild.
Comment 4 Larry the Git Cow gentoo-dev 2018-06-08 20:57:28 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=849068830764c9092de79d51a9751009f7abb2b9

commit 849068830764c9092de79d51a9751009f7abb2b9
Author:     Benda Xu <heroxbd@gentoo.org>
AuthorDate: 2018-06-08 20:56:27 +0000
Commit:     Benda Xu <heroxbd@gentoo.org>
CommitDate: 2018-06-08 20:57:06 +0000

    dev-python/ipykernel: handle the multiple python3 case.
    
      Bonus of verion bump.
    
    Credit: Colin MacLean
    Closes: https://bugs.gentoo.org/628222
    Package-Manager: Portage-2.3.28, Repoman-2.3.9

 dev-python/ipykernel/Manifest                  |  1 +
 dev-python/ipykernel/ipykernel-4.6.1-r2.ebuild |  2 +-
 dev-python/ipykernel/ipykernel-4.8.2.ebuild    | 45 ++++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 1 deletion(-)
Comment 5 Larry the Git Cow gentoo-dev 2019-12-27 01:37:42 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f80be0a5d2f4dfa708ef691764d8a49a627f6cff

commit f80be0a5d2f4dfa708ef691764d8a49a627f6cff
Author:     Benda Xu <heroxbd@gentoo.org>
AuthorDate: 2019-12-26 00:42:56 +0000
Commit:     Benda Xu <heroxbd@gentoo.org>
CommitDate: 2019-12-27 01:08:12 +0000

    dev-python/ipykernel: do not mangle the python call.
    
      Upstream has already fixed it.
    
    Suggested-By: Denis Lisov
    Bug: https://bugs.gentoo.org/628222
    Closes: https://bugs.gentoo.org/703748
    Package-Manager: Portage-2.3.79, Repoman-2.3.18
    Signed-off-by: Benda Xu <heroxbd@gentoo.org>

 dev-python/ipykernel/ipykernel-5.1.3.ebuild | 8 --------
 1 file changed, 8 deletions(-)