I'm running Jupiter on vscode, and trying to run a graph animation with vpython. but when I run this:
from vpython import graph, canvas
scene = canvas()
g1 = graph(xtitle="x", ytitle="y", width=500, height=250)
I get the error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\Documents\quantum tunneling.ipynb Cell 8 line 2
1 scene = canvas()
----> 2 g1 = graph(xtitle="x", ytitle="y", width=500, height=250)
File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\vpython\vpython.py:2370, in graph.__init__(self, **args)
2368 def __init__(self, **args):
2369 objName = 'graph'
-> 2370 super(graph,self).__init__()
2372 ## default values
2373 self._width = 640
File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\vpython\vpython.py:257, in baseObj.__init__(self, **kwargs)
254 if not (baseObj._view_constructed or
255 baseObj._canvas_constructing):
256 if _isnotebook:
--> 257 from .with_notebook import _
258 else:
259 from .no_notebook import _
File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\vpython\with_notebook.py:80
77 transfer = (v != __version__) # need not transfer files to nbextensions if correct version's files already there
79 if transfer:
---> 80 notebook.nbextensions.install_nbextension(path = package_dir+"/vpython_data",overwrite = True,user = True,verbose = 0)
81 notebook.nbextensions.install_nbextension(path = package_dir+"/vpython_libraries",overwrite = True,user = True,verbose = 0)
83 # Wait for files to be transferred to nbextensions:
AttributeError: module 'notebook' has no attribute 'nbextensions'
I tried reinstalling the extensions:
pip install jupyter_contrib_nbextensions
and enabling it:
jupyter nbextension enable codefolding/main
I can see the 'nbextensions.py' file inside my \Python311\site-packages\notebook path.
So I don't understand why it's not recognizing it.