Instale o Jupyter Notebook para o Python 2.7

2

Como posso instalar o Jupyter for Python 2.7 no Ubuntu 14.04?

eu tento:

sudo add-apt-repository ppa:jolicloud-team/ppa
sudo apt-get update

A saída para atualização:

Ign file:  InRelease
Get:1 file:  Release.gpg [181 B]
Get:2 file:  Release [196 B]                                                   
Ign file:  Translation-en_US                                                   
Ign file:  Translation-en                                                      
Hit http://storage.googleapis.com stable InRelease         
Ign http://us.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 5,905 kB in 6s (915 kB/s)                                              
W: Failed to fetch http://ppa.launchpad.net/jolicloud-team/ppa/ubuntu/dists/trusty/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/jolicloud-team/ppa/ubuntu/dists/trusty/main/binary-i386/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.

e depois:

sudo apt-get install jupiter

Saída:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package jupiter

ATUALIZAÇÃO:

mona@pascal:~/computer_vision/imgur$ sudo python -m pip install --upgrade --force-reinstall pip
The directory '/home/mona/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/mona/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 721kB/s 
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-9.0.1
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
mona@pascal:~/computer_vision/imgur$ sudo -H pip install jupyter
Collecting jupyter
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading jupyter-1.0.0-py2.py3-none-any.whl
Collecting ipywidgets (from jupyter)
  Downloading ipywidgets-5.2.2-py2.py3-none-any.whl (43kB)
    100% |████████████████████████████████| 51kB 1.1MB/s 
Collecting qtconsole (from jupyter)
  Downloading qtconsole-4.2.1-py2.py3-none-any.whl (104kB)
    100% |████████████████████████████████| 112kB 2.1MB/s 
Collecting nbconvert (from jupyter)
  Downloading nbconvert-4.2.0-py2.py3-none-any.whl (319kB)
    100% |████████████████████████████████| 327kB 1.6MB/s 
Collecting notebook (from jupyter)
  Downloading notebook-4.2.3-py2.py3-none-any.whl (6.7MB)
    100% |████████████████████████████████| 6.7MB 154kB/s 
Collecting jupyter-console (from jupyter)
  Downloading jupyter_console-5.0.0-py2.py3-none-any.whl
Collecting ipykernel (from jupyter)
  Downloading ipykernel-4.5.0-py2.py3-none-any.whl (97kB)
    100% |████████████████████████████████| 102kB 5.2MB/s 
Collecting widgetsnbextension>=1.2.6 (from ipywidgets->jupyter)
  Downloading widgetsnbextension-1.2.6-py2.py3-none-any.whl (1.5MB)
    100% |████████████████████████████████| 1.5MB 674kB/s 
Collecting ipython>=4.0.0 (from ipywidgets->jupyter)
  Downloading ipython-5.1.0-py2-none-any.whl (747kB)
    100% |████████████████████████████████| 747kB 1.2MB/s 
Collecting traitlets>=4.2.1 (from ipywidgets->jupyter)
  Downloading traitlets-4.3.1-py2.py3-none-any.whl (74kB)
    100% |████████████████████████████████| 81kB 5.2MB/s 
Collecting pygments (from qtconsole->jupyter)
  Downloading Pygments-2.1.3-py2.py3-none-any.whl (755kB)
    100% |████████████████████████████████| 757kB 1.2MB/s 
Collecting jupyter-client>=4.1 (from qtconsole->jupyter)
  Downloading jupyter_client-4.4.0-py2.py3-none-any.whl (76kB)
    100% |████████████████████████████████| 81kB 5.0MB/s 
Collecting jupyter-core (from qtconsole->jupyter)
  Downloading jupyter_core-4.2.0-py2.py3-none-any.whl (76kB)
    100% |████████████████████████████████| 81kB 5.4MB/s 
Collecting entrypoints (from nbconvert->jupyter)
  Downloading entrypoints-0.2.2-py2.py3-none-any.whl
Collecting nbformat (from nbconvert->jupyter)
  Downloading nbformat-4.1.0-py2.py3-none-any.whl (140kB)
    100% |████████████████████████████████| 143kB 4.0MB/s 
Requirement already satisfied: jinja2 in /usr/lib/python2.7/dist-packages (from nbconvert->jupyter)
Collecting mistune!=0.6 (from nbconvert->jupyter)
  Downloading mistune-0.7.3-py2.py3-none-any.whl
Collecting terminado>=0.3.3; sys_platform != "win32" (from notebook->jupyter)
  Downloading terminado-0.6.tar.gz
