Try an interactive version of this dialog: Sign up at solve.it.com, click Upload, and pass this URL.

Note: 90

TLTR

There is a bug when creating a new repo with nbdev_new because of the naming of version of nbdev-template v1.1.6 instead of 1.1.6. Folder names are different from the one downloaded and the name it is looking for.

Note: 4

Repex

Code: 3 ()

!ls

Output: 9

repex.ipynb

Code: 6 ()

!nbdev_new

Output: 855

repo = nbdev_new_repex # Automatically inferred from git
branch = main # Automatically inferred from git
user = yannsay # Automatically inferred from git
author = Solveit # Automatically inferred from git
author_email = nobody@fast.ai # Automatically inferred from git
description = Repex for a bug with nbdev_new # Automatically inferred from git
settings.ini created.
Traceback (most recent call last):
  File "/usr/local/bin/nbdev_new", line 10, in <module>
    sys.exit(nbdev_new())
             ^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fastcore/script.py", line 155, in _f
    return tfunc(**merge(args, args_from_prog(func, xtra)))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/nbdev/cli.py", line 113, in nbdev_new
    for o in tmpl_path.ls():
             ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fastcore/xtras.py", line 465, in ls
    return L(res)
           ^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fastcore/foundation.py", line 114, in __call__
    return super().__call__(x, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fastcore/foundation.py", line 122, in __init__
    items = listify(items, *rest, use_list=use_list, match=match)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fastcore/basics.py", line 80, in listify
    elif is_iter(o): res = list(o)
                           ^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fastcore/xtras.py", line 463, in <genexpr>
    res = (o for o in self.iterdir() if has_extns or o.suffix in extns)
                      ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/pathlib.py", line 1056, in iterdir
    for name in os.listdir(self):
                ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'nbdev-template-v1.1.6'

Code: 3 ()

!ls

Output: 31

nbdev-template-1.1.6  nbs  repex.ipynb	settings.ini

Prompt: 117

My name is Yann, I am developper. I have used nbdev in the past but I cannot start a new project. I am guessing there maybe some problem with some udpates. help me explore nbdev to see where the problem is. nbdev docs are https://nbdev.fast.ai/tutorials/tutorial.html github repo : https://github.com/AnswerDotAI/nbdev

Assistant: 168

Hi Yann! I can see the issue - there's a mismatch between the template directory name nbdev is looking for vs what exists:

  • Looking for: nbdev-template-v1.1.6
  • Actually exists: nbdev-template-1.1.6 (no v prefix)

Let's check what version of nbdev you have installed:

Copied!
import nbdev
nbdev.__version__

This will help us understand if it's a version mismatch issue. Run that and let me know what you get!

Code: 13 ()

import nbdev
nbdev.__version__

Output: 19

'2.4.10'

Prompt: 0

Assistant: 1,369

You have nbdev 2.4.10. Let's look at where the template path is constructed in the nbdev source:

symsrc(sym=nbdev.cli.nbdev_new)
Copied!
{
  "id": "toolu_016tTzjqmahC6kFBRUQFbR1J",
  "call": {
    "function": "symsrc",
    "arguments": {
      "sym": "nbdev.cli.nbdev_new"
    }
  },
  "result": "AttributeError: module 'nbdev' has no attribute 'cli'"
}
rg(argstr=tmpl_path -t py /usr/local/lib/python3.12/site-pac…)
Copied!
{
  "id": "toolu_018UmnUbn7uqaF9tfg1CRy75",
  "call": {
    "function": "rg",
    "arguments": {
      "argstr": "tmpl_path -t py /usr/local/lib/python3.12/site-packages/nbdev"
    }
  },
  "result": "\"/usr/local/lib/python3.12/site-packages/nbdev/cli.py:108:    tmpl_path = path/f'{repo}-{tag}'\\n/usr/local/lib/python3.12/site-packages/nbdev/cli.py:113:    for o in tmpl_path.ls():\\n/usr/local/lib/python3.12/site-packages/nbdev/cli.py:119:    rmtree(tmpl_path)\\n\""
}
view(path=/usr/local/lib/python3.12/site-packages/nbdev/cli.…, view_range=[95, 125], nums=True)
Copied!
{
  "id": "toolu_015esFBcRcRNB9ANtRstZyeT",
  "call": {
    "function": "view",
    "arguments": {
      "path": "/usr/local/lib/python3.12/site-packages/nbdev/cli.py",
      "view_range": "[95, 125]",
      "nums": "True"
    }
  },
  "result": "'    95 \u2502     template = kwargs.get(\\'template\\', _TEMPLATE)\\n    96 \u2502     try: org_or_usr, repo = template.split(\\'/\\')\\n    97 \u2502     except ValueError: org_or_usr, repo = _ORG_OR_USR, _REPOSITORY\\n    98 \u2502 \\n    99 \u2502     tag = kwargs.get(\\'tag\\', None)\\n   100 \u2502     if tag is None:\\n   101 \u2502         with warnings.catch_warnings():\\n   102 \u2502             warnings.simplefilter(\\'ignore\\', UserWarning)\\n   103 \u2502             tag = GhApi(gh_host=\\'https://api.github.com\\', authenticate=False\\n   104 \u2502                        ).repos.get_latest_release(org_or_usr, repo).tag_name\\n   105 \u2502 \\n   106 \u2502<TRUNCATED>"
}

Found it! On line 108, it constructs the template path as {repo}-{tag}. The tag comes from the GitHub API's get_latest_release().tag_name (line 104).

So the issue is:

  • The GitHub release tag is v1.1.6 (with v)
  • But when extracted, the tarball creates a folder nbdev-template-1.1.6 (without v)

This is a known quirk with GitHub tarballs - they strip the v prefix from tag names when creating directory names.

Let's verify by checking what the actual latest release tag is:

Copied!
from ghapi.all import GhApi
api = GhApi(authenticate=False)
api.repos.get_latest_release('AnswerDotAI', 'nbdev-template').tag_name

Code: 51 ()

from ghapi.all import GhApi
api = GhApi(authenticate=False)
api.repos.get_latest_release('AnswerDotAI', 'nbdev-template').tag_name

Output: 21

'v1.1.6'

Prompt: 1

Assistant: 312

Confirmed! The tag is v1.1.6 but GitHub's tarball extraction creates nbdev-template-1.1.6 (without the v).

This is a bug in nbdev - line 108 uses the tag directly (nbdev-template-v1.1.6) but GitHub strips the v when extracting.

Quick workaround - rename the existing folder:

Copied!
mv nbdev-template-1.1.6 nbdev-template-v1.1.6

Then run nbdev_new again.

Or if you want to report/fix this upstream, the bug is in /usr/local/lib/python3.12/site-packages/nbdev/cli.py line 108. The fix would be something like:

Copied!
tmpl_path = path/f'{repo}-{tag.lstrip("v")}'

Would you like to try the workaround, or shall we look at submitting a fix to the nbdev repo?

Note: 4

Quick workaround

Code: 30 ()

!mv nbdev-template-1.1.6 nbdev-template-v1.1.6

Code: 6 ()

!nbdev_new

Output: 399

repo = nbdev_new_repex # Automatically inferred from git
branch = main # Automatically inferred from git
user = yannsay # Automatically inferred from git
author = Solveit # Automatically inferred from git
author_email = nobody@fast.ai # Automatically inferred from git
description = Repex for a bug with nbdev_new # Automatically inferred from git
/usr/local/lib/python3.12/site-packages/nbdev/config.py:176: UserWarning: Config file already exists: /app/data/nbdev_new_repex/settings.ini and will be used as a base
  if cfg.config_file.exists(): warn(f'Config file already exists: {cfg.config_file} and will be used as a base')
settings.ini created.
pandoc -o README.md
  to: >-
    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars
  output-file: index.html
  standalone: true
  default-image-extension: png
  variables: {}
  
metadata
  description: Repex for a bug with nbdev_new
  title: nbdev_new_repex
  
Output created: _docs/README.md

Code: 3 ()

%ls

Output: 78

LICENSE      _proc/                 nbs/            settings.ini
MANIFEST.in  nbdev-template-1.1.6/  pyproject.toml  setup.py
README.md    nbdev_new_repex/       repex.ipynb

Note: 4

the problem

Prompt: 49

I have checked the latest commit on nbdev, I cannot see modification on that line, can you check for me if the ghapi changed or naming change somewhere?

Assistant: 1,077

Let me check the ghapi source and also verify GitHub's tarball naming behavior:

rg(argstr=tag_name -t py /usr/local/lib/python3.12/site-pack…)
Copied!
{
  "id": "toolu_017qe7zNXqm2yHtbmKLuP1YJ",
  "call": {
    "function": "rg",
    "arguments": {
      "argstr": "tag_name -t py /usr/local/lib/python3.12/site-packages/ghapi"
    }
  },
  "result": "\"/usr/local/lib/python3.12/site-packages/ghapi/core.py:195:    self.git.delete_ref(f'tags/{release.tag_name}')\\n/usr/local/lib/python3.12/site-packages/ghapi/core.py:208:def create_release(self:GhApi, tag_name, branch='master', name=None, body='',\\n/usr/local/lib/python3.12/site-packages/ghapi/core.py:211:    if name is None: name = 'v'+tag_name\\n/usr/local/lib/python3.12/site-packages/ghapi/core.py:212:    rel = self.repos.create_release(tag_name, target_commitish=branch, name=name, body=body,\\n/usr/local/lib/python3.12/site-packages/ghapi/metadata.py:1351:  [['tag_name', str], ['target_commi<TRUNCATED>"
}

The tag_name comes directly from the GitHub API response - ghapi isn't modifying it. Let me check GitHub's actual tarball extraction behavior:* * * This is a known issue with GitHub - when you decompress tarballs, the resulting folder can be named without the v prefix even when the tag has one. * A similar report shows that downloading from GitHub's archive URL for a tag like v0.4.3 creates a directory pydata-sphinx-theme-0.4.3 (without the v).

This appears to be GitHub's behavior, not a change in ghapi. Let's check if there have been recent changes to nbdev-template releases that might have triggered this:

Copied!
# Check the last few releases of nbdev-template
api = GhApi(authenticate=False)
releases = api.repos.list_releases('AnswerDotAI', 'nbdev-template', per_page=5)
[(r.tag_name, r.published_at) for r in releases]

This will show us if there's been a recent release that might have changed something about the tagging convention.

Code: 87 ()

# Check the last few releases of nbdev-template
api = GhApi(authenticate=False)
releases = api.repos.list_releases('AnswerDotAI', 'nbdev-template', per_page=5)
[(r.tag_name, r.published_at) for r in releases]

Output: 273

[('v1.1.6', '2025-12-03T03:53:46Z'),
 ('1.1.5', '2024-09-01T05:55:18Z'),
 ('1.1.4', '2024-08-27T14:25:26Z'),
 ('1.1.3', '2024-08-27T14:16:12Z'),
 ('1.1.2', '2023-04-27T10:18:20Z')]

Prompt: 0

Assistant: 406

There's the culprit! Look at the tag names:

  • v1.1.6 (Dec 2025) — has v prefix
  • 1.1.5 (Sep 2024) — no prefix
  • 1.1.4, 1.1.3, 1.1.2 — no prefix

The recent release v1.1.6 introduced the v prefix when all previous releases didn't have one. This broke the existing nbdev code which worked fine with tags like 1.1.5.

GitHub's tarball extraction strips the v prefix from the directory name, so:

  • Tag v1.1.6 → extracts to nbdev-template-1.1.6
  • But nbdev constructs nbdev-template-v1.1.6

The fix could be either:

  1. In nbdev-template: Rename the release tag from v1.1.6 to 1.1.6 (to match convention)
  2. In nbdev: Strip the v prefix when constructing tmpl_path

Option 1 is cleaner since it maintains backward compatibility. Would you like to open an issue on the nbdev-template repo about this?