7

I execute the code following on my machine( Win10, python 2.7, Anaconda&Spyder) and meet ImportError: No module named pydotplus .

import networkx as nx
from networkx.drawing.nx_pydot import write_dot
G = nx.DiGraph([(1,2),(2,3),(3,2)])
write_dot(G,'file.dot')

It clearly that I should install pydotplus package. I try to conda install pydotplus directly but says Error: Package missing in current win-64 channels. Then, I google it but find there is no information about how to install it on conda. By the way, I have install pydot on conda before.

Thanks for you help in advance!

Guillaume Jacquenot
  • 11,217
  • 6
  • 43
  • 49
Chen Xu
  • 342
  • 1
  • 4
  • 14

4 Answers4

18
  • Using conda install command below worked for me (globally installed):

conda install -c conda-forge pydotplus

  • Using Anaconda environments (per environment instance) you can install pydotplus using pip:

pip install pydotplus

I would personally recommend using the Anaconda environments to install your packages for a given solution as its a more modular and cleaner way of building solutions with Anaconda.

Installing via Anaconda environments referenced from answer on Quora, see: https://www.quora.com/How-do-I-install-Python-packages-in-Anaconda

Kevin Crain
  • 1,905
  • 1
  • 19
  • 28
6

I tried conda install pydotplus, but it failed.

Then tried python -m pip install pydotplus and it worked.

iled
  • 2,142
  • 3
  • 31
  • 43
Matiji66
  • 709
  • 7
  • 14
1

Try

pip install pydotplus

if it isn't part of the conda universe.

Aric
  • 24,511
  • 5
  • 78
  • 77
1

Open Anaconda prompt:

pip install pydotplus
Ayush Kesarwani
  • 518
  • 6
  • 18