[Bug]: FileNotFoundError: Can't identify the notebook path.
RootRooster opened this issue · comments
Is there an existing issue for this?
- I have searched for similar issues and discussions
Bug Description
I get a notebook not found error when trying to create a view using:
view = dp.View.from_notebook()
System Information
- Datapane version: 0.16.4
- Python version: Python 3.9.2
- Operating System: Debian 11
- Using Jupyter: Yes
- Pip or Conda: Pip
Anything else?
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
File ~/.local/lib/python3.9/site-packages/datapane/ipython/environment.py:160, in JupyterEnvironment._get_notebook_path(self)
159 try:
--> 160 return super()._get_notebook_path()
161 except FileNotFoundError as e:
File ~/.local/lib/python3.9/site-packages/datapane/ipython/environment.py:135, in IPythonZMQEnvironment._get_notebook_path(self)
133 return Path(path)
--> 135 return super()._get_notebook_path()
File ~/.local/lib/python3.9/site-packages/datapane/ipython/environment.py:109, in PythonEnvironment._get_notebook_path(self)
108 """Get the path to the current notebook"""
--> 109 raise FileNotFoundError("Could not discover notebook path")
FileNotFoundError: Could not discover notebook path
During handling of the above exception, another exception occurred:
FileNotFoundError Traceback (most recent call last)
File ~/.local/lib/python3.9/site-packages/datapane/ipython/environment.py:98, in PythonEnvironment.get_notebook_json(self)
97 try:
---> 98 path = self._get_notebook_path()
99 with open(path, encoding="utf-8") as f:
File ~/.local/lib/python3.9/site-packages/datapane/ipython/environment.py:165, in JupyterEnvironment._get_notebook_path(self)
164 try:
--> 165 return ipynbname.path()
166 except IndexError:
File ~/.local/lib/python3.9/site-packages/ipynbname/__init__.py:93, in path()
92 return root_dir / path
---> 93 raise FileNotFoundError(FILE_ERROR.format('path'))
FileNotFoundError: Can't identify the notebook path.
During handling of the above exception, another exception occurred:
DPClientError Traceback (most recent call last)
Cell In [14], line 2
1 import datapane as dp
----> 2 view = dp.View.from_notebook()
File ~/.local/lib/python3.9/site-packages/datapane/view/view_blocks.py:49, in Blocks.from_notebook(cls, opt_out, show_code, show_markdown, template)
46 from datapane.ipython import templates as ip_t
47 from datapane.ipython.utils import cells_to_blocks
---> 49 blocks = cells_to_blocks(opt_out=opt_out, show_code=show_code, show_markdown=show_markdown)
50 app_template_cls = ip_t._registry.get(template) or ip_t.guess_template(blocks)
51 app_template = app_template_cls(blocks)
File ~/.local/lib/python3.9/site-packages/datapane/client/analytics.py:138, in capture_event.<locals>._decorator.<locals>._wrapper(*args, **kwargs)
135 @wraps(func)
136 def _wrapper(*args, **kwargs):
137 try:
--> 138 return func(*args, **kwargs)
139 finally:
140 capture(name)
File ~/.local/lib/python3.9/site-packages/datapane/ipython/utils.py:97, in cells_to_blocks(opt_out, show_code, show_markdown)
94 ipython_output_cache = user_ns["_oh"]
95 ipython_input_cache = user_ns["_ih"]
---> 97 notebook_json = environment.get_notebook_json()
98 # TODO: debug message for Colab, remove after testing
100 notebook_is_dirty, dirty_cells = check_notebook_cache_parity(notebook_json, ipython_input_cache)
File ~/.local/lib/python3.9/site-packages/datapane/ipython/environment.py:102, in PythonEnvironment.get_notebook_json(self)
100 notebook_json = json.load(f)
101 except FileNotFoundError:
--> 102 raise DPClientError(
103 "Notebook not found. This command must be executed from within a Jupyter notebook environment."
104 )
105 return notebook_json
DPClientError: Notebook not found. This command must be executed from within a Jupyter notebook environment.
Please run with `dp.enable_logging()`, restart your Jupyter kernel/Python instance, and/or visit https://www.github.com/datapane/datapane to raise issue / discuss if error repeats
Closing as archiving project