<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>森羅万象テーブル – Pip</title><link>/blog/tag/pip/</link><description>Recent content in Pip on 森羅万象テーブル</description><generator>Hugo -- gohugo.io</generator><language>ja</language><lastBuildDate>Sat, 13 Feb 2021 15:50:49 +0900</lastBuildDate><atom:link href="/blog/tag/pip/index.xml" rel="self" type="application/rss+xml"/><item><title>Blog: Debian系：pipでuwsgiをインストールする</title><link>/blog/2021/02/13/debian-install-uwsgi-with-pip/</link><pubDate>Sat, 13 Feb 2021 15:50:49 +0900</pubDate><guid>/blog/2021/02/13/debian-install-uwsgi-with-pip/</guid><description>
&lt;h2 id="必要なpackageのインストール">必要なpackageのインストール&lt;/h2>
&lt;h3 id="python2系でuwsgiを使用する場合">Python2系でuwsgiを使用する場合&lt;/h3>
&lt;pre>&lt;code class="language-shell">apt-get install -y gcc python2.7-dev
&lt;/code>&lt;/pre>
&lt;h3 id="python3系でuwsgiを使用する場合">Python3系でuwsgiを使用する場合&lt;/h3>
&lt;pre>&lt;code class="language-shell">apt-get install -y gcc python&lt;span class="marker">3&lt;/span>-dev
&lt;/code>&lt;/pre>
&lt;br>
&lt;h2 id="packageが不足している場合のエラー">packageが不足している場合のエラー&lt;/h2>
&lt;pre>&lt;code class="language-shell">pip install uwsgi
&lt;/code>&lt;/pre>
&lt;pre>&lt;code class="language-shell">Collecting uwsgi
Using cached https://files.pythonhosted.org/packages/a2/c9/a2d5737f63cd9df4317a4acc15d1ddf4952e28398601d8d7d706c16381e0/uwsgi-2.0.17.1.tar.gz
Building wheels for collected packages: uwsgi
Running setup.py bdist_wheel for uwsgi ... error
Complete output from command /usr/local/bin/python -u -c &amp;quot;import setuptools, tokenize;__file__='/tmp/pip-install-lbdb9gq3/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))&amp;quot; bdist_wheel -d /tmp/pip-wheel-tabhcviq --python-tag cp36:
/usr/local/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'descriptions'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build/lib
copying uwsgidecorators.py -&amp;gt; build/lib
installing to build/bdist.linux-x86_64/wheel
running install
using profile: buildconf/default.ini
detected include path: ['/usr/lib/gcc/x86_64-linux-gnu/6/include', '/usr/local/include', '/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed', '/usr/include']
Patching &amp;quot;bin_name&amp;quot; to properly install_scripts dir
detected CPU cores: 4
configured CFLAGS: -O2 -I. -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_TIMER_USE_TIMERFD_NOINC -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY -DUWSGI_VERSION=&amp;quot;\&amp;quot;2.0.17.1\&amp;quot;&amp;quot; -DUWSGI_VERSION_BASE=&amp;quot;2&amp;quot; -DUWSGI_VERSION_MAJOR=&amp;quot;0&amp;quot; -DUWSGI_VERSION_MINOR=&amp;quot;17&amp;quot; -DUWSGI_VERSION_REVISION=&amp;quot;1&amp;quot; -DUWSGI_VERSION_CUSTOM=&amp;quot;\&amp;quot;\&amp;quot;&amp;quot; -DUWSGI_YAML -DUWSGI_PLUGIN_DIR=&amp;quot;\&amp;quot;.\&amp;quot;&amp;quot; -DUWSGI_DECLARE_EMBEDDED_PLUGINS=&amp;quot;UDEP(python);UDEP(gevent);UDEP(ping);UDEP(cache);UDEP(nagios);UDEP(rrdtool);UDEP(carbon);UDEP(rpc);UDEP(corerouter);UDEP(fastrouter);UDEP(http);UDEP(signal);UDEP(syslog);UDEP(rsyslog);UDEP(logsocket);UDEP(router_uwsgi);UDEP(router_redirect);UDEP(router_basicauth);UDEP(zergpool);UDEP(redislog);UDEP(mongodblog);UDEP(router_rewrite);UDEP(router_http);UDEP(logfile);UDEP(router_cache);UDEP(rawrouter);UDEP(router_static);UDEP(sslrouter);UDEP(spooler);UDEP(cheaper_busyness);UDEP(symcall);UDEP(transformation_tofile);UDEP(transformation_gzip);UDEP(transformation_chunked);UDEP(transformation_offload);UDEP(router_memcached);UDEP(router_redis);UDEP(router_hash);UDEP(router_expires);UDEP(router_metrics);UDEP(transformation_template);UDEP(stats_pusher_socket);&amp;quot; -DUWSGI_LOAD_EMBEDDED_PLUGINS=&amp;quot;ULEP(python);ULEP(gevent);ULEP(ping);ULEP(cache);ULEP(nagios);ULEP(rrdtool);ULEP(carbon);ULEP(rpc);ULEP(corerouter);ULEP(fastrouter);ULEP(http);ULEP(signal);ULEP(syslog);ULEP(rsyslog);ULEP(logsocket);ULEP(router_uwsgi);ULEP(router_redirect);ULEP(router_basicauth);ULEP(zergpool);ULEP(redislog);ULEP(mongodblog);ULEP(router_rewrite);ULEP(router_http);ULEP(logfile);ULEP(router_cache);ULEP(rawrouter);ULEP(router_static);ULEP(sslrouter);ULEP(spooler);ULEP(cheaper_busyness);ULEP(symcall);ULEP(transformation_tofile);ULEP(transformation_gzip);ULEP(transformation_chunked);ULEP(transformation_offload);ULEP(router_memcached);ULEP(router_redis);ULEP(router_hash);ULEP(router_expires);ULEP(router_metrics);ULEP(transformation_template);ULEP(stats_pusher_socket);&amp;quot;
*** uWSGI compiling server core ***
[thread 0][gcc -pthread] core/utils.o
[thread 1][gcc -pthread] core/protocol.o
[thread 2][gcc -pthread] core/socket.o
[thread 3][gcc -pthread] core/logging.o
In file included from core/utils.c:1:0:
./uwsgi.h:165:19: fatal error: stdio.h: No such file or directory
#include &amp;lt;stdio.h&amp;gt;
^
In file included from core/protocol.c:1:0:
./uwsgi.h:165:19: fatal error: stdio.h: No such file or directory
#include &amp;lt;stdio.h&amp;gt;
^
compilation terminated.
compilation terminated.
In file included from core/logging.c:2:0:
./uwsgi.h:165:19: fatal error: stdio.h: No such file or directory
#include &amp;lt;stdio.h&amp;gt;
^
compilation terminated.
In file included from core/socket.c:1:0:
./uwsgi.h:165:19: fatal error: stdio.h: No such file or directory
#include &amp;lt;stdio.h&amp;gt;
^
compilation terminated.
----------------------------------------
Failed building wheel for uwsgi
Running setup.py clean for uwsgi
Failed to build uwsgi
Installing collected packages: uwsgi
Running setup.py install for uwsgi ... error
Complete output from command /usr/local/bin/python -u -c &amp;quot;import setuptools, tokenize;__file__='/tmp/pip-install-lbdb9gq3/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))&amp;quot; install --record /tmp/pip-record-rejxmt8l/install-record.txt --single-version-externally-managed --compile:
/usr/local/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'descriptions'
warnings.warn(msg)
running install
using profile: buildconf/default.ini
detected include path: ['/usr/lib/gcc/x86_64-linux-gnu/6/include', '/usr/local/include', '/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed', '/usr/include']
Patching &amp;quot;bin_name&amp;quot; to properly install_scripts dir
detected CPU cores: 4
configured CFLAGS: -O2 -I. -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_TIMER_USE_TIMERFD_NOINC -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY -DUWSGI_VERSION=&amp;quot;\&amp;quot;2.0.17.1\&amp;quot;&amp;quot; -DUWSGI_VERSION_BASE=&amp;quot;2&amp;quot; -DUWSGI_VERSION_MAJOR=&amp;quot;0&amp;quot; -DUWSGI_VERSION_MINOR=&amp;quot;17&amp;quot; -DUWSGI_VERSION_REVISION=&amp;quot;1&amp;quot; -DUWSGI_VERSION_CUSTOM=&amp;quot;\&amp;quot;\&amp;quot;&amp;quot; -DUWSGI_YAML -DUWSGI_PLUGIN_DIR=&amp;quot;\&amp;quot;.\&amp;quot;&amp;quot; -DUWSGI_DECLARE_EMBEDDED_PLUGINS=&amp;quot;UDEP(python);UDEP(gevent);UDEP(ping);UDEP(cache);UDEP(nagios);UDEP(rrdtool);UDEP(carbon);UDEP(rpc);UDEP(corerouter);UDEP(fastrouter);UDEP(http);UDEP(signal);UDEP(syslog);UDEP(rsyslog);UDEP(logsocket);UDEP(router_uwsgi);UDEP(router_redirect);UDEP(router_basicauth);UDEP(zergpool);UDEP(redislog);UDEP(mongodblog);UDEP(router_rewrite);UDEP(router_http);UDEP(logfile);UDEP(router_cache);UDEP(rawrouter);UDEP(router_static);UDEP(sslrouter);UDEP(spooler);UDEP(cheaper_busyness);UDEP(symcall);UDEP(transformation_tofile);UDEP(transformation_gzip);UDEP(transformation_chunked);UDEP(transformation_offload);UDEP(router_memcached);UDEP(router_redis);UDEP(router_hash);UDEP(router_expires);UDEP(router_metrics);UDEP(transformation_template);UDEP(stats_pusher_socket);&amp;quot; -DUWSGI_LOAD_EMBEDDED_PLUGINS=&amp;quot;ULEP(python);ULEP(gevent);ULEP(ping);ULEP(cache);ULEP(nagios);ULEP(rrdtool);ULEP(carbon);ULEP(rpc);ULEP(corerouter);ULEP(fastrouter);ULEP(http);ULEP(signal);ULEP(syslog);ULEP(rsyslog);ULEP(logsocket);ULEP(router_uwsgi);ULEP(router_redirect);ULEP(router_basicauth);ULEP(zergpool);ULEP(redislog);ULEP(mongodblog);ULEP(router_rewrite);ULEP(router_http);ULEP(logfile);ULEP(router_cache);ULEP(rawrouter);ULEP(router_static);ULEP(sslrouter);ULEP(spooler);ULEP(cheaper_busyness);ULEP(symcall);ULEP(transformation_tofile);ULEP(transformation_gzip);ULEP(transformation_chunked);ULEP(transformation_offload);ULEP(router_memcached);ULEP(router_redis);ULEP(router_hash);ULEP(router_expires);ULEP(router_metrics);ULEP(transformation_template);ULEP(stats_pusher_socket);&amp;quot;
*** uWSGI compiling server core ***
[thread 2][gcc -pthread] core/utils.o
[thread 1][gcc -pthread] core/protocol.o
[thread 0][gcc -pthread] core/socket.o
[thread 3][gcc -pthread] core/logging.o
In file included from core/utils.c:1:0:
./uwsgi.h:165:19: fatal error: stdio.h: No such file or directory
#include &amp;lt;stdio.h&amp;gt;
^
compilation terminated.
In file included from core/socket.c:1:0:
./uwsgi.h:165:19: fatal error: stdio.h: No such file or directory
#include &amp;lt;stdio.h&amp;gt;
^
compilation terminated.
In file included from core/logging.c:2:0:
./uwsgi.h:165:19: fatal error: stdio.h: No such file or directory
#include &amp;lt;stdio.h&amp;gt;
^
compilation terminated.
In file included from core/protocol.c:1:0:
./uwsgi.h:165:19: fatal error: stdio.h: No such file or directory
#include &amp;lt;stdio.h&amp;gt;
^
compilation terminated.
----------------------------------------
Command &amp;quot;/usr/local/bin/python -u -c &amp;quot;import setuptools, tokenize;__file__='/tmp/pip-install-lbdb9gq3/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))&amp;quot; install --record /tmp/pip-record-rejxmt8l/install-record.txt --single-version-externally-managed --compile&amp;quot; failed with error code 1 in /tmp/pip-install-lbdb9gq3/uwsgi/
&lt;/code>&lt;/pre></description></item><item><title>Blog: Linux：最新のpipをインストールする</title><link>/blog/2020/09/05/linux-get-latest-pip/</link><pubDate>Sat, 05 Sep 2020 05:29:09 +0900</pubDate><guid>/blog/2020/09/05/linux-get-latest-pip/</guid><description>
&lt;h2 id="pip-がインストールされていない場合">pip がインストールされていない場合&lt;/h2>
&lt;pre>&lt;code class="language-shell">curl https://bootstrap.pypa.io/get-pip.py | sudo python
&lt;/code>&lt;/pre>
&lt;br>
&lt;h2 id="pip-がインストールされている場合">pip がインストールされている場合&lt;/h2>
&lt;pre>&lt;code class="language-shell">pip install -U pip
&lt;/code>&lt;/pre>
&lt;ul>
&lt;li>Python2系
&lt;ul>
&lt;li>Python 2.7.9 以降&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>Python3系
&lt;ul>
&lt;li>Python 3.4 以降&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;p>であれば、&lt;code>pip&lt;/code> がインストールされているため、上記のコマンドで最新 version へ更新可能&lt;/p></description></item><item><title>Blog: ModuleNotFoundError: No module named 'pip'</title><link>/blog/2020/08/15/python-module-not-found-error-nomodule-named-pip/</link><pubDate>Sat, 15 Aug 2020 03:45:15 +0900</pubDate><guid>/blog/2020/08/15/python-module-not-found-error-nomodule-named-pip/</guid><description>
&lt;h2 id="事象">事象&lt;/h2>
&lt;p>pipコマンド実行時に以下のようなエラーが発生&lt;/p>
&lt;pre>&lt;code class="language-shell">pip freeze
&lt;/code>&lt;/pre>
&lt;pre>&lt;code>Traceback (most recent call last):
File &amp;quot;/usr/local/bin/pip&amp;quot;, line 5, in &amp;lt;module&amp;gt;
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'
&lt;/code>&lt;/pre>
&lt;br>
&lt;h2 id="原因">原因&lt;/h2>
&lt;p>インストールされているpipのversionが古いため&lt;/p>
&lt;br>
&lt;h2 id="対策">対策&lt;/h2>
&lt;p>以下のコマンドで最新のpipを取得する&lt;/p>
&lt;pre>&lt;code class="language-shell">curl https://bootstrap.pypa.io/get-pip.py | sudo python
&lt;/code>&lt;/pre></description></item><item><title>Blog: Nexus：SSLHandshakeException: Received fatal alert: handshake_failure</title><link>/blog/2019/10/16/nexus-ssl-handshake-exception/</link><pubDate>Wed, 16 Oct 2019 20:33:00 +0900</pubDate><guid>/blog/2019/10/16/nexus-ssl-handshake-exception/</guid><description>
&lt;h2 id="事象">事象&lt;/h2>
&lt;p>pipでNexusのpypi proxy repositoryにアクセスしようとするとNexusで以下のようなエラーが発生した&lt;/p>
&lt;pre>&lt;code>2018-05-25 22:53:18,046+0900 WARN [qtp182819794-162] *UNKNOWN org.sonatype.nexus.repository.pypi.internal.PyPiProxyFacetImpl - Exception javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure checking remote for update, proxy repo pypi-central failed to fetch packages/7f/e1/820d941153923aac1d49d7fc37e17b6e73bfbd2904959fffbad77900cf92/setuptools-39.2.0-py2.py3-none-any.whl, content not in cache.
&lt;/code>&lt;/pre>
&lt;br>
&lt;h2 id="原因">原因&lt;/h2>
&lt;p>Subject Alt Nameが正しくないサーバー証明書を使用しているNexusからのアクセスをpypiが弾いたと思われる&lt;/p>
&lt;br>
&lt;h2 id="対策">対策&lt;/h2>
&lt;ul>
&lt;li>自己署名証明書を使用しているNexusでpypiのproxy repositoryを使用しない&lt;/li>
&lt;li>Nexusはprivate repositoryのみの運用とする&lt;/li>
&lt;li>pip.confのtrusted-hostにNexusを設定する&lt;/li>
&lt;li>pip.confのextra-index-urlにNexusを設定する&lt;/li>
&lt;/ul>
&lt;p>pip.conf設定例&lt;/p>
&lt;pre>&lt;code>[global]
trusted-host = &lt;span class="marker">Nexusのhost名&lt;/span>
extra-index-url = http://&lt;span class="marker">Nexusのhost名&lt;/span>
&lt;/code>&lt;/pre></description></item><item><title>Blog: Nexusでプライベートなpypiリポジトリを作成する</title><link>/blog/2019/10/14/create-private-pypi-repository/</link><pubDate>Mon, 14 Oct 2019 20:58:49 +0900</pubDate><guid>/blog/2019/10/14/create-private-pypi-repository/</guid><description>
&lt;h2 id="事前に必要な手順">事前に必要な手順&lt;/h2>
&lt;p>&lt;a href="https://www.tssol.net/blog/2019/10/13/install-nexus/">Nexusをインストールする&lt;/a>&lt;/p>
&lt;p>&lt;a href="https://www.tssol.net/blog/2019/10/15/nexus-enable-https/">NexusをHTTPS化する&lt;/a>&lt;/p>
&lt;br>
&lt;h2 id="pypiリポジトリの作成">pypiリポジトリの作成&lt;/h2>
&lt;h3 id="リポジトリ作成画面へ遷移">リポジトリ作成画面へ遷移&lt;/h3>
&lt;br>
&lt;h3 id="proxy-repositoryを作成">Proxy repositoryを作成&lt;/h3>
&lt;p>以下の手順で &lt;a href="https://pypi.python.org/">https://pypi.python.org/&lt;/a> をキャッシュするリポジトリの作成を行う&lt;/p>
&lt;h4 id="pypiproxyを選択">pypi(proxy)を選択&lt;/h4>
&lt;p>&lt;img src="https://www.tssol.net/media/5_04.png" alt="">&lt;/p>
&lt;br>
&lt;h4 id="proxy-repositoryの各項目を設定">Proxy repositoryの各項目を設定&lt;/h4>
&lt;ul>
&lt;li>Online：チェックを入れる&lt;/li>
&lt;li>Proxy
&lt;ul>
&lt;li>Remote storage：https://pypi.python.org/&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;p>その他の項目は任意で設定する
&lt;img src="https://www.tssol.net/media/5_07.png" alt="">&lt;/p>
&lt;h3 id="hosted-repositoryを作成">Hosted repositoryを作成&lt;/h3>
&lt;p>以下の手順でプライベートリポジトリの作成を行う&lt;/p>
&lt;h4 id="pypihostedを選択">pypi(hosted)を選択&lt;/h4>
&lt;p>&lt;img src="https://www.tssol.net/media/5_05.png" alt="">&lt;/p>
&lt;br>
&lt;h4 id="hosted-repositoryの各項目を設定">Hosted repositoryの各項目を設定&lt;/h4>
&lt;ul>
&lt;li>Online：チェックを入れる&lt;/li>
&lt;li>Hosted
&lt;ul>
&lt;li>Deployment policy
&lt;ul>
&lt;li>Disable redeploy：一度リポジトリに登録したpackageの再登録をさせない&lt;/li>
&lt;li>Allow redeploy：一度リポジトリに登録したpackageの再登録をさせる&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;p>その他の項目は任意で設定する
&lt;img src="https://www.tssol.net/media/5_08.png" alt="">&lt;/p>
&lt;br>
&lt;h3 id="group-repositoryを作成">Group repositoryを作成&lt;/h3>
&lt;p>以下の手順で Proxy repository と Hosted repository を&lt;br>
一つのアクセス先にまとめるリポジトリの作成を行う&lt;/p>
&lt;h4 id="pypigroupを選択">pypi(group)を選択&lt;/h4>
&lt;p>&lt;img src="https://www.tssol.net/media/5_06.png" alt="">&lt;/p>
&lt;br>
&lt;h4 id="group-repositoryの各項目を設定">Group repositoryの各項目を設定&lt;/h4>
&lt;p>上記で作成した2つのリポジトリをMembersに設定する&lt;br>
その他の項目は任意で設定する
&lt;img src="https://www.tssol.net/media/5_09.png" alt="">&lt;/p>
&lt;br>
&lt;h2 id="pipからnexus上のpypiリポジトリへのアクセス方法">pipからNexus上のpypiリポジトリへのアクセス方法&lt;/h2>
&lt;p>Nexus上のリポジトリを参照したいクライアントは、以下のようにpip用設定ファイル作成する&lt;/p>
&lt;h3 id="linux">Linux&lt;/h3>
&lt;h4 id="homeconfigpippipconf">$HOME/.config/pip/pip.conf&lt;/h4>
&lt;h3 id="windows">Windows&lt;/h3>
&lt;h4 id="homedrivehomepathpippipini">%HOMEDRIVE%%HOMEPATH%\pip\pip.ini&lt;/h4>
&lt;p>※ファイルの内容はLinuxと同様&lt;/p></description></item></channel></rss>