Collecting tornado>=4 (from notebook->jupyter)
  Downloading tornado-4.4.2.tar.gz (460kB)
    100% |████████████████████████████████| 460kB 1.9MB/s 
Collecting ipython-genutils (from notebook->jupyter)
  Downloading ipython_genutils-0.1.0-py2.py3-none-any.whl
Collecting prompt-toolkit<2.0.0,>=1.0.0 (from jupyter-console->jupyter)
  Downloading prompt_toolkit-1.0.9-py2-none-any.whl (241kB)
    100% |████████████████████████████████| 245kB 2.7MB/s 
Requirement already satisfied: decorator in /usr/local/lib/python2.7/dist-packages (from ipython>=4.0.0->ipywidgets->jupyter)
Requirement already satisfied: setuptools>=18.5 in /usr/local/lib/python2.7/dist-packages (from ipython>=4.0.0->ipywidgets->jupyter)
Collecting pickleshare (from ipython>=4.0.0->ipywidgets->jupyter)
  Downloading pickleshare-0.7.4-py2.py3-none-any.whl
Collecting backports.shutil-get-terminal-size; python_version == "2.7" (from ipython>=4.0.0->ipywidgets->jupyter)
  Downloading backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl
Requirement already satisfied: pexpect; sys_platform != "win32" in /usr/lib/python2.7/dist-packages (from ipython>=4.0.0->ipywidgets->jupyter)
Collecting pathlib2; python_version == "2.7" or python_version == "3.3" (from ipython>=4.0.0->ipywidgets->jupyter)
  Downloading pathlib2-2.1.0-py2.py3-none-any.whl
Requirement already satisfied: simplegeneric>0.8 in /usr/lib/python2.7/dist-packages (from ipython>=4.0.0->ipywidgets->jupyter)
Requirement already satisfied: six in /usr/local/lib/python2.7/dist-packages (from traitlets>=4.2.1->ipywidgets->jupyter)
Collecting enum34; python_version == "2.7" (from traitlets>=4.2.1->ipywidgets->jupyter)
  Downloading enum34-1.1.6-py2-none-any.whl
Requirement already satisfied: pyzmq>=13 in /usr/lib/python2.7/dist-packages (from jupyter-client>=4.1->qtconsole->jupyter)
Collecting configparser>=3.5; python_version == "2.7" (from entrypoints->nbconvert->jupyter)
  Downloading configparser-3.5.0.tar.gz
Collecting jsonschema!=2.5.0,>=2.0 (from nbformat->nbconvert->jupyter)
  Downloading jsonschema-2.5.1-py2.py3-none-any.whl
Requirement already satisfied: markupsafe in /usr/lib/python2.7/dist-packages (from jinja2->nbconvert->jupyter)
Collecting ptyprocess (from terminado>=0.3.3; sys_platform != "win32"->notebook->jupyter)
  Downloading ptyprocess-0.5.1-py2.py3-none-any.whl
Collecting backports.ssl_match_hostname (from tornado>=4->notebook->jupyter)
  Downloading backports.ssl_match_hostname-3.5.0.1.tar.gz
Collecting singledispatch (from tornado>=4->notebook->jupyter)
  Downloading singledispatch-3.4.0.3-py2.py3-none-any.whl
Collecting certifi (from tornado>=4->notebook->jupyter)
  Downloading certifi-2016.9.26-py2.py3-none-any.whl (377kB)
    100% |████████████████████████████████| 378kB 2.1MB/s 
Collecting backports_abc>=0.4 (from tornado>=4->notebook->jupyter)
  Downloading backports_abc-0.4-py2.py3-none-any.whl
Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.0->jupyter-console->jupyter)
  Downloading wcwidth-0.1.7-py2.py3-none-any.whl
Collecting functools32; python_version == "2.7" (from jsonschema!=2.5.0,>=2.0->nbformat->nbconvert->jupyter)
  Downloading functools32-3.2.3-2.zip
Building wheels for collected packages: terminado, tornado, configparser, backports.ssl-match-hostname, functools32
  Running setup.py bdist_wheel for terminado ... done
  Stored in directory: /root/.cache/pip/wheels/3b/c2/ea/af635ffb63857a8c2ddd22da6a4b52f5b7ea3065db94ef5d7c
  Running setup.py bdist_wheel for tornado ... done
  Stored in directory: /root/.cache/pip/wheels/b3/db/47/46e05d1ee3ecfba252fcab42f0a156dab0df0cddf99fa0827c
  Running setup.py bdist_wheel for configparser ... done
  Stored in directory: /root/.cache/pip/wheels/1c/bd/b4/277af3f6c40645661b4cd1c21df26aca0f2e1e9714a1d4cda8
  Running setup.py bdist_wheel for backports.ssl-match-hostname ... done
  Stored in directory: /root/.cache/pip/wheels/5d/72/36/b2a31507b613967b728edc33378a5ff2ada0f62855b93c5ae1
  Running setup.py bdist_wheel for functools32 ... done
  Stored in directory: /root/.cache/pip/wheels/3c/d0/09/cd78d0ff4d6cfecfbd730782a7815a4571cd2cd4d2ed6e69d9
