LoginSignup
0
2

More than 5 years have passed since last update.

pip install nkf できない時の対処法

Last updated at Posted at 2018-11-27

前提

  • Amazon Linux
  • python 3.6.2 を pyenv でインストール済み

問題

下記をインストールしたい

pip install nkf すればよいはずだが、下記のエラーが出る。

(venv) [ec2-user@ip-172-55-55-55 tmp.szI1BtAgOR]$ pip install nkf
Collecting nkf
  Cache entry deserialization failed, entry ignored
  Could not find a version that satisfies the requirement nkf (from versions: )
No matching distribution found for nkf

pip install git+https://github.com/fumiyas/python-nkf@0.2.0#egg=nkf だと、インストールできる。

原因

  • pip には tar.bz2 形式でアップロードされている
  • インストールしようとしたサーバには、Python が bz2 付きでコンパイルされていない(多分)

pip -vvv 付けたら分かった。

(venv) [ec2-user@ip-172-31-30-66 tmp.szI1BtAgOR]$ pip -vvv install nkf
Collecting nkf
  1 location(s) to search for versions of nkf:
  * https://pypi.python.org/simple/nkf/
  Getting page https://pypi.python.org/simple/nkf/
  Looking up "https://pypi.python.org/simple/nkf/" in the cache
  Returning cached "301 Moved Permanently" response (ignoring date and etag information)
  Looking up "https://pypi.org/simple/nkf/" in the cache
  Current age based on date: 6
  Freshness lifetime from max-age: 600
  Freshness lifetime from request max-age: 600
  The response is "fresh", returning cached response
  600 > 6
  Analyzing links from page https://pypi.org/simple/nkf/
    Skipping link https://files.pythonhosted.org/packages/58/aa/cbec9e1b1dd671ba989ff21eafe62e0269262370a38ddda602cde1f4a1f7/nkf-0.1.0.tar.bz2#sha256=68fef7af7b261a006950686c2e77e7da4259f09370a3d90dec35cbee36e
c7840 (from https://pypi.org/simple/nkf/); unsupported archive format: .tar.bz2
    Skipping link https://files.pythonhosted.org/packages/50/00/69fb6fb43f1074b15452cc017f211868b00777d0ec416526077b2c7cf494/nkf-0.1.1.tar.bz2#sha256=92f727da7a6ecc8b1c8511a00ba914a03c47203adb5ad378a99d3ad20e1
6d87b (from https://pypi.org/simple/nkf/); unsupported archive format: .tar.bz2
    Skipping link https://files.pythonhosted.org/packages/e2/fd/45d9efd643a47e135231106469a164abce83e39b2a2a4995aeeb5f44b305/nkf-0.2.0.tar.bz2#sha256=7053320c153374d2a9d800ee06c3b37ba39bad0e1ae0e97ee2d945a7f68
a96d7 (from https://pypi.org/simple/nkf/); unsupported archive format: .tar.bz2
  Could not find a version that satisfies the requirement nkf (from versions: )
Cleaning up...
No matching distribution found for nkf
Exception information:
Traceback (most recent call last):
  File "/tmp/tmp.szI1BtAgOR/venv/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/tmp/tmp.szI1BtAgOR/venv/lib/python3.6/site-packages/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/tmp/tmp.szI1BtAgOR/venv/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/tmp/tmp.szI1BtAgOR/venv/lib/python3.6/site-packages/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/tmp/tmp.szI1BtAgOR/venv/lib/python3.6/site-packages/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/tmp/tmp.szI1BtAgOR/venv/lib/python3.6/site-packages/pip/index.py", line 514, in find_requirement
    'No matching distribution found for %s' % req
pip.exceptions.DistributionNotFound: No matching distribution found for nkf

解決策

pyenv に bz2 付でコンパイルしてもらえば良い。

yum install bzip2-devel

してから

pyenv install 3.6.2

したら、いけた。

参考

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2