LoginSignup
2
2

More than 5 years have passed since last update.

PyCharmでpipenvを使うと挙動がおかしいときの対処法

Last updated at Posted at 2019-01-04

発生した問題

  • PyCharmでProject Interpreterをpipenvに設定したとき、PreferenceからパッケージをインストールするとJSON.Decode.Errorが発生する。(インストールやPipfileの書き換えは成功している)
  • Preferenceにインストール済みのパッケージ一覧が表示されない。

そこから調査を開始して

  • pipenv graphが表示されずTypeError: 'module' object is not callableが発生
  • pipenvでパッケージのインストールやアンインストールをするとTypeError: 'module' object is not callableが発生(インストール・アンインストールやPipfileの書き換えは成功している)

使用環境

  • macOS Mojave
  • PyCharm 2018.3.2
  • Python 3.6.5(pyenv)
  • pip 18.0
  • pipenv 2018.7.1

解決方法

結論から言うと、pipenvによる仮想環境内部のpipのバージョンが18.1になっていたことが原因でした。
pipenv run pip install pip==18.0すればOK。

先にpipenv run pip --versionしてpipenv仮想環境内のpipのバージョンを確認しましょう。
同様のエラーは多くの人のところで発生していたようで、こちらのissueでも取り上げられています。

PyCharmの表示もこれで解消されます。

参考

Running pipenv gives TypeError: 'module' object is not callable #2871
URL:https://github.com/pypa/pipenv/issues/2871

pip 18.1 causes "TypeError: 'module' object is not callable" #2924
URL:https://github.com/pypa/pipenv/issues/2924

2
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
2
2