Building `qmd` files through Quarto does not work here, as modules are looked up in the wrong location.

We see an error that reads:

```shell
# yala @ pons in ~/src/lab.libreho.st/libernetes/documentation on git:main x [10:36:34] C:1
$ quarto check

[✓] Checking Quarto installation......OK
      Version: 0.2.183
      Path: /home/yala/Downloads/quarto-0.2.183/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.9.7
      Path: /usr/bin/python3
      Jupyter: 4.7.1
      Kernels: python3

(|) Checking Jupyter engine render....

An error occurred while executing the following cell:
------------------

# imports
import os
import sys
import types
import json

# figure size/format
fig_width = 7
fig_height = 5
fig_format = 'retina'
fig_dpi = 96

# matplotlib defaults / format
try:
  import matplotlib.pyplot as plt
  plt.rcParams['figure.figsize'] = (fig_width, fig_height)
  plt.rcParams['figure.dpi'] = fig_dpi
  plt.rcParams['savefig.dpi'] = fig_dpi
  from IPython.display import set_matplotlib_formats
  set_matplotlib_formats(fig_format)
except Exception:
  pass

# plotly use connected mode
try:
  import plotly.io as pio
  pio.renderers.default = "notebook_connected"
except Exception:
  pass

# enable pandas latex repr when targeting pdfs
try:
  import pandas as pd
  if fig_format == 'pdf':
    pd.set_option('display.latex.repr', True)
except Exception:
  pass



# output kernel dependencies
kernel_deps = dict()
for module in list(sys.modules.values()):
  # Some modules play games with sys.modules (e.g. email/__init__.py
  # in the standard library), and occasionally this can cause strange
  # failures in getattr.  Just ignore anything that's not an ordinary
  # module.
  if not isinstance(module, types.ModuleType):
    continue
  path = getattr(module, "__file__", None)
  if not path:
    continue
  if path.endswith(".pyc") or path.endswith(".pyo"):
    path = path[:-1]
  kernel_deps[path] = os.stat(path).st_mtime
print(json.dumps(kernel_deps))


# reset state
%reset

def ojs_define(**kwargs):
  import json
  from IPython.core.display import display, HTML

  # do some minor magic for convenience when handling pandas
  # dataframes
  def convert(v):
    try:
      import pandas as pd
    except ModuleNotFoundError: # don't do the magic when pandas is not available
      return v
    if type(v) == pd.DataFrame:
      j = json.loads(v.T.to_json(orient='split'))
      return dict((k,v) for (k,v) in zip(j["index"], j["data"]))
    else:
      return v

  v = dict(contents=list(dict(name=key, value=convert(value)) for (key, value) in kwargs.items()))
  display(HTML('<script type="ojs-define">' + json.dumps(v) + '</script>'), metadata=dict(ojs_define = True))
globals()["ojs_define"] = ojs_define

------------------

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-1-b55edcc50804> in <module>
     53   if path.endswith(".pyc") or path.endswith(".pyo"):
     54     path = path[:-1]
---> 55   kernel_deps[path] = os.stat(path).st_mtime
     56 print(json.dumps(kernel_deps))
     57

FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib64/python3.9/pydoc_data/topics.py'
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib64/python3.9/pydoc_data/topics.py'

[✓] Checking Jupyter engine render....OK


# yala @ pons in ~/src/lab.libreho.st/libernetes/documentation on git:main x [10:36:44] C:1
$ pipenv shell
Launching subshell in virtual environment...
 . /home/yala/.local/share/virtualenvs/documentation-EDOFPCMD/bin/activate

# yala @ pons in ~/src/lab.libreho.st/libernetes/documentation on git:main x [10:37:14]
$  . /home/yala/.local/share/virtualenvs/documentation-EDOFPCMD/bin/activate
(documentation)
# yala @ pons in ~/src/lab.libreho.st/libernetes/documentation on git:main x documentation-EDOFPCMD [10:37:14]
$ quarto check

[✓] Checking Quarto installation......OK
      Version: 0.2.183
      Path: /home/yala/Downloads/quarto-0.2.183/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.9.7
      Path: /home/yala/.local/share/virtualenvs/documentation-EDOFPCMD/bin/python3
      Jupyter: 4.8.1
      Kernels: python3, zsh

(-) Checking Jupyter engine render....

An error occurred while executing the following cell:
------------------

# imports
import os
import sys
import types
import json

# figure size/format
fig_width = 7
fig_height = 5
fig_format = 'retina'
fig_dpi = 96

# matplotlib defaults / format
try:
  import matplotlib.pyplot as plt
  plt.rcParams['figure.figsize'] = (fig_width, fig_height)
  plt.rcParams['figure.dpi'] = fig_dpi
  plt.rcParams['savefig.dpi'] = fig_dpi
  from IPython.display import set_matplotlib_formats
  set_matplotlib_formats(fig_format)
except Exception:
  pass

# plotly use connected mode
try:
  import plotly.io as pio
  pio.renderers.default = "notebook_connected"
except Exception:
  pass

# enable pandas latex repr when targeting pdfs
try:
  import pandas as pd
  if fig_format == 'pdf':
    pd.set_option('display.latex.repr', True)
except Exception:
  pass



# output kernel dependencies
kernel_deps = dict()
for module in list(sys.modules.values()):
  # Some modules play games with sys.modules (e.g. email/__init__.py
  # in the standard library), and occasionally this can cause strange
  # failures in getattr.  Just ignore anything that's not an ordinary
  # module.
  if not isinstance(module, types.ModuleType):
    continue
  path = getattr(module, "__file__", None)
  if not path:
    continue
  if path.endswith(".pyc") or path.endswith(".pyo"):
    path = path[:-1]
  kernel_deps[path] = os.stat(path).st_mtime
print(json.dumps(kernel_deps))


# reset state
%reset

def ojs_define(**kwargs):
  import json
  from IPython.core.display import display, HTML

  # do some minor magic for convenience when handling pandas
  # dataframes
  def convert(v):
    try:
      import pandas as pd
    except ModuleNotFoundError: # don't do the magic when pandas is not available
      return v
    if type(v) == pd.DataFrame:
      j = json.loads(v.T.to_json(orient='split'))
      return dict((k,v) for (k,v) in zip(j["index"], j["data"]))
    else:
      return v

  v = dict(contents=list(dict(name=key, value=convert(value)) for (key, value) in kwargs.items()))
  display(HTML('<script type="ojs-define">' + json.dumps(v) + '</script>'), metadata=dict(ojs_define = True))
globals()["ojs_define"] = ojs_define

------------------

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
/tmp/ipykernel_10306/4071903457.py in <module>
     53   if path.endswith(".pyc") or path.endswith(".pyo"):
     54     path = path[:-1]
---> 55   kernel_deps[path] = os.stat(path).st_mtime
     56 print(json.dumps(kernel_deps))
     57

FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib64/python3.9/pydoc_data/topics.py'
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib64/python3.9/pydoc_data/topics.py'

Exception ignored in: <function BaseEventLoop.__del__ at 0x7fbc9c1b30d0>
Traceback (most recent call last):
  File "/usr/lib64/python3.9/asyncio/base_events.py", line 683, in __del__
    self.close()
  File "/usr/lib64/python3.9/asyncio/unix_events.py", line 58, in close
    super().close()
  File "/usr/lib64/python3.9/asyncio/selector_events.py", line 92, in close
    self._close_self_pipe()
  File "/usr/lib64/python3.9/asyncio/selector_events.py", line 99, in _close_self_pipe
    self._remove_reader(self._ssock.fileno())
  File "/usr/lib64/python3.9/asyncio/selector_events.py", line 277, in _remove_reader
    key = self._selector.get_key(fd)
  File "/usr/lib64/python3.9/selectors.py", line 191, in get_key
    return mapping[fileobj]
  File "/usr/lib64/python3.9/selectors.py", line 72, in __getitem__
    fd = self._selector._fileobj_lookup(fileobj)
  File "/usr/lib64/python3.9/selectors.py", line 226, in _fileobj_lookup
    return _fileobj_to_fd(fileobj)
  File "/usr/lib64/python3.9/selectors.py", line 42, in _fileobj_to_fd
    raise ValueError("Invalid file descriptor: {}".format(fd))
ValueError: Invalid file descriptor: -1
[✓] Checking Jupyter engine render....OK

```

The task `[✓] Checking Jupyter engine render` can therefore also not be considered to be `....OK`.

The same error appearing in both virtual environments suggests there is more at work here that I don't comprehend at the moment.
2021-10-02T09:04:13Z
almereyda
closed
Jupyter engine renderer cannot find pydoc_data/topics.py, but reports OK
https://github.com/quarto-dev/quarto-cli/issues/121