1

I am using anaconda. I have used a code to display graph (just copied the code) and am trying to make it run on my machine. I have installed the pydot class using:

pip install pydot

but I get the following error

  File "C:/Users/ASMGX/Desktop/Python/untitled0.py", line 33, in <module>
    import pydot

ModuleNotFoundError: No module named 'pydot'

So I tried re-installing using conda

conda install -c https://conda.binstar.org/sstromberg pydot

Still I get the same error? What is that I am doing wrong?

Sheldore
  • 37,862
  • 7
  • 57
  • 71
asmgx
  • 7,328
  • 15
  • 82
  • 143

1 Answers1

1

If you are using Anaconda you can just install the pydot package trough the Anaconda navigator.

If you then also run your IDE / notebook from Anaconda from the same environment you are sure you are using the same environment to run the script as for which you installed pydot.

I expect Python still can't find the package because it is installed in a environment different from the one you are running the script in.

Gijs Jansen
  • 40
  • 10
  • may you please explain – asmgx Aug 24 '18 at 12:59
  • You can have multiple environments for python and each environment has its own installed packages. So if you install a package from the command line you will only install it in the environment currently being active. 1. Open Anaconda Navigator 2. Choose environments 3. Choose your preferred environment from left sidebar 4. In the main window at the top, from the dropdown select 'Not installed'. 5. In the search bar enter 'pydot' 6. Check the checkbox next to pydot – Gijs Jansen Aug 24 '18 at 13:01
  • i did open the navigator – asmgx Aug 24 '18 at 13:02
  • 7. Choose apply in the bottom right corner. 8. Let it install 9. Now go back to home in the left sidebar and make sure you are in the same environment as where you installed pydot. 10. Run VS Code and run your script. It should work now. – Gijs Jansen Aug 24 '18 at 13:06
  • There is pydot-ng and pydotplus only – asmgx Aug 24 '18 at 13:27
  • Then probably it is already installed anyways... Can you check if it is in the list when you select 'Installed' from the dropdown? – Gijs Jansen Aug 24 '18 at 13:28
  • If it is in the list you only need to make sure you are running the script from the same environment as where pydot is installed. – Gijs Jansen Aug 24 '18 at 14:03