Open mearlboro opened 1 year ago
The error
'The pycallgraph module is not an IPython extension.'
has appeared after I managed to get the notebook to run, when trying to run the pycallgraph section in profile.ipynb
.
This drove me to notice that:
pycallgraph
has no longer been maintained in several years, and has been forked as pycallgraph2
.requirements.txt
I amended the issue to add iPython
, pycallgraph2
and jupyter_contrib_nbextensions
.
This also requires enabling Jupyter extensions, this is described for system-wide enabling here, or, if you're working in a python environment for example pipenv
one can do
pipenv run jupyter contrib nbextension install --sys-prefix
pipenv run jupyter nbextension enable pycallgraph2 --sys-prefix
and then after restarting the notebook server, go to the NBExtensions
tab, untick "disable configuration for nbextensions without explicit compatibility", and make sure pycallgraph2
is ticked as well.
Running the relevant cell will then produce the call graph image as a PNG in the same directory you run notebooks.
Thanks again for finding these problems and suggesting the solutions. The method you suggest works, but it's quite a lot of work for students who are unfamiliar with the command line and Python package management. As a result, I've decided to remove the section on call graphs for now. It's not so bad as I don't think it's actually required for solving any of the problems in the course, and trying to find a good solution to this has caused me problems for a while. I may bring it back at some point - I'm considering trying GitHub Codespaces as a way to provide a pre-configured environment for students, and this would make it easier to use these packages.
In any case, your suggestion of a requirements file is still a good one, so I've added this for the other packages required for the course and updated "Packages" section of the readme. If you notice any problems with requirements file or the readme please feel free to let me know!
Thanks again for the feedback and suggestions.
Dear team,
I appreciate you providing the course materials for users who do not want to rely on Google. However, in lack of a
requirements.txt
file, reconstructing the necessary Python environment to run the notebooks is taking some time. Whilst you do specify some of the packages required the list is not complete. Moreover, some packages are being installed repeatedly inside code blocks in the Jupyter notebook, instead of being installed in the environment, i.e. the samepip install
command is repeated many times in the same notebook. This is not recommended in lack of a virtual environment, but the instructions you provide do not stress the importance of using one, or offer alternatives to Anaconda. Providing arequirements.txt
is the simplest and most agnostic way to support people in running this code locally inside a Python environment. I have done this in preparation of attending the course, so below is the content of therequirements.txt
file I used