Cannot create Jupyter Notebook for Python 3.6

All other Source.Python topics and issues.
ErnestTBass
Junior Member
Posts: 13
Joined: Sun Mar 31, 2019 6:37 pm

Cannot create Jupyter Notebook for Python 3.6

Postby ErnestTBass » Sun Apr 07, 2019 5:33 pm

In the following link

ttps://medium.com/@chrisfotache/getting ... 2386952d03

, I am trying to process the command

sudo python -m ipykernel install - name Python3.6.

to work, but It fails. See output below.

Code: Select all

ames@james-VirtualBox:/usr/bin$ sudo python -m ipykernel install - name Python3.6
/usr/bin/python: No module named ipykernel
james@james-VirtualBox:/usr/bin$ cd /usr/bin/
james@james-VirtualBox:/usr/bin$ ls -al ipykernel
ls: cannot access 'ipykernel': No such file or directory
james@james-VirtualBox:/usr/bin$


The attached document claims it should install jupyter notebook for Python 3.6. In my
ubuntu 16.04 system it fails. As I stated all command leading up to this are successful.

How to I get this command to work?

Thank in advance.

Respectfully,

Newport_j
Last edited by Ayuto on Tue Apr 09, 2019 4:39 pm, edited 1 time in total.
Reason: Fixed the code tags
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Cannot create Jupyter Notebook for Python 3.6

Postby Ayuto » Sun Apr 07, 2019 5:57 pm

Seems like you din't install ipykernel. You can do that using pip.
ErnestTBass
Junior Member
Posts: 13
Joined: Sun Mar 31, 2019 6:37 pm

Re: Cannot create Jupyter Notebook for Python 3.6

Postby ErnestTBass » Mon Apr 08, 2019 2:52 pm

I believe that ipykernel is already on there. It is just for an earlier version of Python, may version 3.5.2.

How do I install ipykernel for Python 3.6 and above.
Thanks in advance.

Respectfully,

ErnestTBass
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Cannot create Jupyter Notebook for Python 3.6

Postby Ayuto » Mon Apr 08, 2019 3:24 pm

python3.6 -m pip install ipykernel
ErnestTBass
Junior Member
Posts: 13
Joined: Sun Mar 31, 2019 6:37 pm

Re: Cannot create Jupyter Notebook for Python 3.6

Postby ErnestTBass » Tue Apr 09, 2019 4:32 pm

I tried the command that you sent to me. It required a sudo plus -H to get anything to work

Here is the output

Code: Select all

 sudo -H python3.6 -m pip install ipykernel
[sudo] password for james:
Requirement already satisfied (use --upgrade to upgrade): ipykernel in
/usr/local/lib/python3.6/dist-packages
Requirement already satisfied (use --upgrade to upgrade): tornado>=4.2
in /usr/local/lib/python3.6/dist-packages (from ipykernel)
Requirement already satisfied (use --upgrade to upgrade):
ipython>=5.0.0 in /usr/local/lib/python3.6/dist-packages (from
ipykernel)
Requirement already satisfied (use --upgrade to upgrade):
jupyter-client in /usr/local/lib/python3.6/dist-packages (from
ipykernel)
Requirement already satisfied (use --upgrade to upgrade):
traitlets>=4.1.0 in /usr/local/lib/python3.6/dist-packages (from
ipykernel)
Requirement already satisfied (use --upgrade to upgrade): decorator in
/usr/local/lib/python3.6/dist-packages (from
ipython>=5.0.0->ipykernel)
Requirement already satisfied (use --upgrade to upgrade):
prompt-toolkit<2.1.0,>=2.0.0 in /usr/local/lib/python3.6/dist-packages
(from ipython>=5.0.0->ipykernel)
Requirement already satisfied (use --upgrade to upgrade): backcall in
/usr/local/lib/python3.6/dist-packages (from
ipython>=5.0.0->ipykernel)
Requirement already satisfied (use --upgrade to upgrade): pygments in
/usr/local/lib/python3.6/dist-packages (from
ipython>=5.0.0->ipykernel)
Requirement already satisfied (use --upgrade to upgrade):
setuptools>=18.5 in /usr/lib/python3/dist-packages (from
ipython>=5.0.0->ipykernel)
Requirement already satisfied (use --upgrade to upgrade): pexpect;
sys_platform != "win32" in /usr/lib/python3/dist-packages (from
ipython>=5.0.0->ipykernel)
Requirement already satisfied (use --upgrade to upgrade): pickleshare
in /usr/local/lib/python3.6/dist-packages (from
ipython>=5.0.0->ipykernel)
Requirement already satisfied (use --upgrade to upgrade): jedi>=0.10
in /usr/local/lib/python3.6/dist-packages (from
ipython>=5.0.0->ipykernel)
Requirement already satisfied (use --upgrade to upgrade): pyzmq>=13 in
/usr/local/lib/python3.6/dist-packages (from
jupyter-client->ipykernel)
Requirement already satisfied (use --upgrade to upgrade): jupyter-core
in /usr/local/lib/python3.6/dist-packages (from
jupyter-client->ipykernel)
Requirement already satisfied (use --upgrade to upgrade):
python-dateutil>=2.1 in /usr/local/lib/python3.6/dist-packages (from
jupyter-client->ipykernel)
Requirement already satisfied (use --upgrade to upgrade): six in
/usr/lib/python3/dist-packages (from traitlets>=4.1.0->ipykernel)
Requirement already satisfied (use --upgrade to upgrade):
ipython-genutils in /usr/local/lib/python3.6/dist-packages (from
traitlets>=4.1.0->ipykernel)
Requirement already satisfied (use --upgrade to upgrade): wcwidth in
/usr/local/lib/python3.6/dist-packages (from
prompt-toolkit<2.1.0,>=2.0.0->ipython>=5.0.0->ipykernel)
Requirement already satisfied (use --upgrade to upgrade): parso>=0.3.0
in /usr/local/lib/python3.6/dist-packages (from
jedi>=0.10->ipython>=5.0.0->ipykernel)
You are using pip version 8.1.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
james@james-VirtualBox:~$ sudo python -m ipykernel install -- name Python3.6
/usr/bin/python: No module named ipykernel


It says in the first line that ipykernel in

/usr/local/lib/python3.6/dist-packages

but that is not where the software is looking.

It is looking in

/usr/bin/python: No module named ipykernel

is it possible that the software installer is looking
for the ipykernel in the wrong place. It is looking for ipykernel
where it is not.

Could it be as simple as that?

Any help appreciated. Thanks in advance.

Respectfully,

ErnestTBass
Last edited by Ayuto on Tue Apr 09, 2019 4:38 pm, edited 1 time in total.
Reason: Fixed the code tags
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Cannot create Jupyter Notebook for Python 3.6

Postby Ayuto » Tue Apr 09, 2019 4:42 pm

No, "python" proably just starts a different version. You can see the version by using the following command:

Code: Select all

python -V
To make sure you start ipykernel using Python 3.6, use the following command:

Code: Select all

sudo python3.6 -m ipykernel install -- name Python3.6
ErnestTBass
Junior Member
Posts: 13
Joined: Sun Mar 31, 2019 6:37 pm

Re: Cannot create Jupyter Notebook for Python 3.6

Postby ErnestTBass » Thu Apr 11, 2019 6:16 pm

I did try your command and it worked. I had to change the final Python3.6 to python3.6. It said that this was already installed.
Here is the output

Code: Select all

