2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【メモ】matplotlibとzstdのコンフリクト

Last updated at Posted at 2021-01-20

何気にハマったので、メモ。
ただし、この方法がベストなのかは不明。

環境

  • Windows10 Pro 64bit
  • Anaconda

現象

  • zstdが見つからない
    • zstdはcondaでmatplotlibをインストールしたときに、一緒にインストールされる
ModuleNotFoundError: No module named 'zstd'

確認作業

1.手動でzstdをアンイストール/インストール

(hogehoge) C:\test> conda uninstall zstd
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\hoge\Anaconda3\envs\hogehoge

  removed specs:
    - zstd


The following packages will be REMOVED:

  cycler-0.10.0-py37_0
  freetype-2.10.4-hd328e21_0
  kiwisolver-1.3.0-py37hd77b12b_0
  libtiff-4.1.0-h56a325e_1
  lz4-c-1.9.2-hf4a77e7_3
  matplotlib-3.3.2-haa95532_0
  matplotlib-base-3.3.2-py37hba9282a_0
  olefile-0.46-py37_0
  pillow-8.1.0-py37h4fa10fc_0
  tk-8.6.10-he774522_0
  xz-5.2.5-h62dcd97_0
  zstd-1.4.5-h04227a9_0


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(hogehoge) C:\test> conda install zstd
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\hoge\Anaconda3\envs\hogehoge

  added / updated specs:
    - zstd


The following NEW packages will be INSTALLED:

  lz4-c              pkgs/main/win-64::lz4-c-1.9.2-hf4a77e7_3
  xz                 pkgs/main/win-64::xz-5.2.5-h62dcd97_0
  zstd               pkgs/main/win-64::zstd-1.4.5-h04227a9_0


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(hogehoge) C:\test>
  • matplotlibが見つからなくなる
    • zstdをアンインストール時、matplotlibもアンインストールされるため
    • なのにzstdをインストールするときには、matplotlibはインストールされない
ModuleNotFoundError: No module named 'matplotlib'

2.上記の状態で、matplotlibをインストール

(hogegohe) C:\test> conda install matplotlib
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\hoge\Anaconda3\envs\hogehoge

  added / updated specs:
    - matplotlib


The following NEW packages will be INSTALLED:

  cycler             pkgs/main/win-64::cycler-0.10.0-py37_0
  freetype           pkgs/main/win-64::freetype-2.10.4-hd328e21_0
  kiwisolver         pkgs/main/win-64::kiwisolver-1.3.0-py37hd77b12b_0
  libtiff            pkgs/main/win-64::libtiff-4.1.0-h56a325e_1
  matplotlib         pkgs/main/win-64::matplotlib-3.3.2-haa95532_0
  matplotlib-base    pkgs/main/win-64::matplotlib-base-3.3.2-py37hba9282a_0
  olefile            pkgs/main/win-64::olefile-0.46-py37_0
  pillow             pkgs/main/win-64::pillow-8.1.0-py37h4fa10fc_0
  tk                 pkgs/main/win-64::tk-8.6.10-he774522_0


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(hogegohe) C:\test>
  • zstdが見つからなくなる
    • matplotlibのインストール時には、zstdは変更されないのに(既にインストール済みなので)
ModuleNotFoundError: No module named 'zstd'

解決方法

  • condaではなくpipでインストールする
(hogehoge) C:\test>conda uninstall matplotlib zstd
(省略)

(hogehoge) C:\test>pip install matplotlib zstd
Collecting matplotlib
  Using cached matplotlib-3.3.3-cp37-cp37m-win_amd64.whl (8.5 MB)
Requirement already satisfied: cycler>=0.10 in c:\users\mine\anaconda3\envs\r-ccs\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: python-dateutil>=2.1 in c:\users\mine\anaconda3\envs\r-ccs\lib\site-packages (from matplotlib) (2.8.1)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\mine\anaconda3\envs\r-ccs\lib\site-packages (from matplotlib) (1.3.1)
Requirement already satisfied: numpy>=1.15 in c:\users\mine\anaconda3\envs\r-ccs\lib\site-packages (from matplotlib) (1.19.2)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in c:\users\mine\anaconda3\envs\r-ccs\lib\site-packages (from matplotlib) (2.4.7)
Requirement already satisfied: six in c:\users\mine\anaconda3\envs\r-ccs\lib\site-packages (from cycler>=0.10->matplotlib) (1.15.0)
Collecting pillow>=6.2.0
  Using cached Pillow-8.1.0-cp37-cp37m-win_amd64.whl (2.2 MB)
Collecting zstd
  Using cached zstd-1.4.8.1-cp37-cp37m-win_amd64.whl
Installing collected packages: pillow, zstd, matplotlib
Successfully installed matplotlib-3.3.3 pillow-8.1.0 zstd-1.4.8.1

(hogehoge) C:\test>

注意

  • 一緒にアンインストールされてしまったcyclerとkiwisolverは、pipではなくcondaでインストールする
    • pipでインストールすると見つからなくなる
    • 他にもアンインストールされているモジュールがあるので、condaでインストールが必要になるかも
(hogehoge) C:\test>conda install cycler kiwisolver
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\hoge\Anaconda3\envs\hogehoge

  added / updated specs:
    - cycler
    - kiwisolver


The following NEW packages will be INSTALLED:

  cycler             pkgs/main/win-64::cycler-0.10.0-py37_0
  kiwisolver         pkgs/main/win-64::kiwisolver-1.3.0-py37hd77b12b_0


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(hogehoge) C:\test>
2
0
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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?