pythonパッケージをオフラインでインストールしたいと考えています。そうするために、私はピップインストールで - cache-dirを一度オンラインで収集し、次回はオフラインで同じ方法でピップが常にキャッシュを読み込むことを期待します。キャッシュからのピップインストールがネットワークがないときに失敗することがある
初めて:オンライン(空のキャッシュ、空のvirtualenvの):
~/tmp/venv$ LANG=C pip install --cache-dir /tmp/pipcache matplotlib
Collecting matplotlib
Downloading matplotlib-2.0.2-cp27-cp27mu-manylinux1_x86_64.whl (14.5MB)
100% |################################| 14.5MB 99kB/s
Collecting numpy>=1.7.1 (from matplotlib)
Downloading numpy-1.13.0-cp27-cp27mu-manylinux1_x86_64.whl (16.6MB)
100% |################################| 16.6MB 86kB/s
Collecting cycler>=0.10 (from matplotlib)
Downloading cycler-0.10.0-py2.py3-none-any.whl
Collecting python-dateutil (from matplotlib)
Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
100% |################################| 194kB 5.8MB/s
Collecting functools32 (from matplotlib)
Downloading functools32-3.2.3-2.zip
Collecting six>=1.10 (from matplotlib)
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting pytz (from matplotlib)
Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
100% |################################| 491kB 3.1MB/s
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 (from matplotlib)
Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
100% |################################| 61kB 8.8MB/s
Collecting subprocess32 (from matplotlib)
Downloading subprocess32-3.2.7.tar.gz (54kB)
100% |################################| 61kB 8.4MB/s
Building wheels for collected packages: functools32, subprocess32
Running setup.py bdist_wheel for functools32 ... done
Stored in directory: /tmp/pipcache/wheels/3c/d0/09/cd78d0ff4d6cfecfbd730782a7815a4571cd2cd4d2ed6e69d9
Running setup.py bdist_wheel for subprocess32 ... done
Stored in directory: /tmp/pipcache/wheels/7d/4c/a4/ce9ceb463dae01f4b95e670abd9afc8d65a45f38012f8030cc
Successfully built functools32 subprocess32
Installing collected packages: numpy, six, cycler, python-dateutil, functools32, pytz, pyparsing, subprocess32, matplotlib
Successfully installed cycler-0.10.0 functools32-3.2.3.post2 matplotlib-2.0.2 numpy-1.13.0 pyparsing-2.2.0 python-dateutil-2.6.0 pytz-2017.2 six-1.10.0 subprocess32-3.2.7
セカンド時間:オフライン(キャッシュを再利用し、空のvirtualenvのを再作成)、すべてがOKです:
~/tmp/venv$ LANG=C pip install --cache-dir /tmp/pipcache matplotlib
Collecting matplotlib
Using cached matplotlib-2.0.2-cp27-cp27mu-manylinux1_x86_64.whl
Collecting numpy>=1.7.1 (from matplotlib)
Using cached numpy-1.13.0-cp27-cp27mu-manylinux1_x86_64.whl
Collecting cycler>=0.10 (from matplotlib)
Using cached cycler-0.10.0-py2.py3-none-any.whl
Collecting python-dateutil (from matplotlib)
Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting functools32 (from matplotlib)
Collecting six>=1.10 (from matplotlib)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting pytz (from matplotlib)
Using cached pytz-2017.2-py2.py3-none-any.whl
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 (from matplotlib)
Using cached pyparsing-2.2.0-py2.py3-none-any.whl
Collecting subprocess32 (from matplotlib)
Installing collected packages: numpy, six, cycler, python-dateutil, functools32, pytz, pyparsing, subprocess32, matplotlib
Successfully installed cycler-0.10.0 functools32-3.2.3.post2 matplotlib-2.0.2 numpy-1.13.0 pyparsing-2.2.0 python-dateutil-2.6.0 pytz-2017.2 six-1.10.0 subprocess32-3.2.7
3回目:オフライン(キャッシュの再利用、空のvirtualenvの再作成):いくつかのエラー:
~/tmp/venv$ LANG=C pip install --cache-dir /tmp/pipcache matplotlib
Collecting matplotlib
Using cached matplotlib-2.0.2-cp27-cp27mu-manylinux1_x86_64.whl
Collecting numpy>=1.7.1 (from matplotlib)
Using cached numpy-1.13.0-cp27-cp27mu-manylinux1_x86_64.whl
Collecting cycler>=0.10 (from matplotlib)
Using cached cycler-0.10.0-py2.py3-none-any.whl
Collecting python-dateutil (from matplotlib)
Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting functools32 (from matplotlib)
Collecting six>=1.10 (from matplotlib)
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f7abfbdbfd0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/six/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f7abfbdb490>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/six/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f7abfbdbf50>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/six/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f7ac1068ed0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/six/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f7ac1068910>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/six/
Could not find a version that satisfies the requirement six>=1.10 (from matplotlib) (from versions:)
No matching distribution found for six>=1.10 (from matplotlib)
ar eネットワークエラー:すべてのパッケージがキャッシュ内で利用可能であるため、その理由がわかりません。さらに、エラーはランダムです:6つまたはpytzパッケージをインストールするときに発生する可能性があります。場合によっては上記のことが起こることがありますが、エラーが発生しないことがあります。
これを修正して、オフラインインストールができますか?
注:ピップとsetuptoolsのは
https://stackoverflow.com/questions/4806448/how-do-i-install-from-a-local-cache-によると、 with-pipでは、キャッシュがデフォルトでオンになっているので、--cache-dirオプションは必要ありません。 –