Missing `graphviz` - please run `conda install fastbook`

I am on amazon aws. I cant get past

NameError Traceback (most recent call last)
in
4 #alt Pipeline inputs, program, results
5 gv(’’‘program[shape=box3d width=1 height=0.7]
----> 6 inputs->program->results’’’)

~/anaconda3/envs/python3/lib/python3.6/site-packages/fastbook/init.py in gv(s)
42 if IN_COLAB: return setup_colab()
43
—> 44 def gv(s): return graphviz.Source(‘digraph G{ rankdir=“LR”’ + s + ‘; }’)
45
46 def get_image_files_sorted(path, recurse=True, folders=None):

NameError: name ‘graphviz’ is not defined

How does one remove and reinstall conda environment?

sh-4.2$ conda env list

conda environments:

base /home/ec2-user/anaconda3
JupyterSystemEnv * /home/ec2-user/anaconda3/envs/JupyterSystemEnv
R /home/ec2-user/anaconda3/envs/R
amazonei_mxnet_p27 /home/ec2-user/anaconda3/envs/amazonei_mxnet_p27
amazonei_mxnet_p36 /home/ec2-user/anaconda3/envs/amazonei_mxnet_p36
amazonei_tensorflow2_p27 /home/ec2-user/anaconda3/envs/amazonei_tensorflow2_p27
amazonei_tensorflow2_p36 /home/ec2-user/anaconda3/envs/amazonei_tensorflow2_p36
amazonei_tensorflow_p27 /home/ec2-user/anaconda3/envs/amazonei_tensorflow_p27
amazonei_tensorflow_p36 /home/ec2-user/anaconda3/envs/amazonei_tensorflow_p36
chainer_p27 /home/ec2-user/anaconda3/envs/chainer_p27
chainer_p36 /home/ec2-user/anaconda3/envs/chainer_p36
mxnet_p27 /home/ec2-user/anaconda3/envs/mxnet_p27
mxnet_p36 /home/ec2-user/anaconda3/envs/mxnet_p36
python2 /home/ec2-user/anaconda3/envs/python2
python3 /home/ec2-user/anaconda3/envs/python3
pytorch_latest_p36 /home/ec2-user/anaconda3/envs/pytorch_latest_p36
pytorch_p27 /home/ec2-user/anaconda3/envs/pytorch_p27
pytorch_p36 /home/ec2-user/anaconda3/envs/pytorch_p36
tensorflow2_p36 /home/ec2-user/anaconda3/envs/tensorflow2_p36
tensorflow_p27 /home/ec2-user/anaconda3/envs/tensorflow_p27
tensorflow_p36 /home/ec2-user/anaconda3/envs/tensorflow_p36

try running

conda install python-graphviz

2 Likes

No, That does not make a difference, I’m afraid.

Hi there. I’m having the same issue trying to run the first notebooks from my Ubuntu machine at home. But with me, it seems a little bit more awkward. When I try to instal through conda, I receive the message bellow:

Package python conflicts for:
defaults|defaults/linux-64::python==3.7.9=h7579374_0
defaults/linux-64::python==3.7.9=h7579374_0The following specifications were found to be incompatible with your system:

  • feature:/linux-64::__cuda==10.2=0

Your installed version is: 10.2

But my installed version of Cuda is 10.1.
$ nvcc --version
nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

$ conda list | grep cud
cudatoolkit 10.1.243 h6bb024c_0 anaconda
cudnn 7.6.5 cuda10.1_0 anaconda
pytorch 1.6.0 py3.7_cuda10.1.243_cudnn7.6.3_0 pytorch

I followed the step suggested by yelwinsoe, it has been installed, but makes no difference at all. Then, I followed the steps suggested by heraldb and found the same problem: when I run from the notebook the pip install comand and try to import fastbook, I get the message that graphviz is missing. Tried also conda install python-graphs, as long as conda install -c conda-forge python-graphviz and conda install -c anaconda graphviz. To all of these commands I get the same cuda error.

Can anyone give a hand? Thanks a lot.

I can second this fix. Works for me now. Running Ubuntu 18.04.

This worked for me in AzureML. Thank you.

1 Like

Had the same problem after using the guide for Google Cloud https://course.fast.ai/start_gcp

The above solution by @heraldb didn’t work for me as it tried to downgrade to fastai 1.0 for me.

I ended up making it work by creating a new conda environment using fastbook’s environment.yml and then setting jupyter to use that environment. Steps I took:

cd ~/fastbook
conda env create --file environment.yml
conda activate fastbook
python -m ipykernel install --user --name=fastbook
pip install -Uqq fastbook

Then in Google Cloud I clicked on the + in the top right, opened a new Launcher, and selected the “fastbook” Notebook. Everything worked once I was running notebooks through this environment.

Make sure the top right “Kernel” selection says fastbook like in the screenshot:

3 Likes

I had this issue, you need to run conda install -c fastai fastbook and conda will find/install the packages which includes graphviz.

2 Likes

Anyone using GCP have a solution? I can’t seem to get graphviz to load?

This worked, running this in the notebook pip install graphviz. Thanks to @immarried post here Seeking help - No module named 'graphviz'

1 Like

Thanks - pip install graphviz worked for GCP

Run this jupyter cell:

!pip install -Uqq fastbook
!pip install --user graphviz

This worked for me (and I think it was has worked for most in this thread).

Thanks a lot. Installing graphviz using ‘conda install python-graphviz’ worked on my mac.

Had a similar issue. The cuda version you externally installed is not required/doesn’t matter. check the version of cudatoolkit (conda list cudatoolkit). This will get you 10.2 I think.

Looks like you have a cuda mismatch with pytorch and/or python.

Remove pytorch cuda and torchvision and reinstall it together as shown below:

conda remove pytorch torchvision cudatoolkit

conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1.168 -c pytorch

For fast ai2, based on my NVIDIA driver (430) I chose the cuda 10.1, I needed based on table 1.

Does this help?

P.S
I didn’t need to install cuda externally. pytorch “gets compiled” and delivered with it’s own CUDA via conda (look for cudatoolkit)

conda install graphviz also is enough and only modifies your current environment in which you are using it.

it does work thanks

conda install python-graphviz worked for me.

pip install graphviz Works for me.

1 Like

I did essentially what @heraldb recommended, but here are the conda commands (I was less familiar with Conda so had to look this up. BTW, this GCP with Debian:

conda deactivate
conda create -n fastai
conda activate -n fastai
conda install -c fastai fastbook
conda install -c fastai fastbook

This essentially deactivates the current conda environment, creates a new ones and switches over to that and all seems to work as expected in this friendly new environment.

It did complain about another package (not graphviz) after and I installed it with conda install -c fastai

After that echo “import fastbook” | python3 works!

This just worked for me too. Thanks for (re) posting it.

Even though I just started getting an error message when I tried run my first image classification that “ImageDataBunch” not defined