Name 'CallbackHandler' is not defined

After installing the fastai library via:
conda install -c fastai -c pytorch -c anaconda fastai gh anaconda

in a fresh conda environment and then trying to run the import statement:
from fastai.tabular.all import *

In a jupyter notebook (and subsequently in spyder) I receive the error:
name ‘CallbackHandler’ is not defined

Interestingly if I try to run the same import statement from the python shell (command line) I do not get an error.

Any help would be greatly appreciated.

1 Like

Hi - did you fix it?

Weirdly i saw this after conda install and pip upgrade

I’m having the same problem

NameError: name 'CallbackHandler' is not defined

Hi, did you find a solution for this? I am getting the same error on a fresh instance in GCP when I updated fastai


Has anyone found a solution for this? I have the same versions of FastAI and Fastcore on a Google Cloud VM and it gives this error for some reason.

EDIT: I fixed the problem as follows:

  • First deactivate current conda enviroment: ‘conda deactivate’

  • Create new enviroment: ‘conda create --name newenv’

  • Go into new environment with the command prompt: ‘conda activate newenv’

  • Check the CUDA version on the device by typing: ‘nvidia-smi’
    → if CUDA version > 11.1 then download ‘conda install cudatoolkit=11.1’

  • Download the statement as given on Start Locally | PyTorch

  • Finally installing FastAI by the command given: “conda install -c fastchan fastai” and "conda install -c fastai fastbook’’

  • If sentencepiece is missing, just download the newest version through conda. If click._bash_complete module is missing → downgrade 'conda install ‘click<8’ ’

  • N.B.: You need to install jupyter notebook in your new environment to be able to link a Notebook kernel to the new environment (‘conda install jupyter’)

I hope it helps someone.

When creating google cloud instance you have the option of picking an environment. Picking the PyTorch environment set *everything up correctly for me.

*Not everything. graphviz was missing and jypter notebook warned me of this when I ran the ‘pratical deep learning for coders’ notebooks. So following other advice on the forums I reinstalled FastAI and that caused the callback problem for me.
I resolved this by recreating the VM and just installing graphviz separately.

Ah thanks man, my problems arise from the fact that I have merged multiple Disks I guess.

I cannot just start a new notebook without attaching my old data disk as I would otherwise lose all my progress.