sudo python3.6 -m ipykernel install --name python3.6
Installed kernelspec python3.6 in /usr/local/share/jupyter/kernels/python3.6
james@james-VirtualBox:~$ python3
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>>
james@james-VirtualBox:~$ python3.6
Python 3.6.7 (default, Oct 25 2018, 09:16:13)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from fastai import *
>>> from fastai.vision import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/james/.local/lib/python3.6/site-packages/fastai/vision/__init__.py", line 1, in <module>
    from .. import basics
  File "/home/james/.local/lib/python3.6/site-packages/fastai/basics.py", line 1, in <module>
    from .basic_train import *
  File "/home/james/.local/lib/python3.6/site-packages/fastai/basic_train.py", line 2, in <module>
    from .torch_core import *
  File "/home/james/.local/lib/python3.6/site-packages/fastai/torch_core.py", line 2, in <module>
    from .imports.torch import *
  File "/home/james/.local/lib/python3.6/site-packages/fastai/imports/__init__.py", line 2, in <module>
    from .torch import *
  File "/home/james/.local/lib/python3.6/site-packages/fastai/imports/torch.py", line 1, in <module>
    import torch, torch.nn.functional as F
  File "/home/james/.local/lib/python3.6/site-packages/torch/__init__.py", line 320, in <module>
    import torch.distributions
  File "/home/james/.local/lib/python3.6/site-packages/torch/distributions/__init__.py", line 77, in <module>
    from .categorical import Categorical
  File "/home/james/.local/lib/python3.6/site-packages/torch/distributions/categorical.py", line 2, in <module>
    from torch._six import nan
ImportError: cannot import name 'nan'


Now as you can see it had a problem when I asked it to:

from fastai.vision import *

It simply crashed on the command. I am not sure what happened. It seems to be a problem with import torch, I am not sure.

It has no problem with

import fastai

, but it did have a problem importing from fastai.vision import *.

What could be the problem and how do I fix it?

Thanks in advance.

Respectfully,

ErnestTBass
ErnestTBass
Junior Member
Posts: 13
Joined: Sun Mar 31, 2019 6:37 pm

Re: Cannot create Jupyter Notebook for Python 3.6

Postby ErnestTBass » Thu Apr 11, 2019 6:19 pm

As a follow-up there is something that I left out in the previous post. I am getting my information form the following paper:

Getting Started with Fastai v1 the Easy Way, Using Python 3.6, Apt and Pip.

A google search will find it. I am also trying to use fastai version 0.7. I do not know how to tell what version of fastai that I have.

Respectfully,

ErnestTBass
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Cannot create Jupyter Notebook for Python 3.6

Postby Ayuto » Sat Apr 13, 2019 9:01 am

Seems like torch._six doesn't provide nan. But it should actually provide it in the latest version. fastai.vision import * imports torch while import fastai doesn't. That's why the one is working and the other isn't.

Try updating your torch package.
ErnestTBass
Junior Member
Posts: 13
Joined: Sun Mar 31, 2019 6:37 pm

Re: Cannot create Jupyter Notebook for Python 3.6

Postby ErnestTBass » Sat Apr 13, 2019 5:14 pm

I will update torch_six; is there a certain version that I should update to?

It seems that the trouble is with torch not fastai. Can I have two versions of fastai on the same ubuntu 16.04?

Thanks in advance.
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Cannot create Jupyter Notebook for Python 3.6

Postby Ayuto » Sat Apr 13, 2019 6:07 pm

Simply use pip to update to the latest version. And yes, you can have multiple versions of a package.
ErnestTBass
Junior Member
Posts: 13
Joined: Sun Mar 31, 2019 6:37 pm

Re: Cannot create Jupyter Notebook for Python 3.6

Postby ErnestTBass » Sun Apr 14, 2019 5:15 pm

I guess that you are going to have to give me the syntax exactly. I have tried and tried, I just do not know how to upgrade torch. I have tried everything.

What is the difference between torch and torch-six?

Respectfully,

James M. yunker
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Cannot create Jupyter Notebook for Python 3.6

Postby Ayuto » Sun Apr 14, 2019 6:32 pm

Something like this should work:
python3.6 -m pip install torch torchvision --upgrade

It's all on Google and the PyTorch website.

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 11 guests