動かざることバグの如し

猫ゆえに。。。

Python(Anaconda)でCythonのインストールにコケる件

環境

症状

pip install cythonでエラーになる

  Found existing installation: bleach 2.0.0
    Uninstalling bleach-2.0.0:
      Successfully uninstalled bleach-2.0.0
  Found existing installation: Cython 0.26.1
    Uninstalling Cython-0.26.1:
Exception:
Traceback (most recent call last):
  File "/anaconda3/lib/python3.6/shutil.py", line 544, in move
    os.rename(src, real_dst)
FileNotFoundError: [Errno 2] No such file or directory: '/anaconda3/lib/python3.6/site-packages/__pycache__/cython.cpython-36.pyc' -> '/var/folders/6z/xq_8ddx97hq9hzlgwzjjdjbw0000gn/T/pip-zvhgvr6a-uninstall/anaconda3/lib/python3.6/site-packages/__pycache__/cython.cpython-36.pyc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/anaconda3/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/anaconda3/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/anaconda3/lib/python3.6/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/anaconda3/lib/python3.6/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/anaconda3/lib/python3.6/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/anaconda3/lib/python3.6/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/anaconda3/lib/python3.6/shutil.py", line 558, in move
    copy_function(src, real_dst)
  File "/anaconda3/lib/python3.6/shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/anaconda3/lib/python3.6/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/anaconda3/lib/python3.6/site-packages/__pycache__/cython.cpython-36.pyc'

とりあえず以下のコマンドを実行

conda install -c anaconda cython

その後に再度pip installするといける。

同じAnacondaでやってるはずなのに上手くいくときもある。なぜだか理由がわからない。。。。

広告を非表示にする