Skip to content

Instantly share code, notes, and snippets.

@mugenen
Created February 1, 2021 14:16
Show Gist options
  • Save mugenen/89f399e2de7c313d490627512b8eb8cf to your computer and use it in GitHub Desktop.
Save mugenen/89f399e2de7c313d490627512b8eb8cf to your computer and use it in GitHub Desktop.
Python 2.7 で pip 21.0 のインストールで失敗する例
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Python 2.7 で pip 21.0 のインストールで失敗する例",
"provenance": [],
"authorship_tag": "ABX9TyNRZz3Qn865J6oZs8CMJH0K",
"include_colab_link": true
},
"kernelspec": {
"name": "python2",
"display_name": "Python 2"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/mugenen/89f399e2de7c313d490627512b8eb8cf/python-2-7-pip-21-0.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "KZvAWTUl5Qa4"
},
"source": [
"pip 21.0 から Python 2 のサポートが失われてエラーになるようになった"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "kaL25GvI36F3",
"outputId": "582235a0-9365-4f28-ab2c-2a19b04fc581"
},
"source": [
"!python --version"
],
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": [
"Python 2.7.17\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "29-SWeMm38FH",
"outputId": "ab9a7edc-a254-432a-852f-577ff2dcbb13"
},
"source": [
"!wget https://bootstrap.pypa.io/get-pip.py"
],
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"text": [
"--2021-02-01 13:56:44-- https://bootstrap.pypa.io/get-pip.py\n",
"Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 151.101.0.175, 151.101.64.175, 151.101.128.175, ...\n",
"Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|151.101.0.175|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 1929903 (1.8M) [text/x-python]\n",
"Saving to: ‘get-pip.py’\n",
"\n",
"get-pip.py 100%[===================>] 1.84M 11.4MB/s in 0.2s \n",
"\n",
"2021-02-01 13:56:45 (11.4 MB/s) - ‘get-pip.py’ saved [1929903/1929903]\n",
"\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "qeMFwxXK4Zwl",
"outputId": "33d72221-2fa3-4550-b45c-05cf508be739"
},
"source": [
"!ls"
],
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"text": [
"get-pip.py sample_data\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "JGUmSuB08wCt"
},
"source": [
"以下のようなエラーが出る"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "znRyyoA94amp",
"outputId": "4d7963a8-969f-492d-9172-3e5216a6f1b8"
},
"source": [
"!python get-pip.py"
],
"execution_count": 5,
"outputs": [
{
"output_type": "stream",
"text": [
"Traceback (most recent call last):\n",
" File \"get-pip.py\", line 24244, in <module>\n",
" main()\n",
" File \"get-pip.py\", line 199, in main\n",
" bootstrap(tmpdir=tmpdir)\n",
" File \"get-pip.py\", line 82, in bootstrap\n",
" from pip._internal.cli.main import main as pip_entry_point\n",
" File \"/tmp/tmpx1IUOs/pip.zip/pip/_internal/cli/main.py\", line 60\n",
" sys.stderr.write(f\"ERROR: {exc}\")\n",
" ^\n",
"SyntaxError: invalid syntax\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "DCdC0R6w5ZGQ"
},
"source": [
"一応古いバージョン向けの pip も残されている"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "8Jnrgejs5ZXR",
"outputId": "097470dc-80ab-461b-c83b-10746bebca61"
},
"source": [
"%%bash\r\n",
"rm get-pip.py\r\n",
"wget https://bootstrap.pypa.io/2.7/get-pip.py"
],
"execution_count": 18,
"outputs": [
{
"output_type": "stream",
"text": [
"--2021-02-01 14:04:28-- https://bootstrap.pypa.io/2.7/get-pip.py\n",
"Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 151.101.0.175, 151.101.64.175, 151.101.128.175, ...\n",
"Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|151.101.0.175|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 1908280 (1.8M) [text/x-python]\n",
"Saving to: ‘get-pip.py’\n",
"\n",
" 0K .......... .......... .......... .......... .......... 2% 3.84M 0s\n",
" 50K .......... .......... .......... .......... .......... 5% 10.1M 0s\n",
" 100K .......... .......... .......... .......... .......... 8% 3.78M 0s\n",
" 150K .......... .......... .......... .......... .......... 10% 5.24M 0s\n",
" 200K .......... .......... .......... .......... .......... 13% 28.6M 0s\n",
" 250K .......... .......... .......... .......... .......... 16% 21.5M 0s\n",
" 300K .......... .......... .......... .......... .......... 18% 28.0M 0s\n",
" 350K .......... .......... .......... .......... .......... 21% 8.60M 0s\n",
" 400K .......... .......... .......... .......... .......... 24% 22.2M 0s\n",
" 450K .......... .......... .......... .......... .......... 26% 50.4M 0s\n",
" 500K .......... .......... .......... .......... .......... 29% 39.4M 0s\n",
" 550K .......... .......... .......... .......... .......... 32% 55.9M 0s\n",
" 600K .......... .......... .......... .......... .......... 34% 26.2M 0s\n",
" 650K .......... .......... .......... .......... .......... 37% 7.81M 0s\n",
" 700K .......... .......... .......... .......... .......... 40% 36.9M 0s\n",
" 750K .......... .......... .......... .......... .......... 42% 24.0M 0s\n",
" 800K .......... .......... .......... .......... .......... 45% 34.2M 0s\n",
" 850K .......... .......... .......... .......... .......... 48% 29.5M 0s\n",
" 900K .......... .......... .......... .......... .......... 50% 31.6M 0s\n",
" 950K .......... .......... .......... .......... .......... 53% 14.0M 0s\n",
" 1000K .......... .......... .......... .......... .......... 56% 26.0M 0s\n",
" 1050K .......... .......... .......... .......... .......... 59% 29.7M 0s\n",
" 1100K .......... .......... .......... .......... .......... 61% 31.4M 0s\n",
" 1150K .......... .......... .......... .......... .......... 64% 25.3M 0s\n",
" 1200K .......... .......... .......... .......... .......... 67% 34.3M 0s\n",
" 1250K .......... .......... .......... .......... .......... 69% 44.9M 0s\n",
" 1300K .......... .......... .......... .......... .......... 72% 10.4M 0s\n",
" 1350K .......... .......... .......... .......... .......... 75% 115M 0s\n",
" 1400K .......... .......... .......... .......... .......... 77% 34.6M 0s\n",
" 1450K .......... .......... .......... .......... .......... 80% 37.9M 0s\n",
" 1500K .......... .......... .......... .......... .......... 83% 22.5M 0s\n",
" 1550K .......... .......... .......... .......... .......... 85% 19.7M 0s\n",
" 1600K .......... .......... .......... .......... .......... 88% 210M 0s\n",
" 1650K .......... .......... .......... .......... .......... 91% 11.2M 0s\n",
" 1700K .......... .......... .......... .......... .......... 93% 132M 0s\n",
" 1750K .......... .......... .......... .......... .......... 96% 26.3M 0s\n",
" 1800K .......... .......... .......... .......... .......... 99% 31.9M 0s\n",
" 1850K .......... ... 100% 272M=0.1s\n",
"\n",
"2021-02-01 14:04:28 (17.1 MB/s) - ‘get-pip.py’ saved [1908280/1908280]\n",
"\n"
],
"name": "stderr"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "-Pv-ZS5R5ivK",
"outputId": "10d740a1-3271-4c37-b82d-2e4c842c3cf6"
},
"source": [
"!ls"
],
"execution_count": 16,
"outputs": [
{
"output_type": "stream",
"text": [
"get-pip.py sample_data\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "HyPxW8bz6PJ3"
},
"source": [
"今度は成功する"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "KA1utZWU5yLT",
"outputId": "5466739c-267a-4fe7-b192-b6dbe1ec2d03"
},
"source": [
"!python get-pip.py"
],
"execution_count": 17,
"outputs": [
{
"output_type": "stream",
"text": [
"Collecting pip<21.0\n",
" Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)\n",
"\u001b[K |████████████████████████████████| 1.5 MB 5.5 MB/s \n",
"\u001b[?25hInstalling collected packages: pip\n",
" Attempting uninstall: pip\n",
" Found existing installation: pip 19.3.1\n",
" Uninstalling pip-19.3.1:\n",
" Successfully uninstalled pip-19.3.1\n",
"Successfully installed pip-20.3.4\n"
],
"name": "stdout"
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment