jupyter-book icon indicating copy to clipboard operation
jupyter-book copied to clipboard

Can't build book on mac when folder name is not project name.

Open GJBoth opened this issue 9 months ago • 1 comments

Describe the bug

I have a repository whose folder name is different than the package name. When building the book it fails because the virtual environment name is wrong (see below).

Reproduce the bug

Have a repo with a different folder name than the package, and the build will fail. Changing the folder name to match the package, and the build succeeds. The bug only manifests on mac, on linux it works as expected.

List your environment

# Platform:         darwin; (macOS-14.1-arm64-arm-64bit)
# Sphinx version:   7.3.7
# Python version:   3.11.9 (CPython)
# Docutils version: 0.20.1
# Jinja2 version:   3.1.3
# Pygments version: 2.18.0

# Last messages:
#   
#   
#   reading sources... [ 50%]
#   markdown
#   
#   
#   reading sources... [ 75%]
#   markdown-notebooks
#   
#   /Users/bothg/Documents/flybody/flybody_internal/docs/markdown-notebooks.md: Executing notebook using local CWD [mystnb]

# Loaded extensions:
#   sphinx.ext.mathjax (7.3.7)
#   alabaster (0.7.16)
#   sphinxcontrib.applehelp (1.0.8)
#   sphinxcontrib.devhelp (1.0.6)
#   sphinxcontrib.htmlhelp (2.0.5)
#   sphinxcontrib.serializinghtml (1.1.10)
#   sphinxcontrib.qthelp (1.0.7)
#   sphinx_togglebutton (0.3.2)
#   sphinx_copybutton (0.5.2)
#   myst_nb (1.1.0)
#   jupyter_book (1.0.0)
#   sphinx_thebe (0.3.1)
#   sphinx_comments (0.0.3)
#   sphinx_external_toc (1.0.1)
#   sphinx.ext.intersphinx (7.3.7)
#   sphinx_design (0.5.0)
#   sphinx_book_theme (unknown version)
#   sphinxcontrib.bibtex (2.6.2)
#   sphinx_jupyterbook_latex (unknown version)
#   sphinx_multitoc_numbering (unknown version)
#   pydata_sphinx_theme (unknown version)

# Traceback:
Traceback (most recent call last):
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jupyter_book/sphinx.py", line 167, in build_sphinx
    app.build(force_all, filenames)
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/application.py", line 351, in build
    self.builder.build_update()
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 293, in build_update
    self.build(to_build,
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 313, in build
    updated_docnames = set(self.read())
                           ^^^^^^^^^^^
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 419, in read
    self._read_serial(docnames)
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 440, in _read_serial
    self.read_doc(docname)
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 497, in read_doc
    publisher.publish()
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/docutils/core.py", line 234, in publish
    self.document = self.reader.read(self.source, self.parser,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/io.py", line 107, in read
    self.parse()
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/docutils/readers/__init__.py", line 76, in parse
    self.parser.parse(self.input, document)
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/myst_nb/sphinx_.py", line 152, in parse
    with create_client(
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/myst_nb/core/execute/base.py", line 79, in __enter__
    self.start_client()
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/myst_nb/core/execute/direct.py", line 40, in start_client
    result = single_nb_execution(
             ^^^^^^^^^^^^^^^^^^^^
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jupyter_cache/executors/utils.py", line 58, in single_nb_execution
    executenb(
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/nbclient/client.py", line 1314, in execute
    return NotebookClient(nb=nb, resources=resources, km=km, **kwargs).execute()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jupyter_core/utils/__init__.py", line 165, in wrapped
    return loop.run_until_complete(inner)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/nbclient/client.py", line 693, in async_execute
    async with self.async_setup_kernel(**kwargs):
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/nbclient/client.py", line 648, in async_setup_kernel
    await self.async_start_new_kernel(**kwargs)
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/nbclient/client.py", line 550, in async_start_new_kernel
    await ensure_async(self.km.start_kernel(extra_arguments=self.extra_arguments, **kwargs))
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jupyter_core/utils/__init__.py", line 198, in ensure_async
    result = await obj
             ^^^^^^^^^
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jupyter_client/manager.py", line 96, in wrapper
    raise e
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jupyter_client/manager.py", line 87, in wrapper
    out = await method(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jupyter_client/manager.py", line 439, in _async_start_kernel
    await self._async_launch_kernel(kernel_cmd, **kw)
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jupyter_client/manager.py", line 354, in _async_launch_kernel
    connection_info = await self.provisioner.launch_kernel(kernel_cmd, **kw)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jupyter_client/provisioning/local_provisioner.py", line 210, in launch_kernel
    self.process = launch_kernel(cmd, **scrubbed_kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jupyter_client/launcher.py", line 170, in launch_kernel
    raise ex
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jupyter_client/launcher.py", line 155, in launch_kernel
    proc = Popen(cmd, **kwargs)  # noqa
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/bothg/.pyenv/versions/3.11.9/lib/python3.11/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/bothg/Documents/flybody/flybody/.venv/bin/python'

GJBoth avatar May 13 '24 20:05 GJBoth