Successfully built terminado tornado configparser backports.ssl-match-hostname functools32
Installing collected packages: configparser, entrypoints, enum34, ipython-genutils, traitlets, functools32, jsonschema, jupyter-core, nbformat, pygments, mistune, nbconvert, ptyprocess, backports.ssl-match-hostname, singledispatch, certifi, backports-abc, tornado, terminado, jupyter-client, pathlib2, pickleshare, backports.shutil-get-terminal-size, wcwidth, prompt-toolkit, ipython, ipykernel, notebook, widgetsnbextension, ipywidgets, qtconsole, jupyter-console, jupyter
  Found existing installation: tornado 3.1.1
    DEPRECATION: Uninstalling a distutils installed project (tornado) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling tornado-3.1.1:
      Successfully uninstalled tornado-3.1.1
  Found existing installation: ipython 1.2.1
    DEPRECATION: Uninstalling a distutils installed project (ipython) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling ipython-1.2.1:
      Successfully uninstalled ipython-1.2.1
  Rolling back uninstall of ipython
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 377, in move_wheel_files
    clobber(source, dest, False, fixer=fixer, filter=filter)
  File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 323, in clobber
    shutil.copyfile(srcfile, destfile)
  File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 20] Not a directory: '/usr/local/share/man/man1/ipython.1.gz'
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
mona@pascal:~/computer_vision/imgur$ jupyter notebook
jupyter: 'notebook' is not a Jupyter command
mona@pascal:~/computer_vision/imgur$ jupyter
usage: jupyter [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]
               [--paths] [--json]
               [subcommand]
jupyter: error: one of the arguments --version subcommand --config-dir --data-dir --runtime-dir --paths is required
mona@pascal:~/computer_vision/imgur$ 
    
por Mona Jalal 08.11.2016 / 23:44

1 resposta

4

Instale o Jupyter Notebook no Ubuntu 14.04 → 16.10

A versão padrão do Python no Ubuntu funciona bem, mas o pip precisa ser atualizado para a versão mais recente e, ao instalar o pip, definir a variável de ambiente HOME para o diretório inicial especificado pela entrada do banco de dados de senhas do usuário alvo, usando a opção% código%.

sudo apt-get update
sudo apt-get -y install python-pip python-dev
sudo -H pip install --upgrade pip
sudo apt-get -y install ipython ipython-notebook
sudo -H pip install jupyter

Se você estiver usando o Python 3.x, execute estes comandos:

sudo apt-get update
sudo apt-get -y install python3-pip python3-dev
sudo -H pip3 install --upgrade pip
sudo apt-get -y install ipython3 ipython3-notebook
sudo -H pip3 install jupyter

Para iniciar o Jupyter Notebook, execute o seguinte comando:

jupyter notebook  

Se você também tiver o python-matplotlib instalado, a primeira linha de código para ativar a plotagem no bloco de notas atual é -H

É possível usar o Python 3 no Jupyter Notebook for Python 2 adicionando o kernel do Python 2. Se você estiver executando o Jupyter no Python 3, você pode configurar um kernel do Python 2 como este:

python2 -m pip install ipykernel
python2 -m ipykernel install --user

Instale o Jupyter Notebook no Ubuntu 17.04 e 17.10

No Ubuntu 17.04 e posterior, o Jupyter Notebook está disponível nos repositórios padrão do Ubuntu e pode ser instalado de forma rápida e fácil usando o apt. Abra o terminal e digite:

sudo apt install jupyter-notebook jupyter-core python-ipykernel 

python-ipykernel é necessário para executar programas Python 2.x no Jupyter Notebook, que de outra forma suporta apenas o Python 3.x.

Para iniciar o servidor do notebook, execute o seguinte comando:

jupyter notebook

Você deve ver o Jupyter Notebook aberto no seu navegador da Web.

Instale o Jupyter Notebook no Ubuntu 18.04 e posterior

Abra o terminal e digite:

sudo apt install python3-notebook jupyter-core python-ipykernel  

Para iniciar o servidor do notebook, execute o seguinte comando:

jupyter notebook

Você deve ver o Jupyter Notebook aberto no seu navegador da Web.

    
por karel 08.11.2016 / 23:58