Strugling to install nbdev

after installing nbdev on my computer im not able to use it im getting this error
Traceback (most recent call last):
File “”, line 198, in _run_module_as_main
File “”, line 88, in run_code
File "C:\Users\USER\AppData\Local\Programs\Python\Python311\Scripts\nbdev_new.exe_main
.py", line 4, in
File “C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\nbdev\cli.py”, line 13, in
from .quarto import nbdev_readme, refresh_quarto_yml
File “C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\nbdev\quarto.py”, line 6, in
from os import system, uname
ImportError: cannot import name ‘uname’ from ‘os’ (C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\os.py)

Hi, I don’t regularly use nbdev and don’t have a Windows machine, so I can’t give firsthand insight, but I did find this GitHub issue online which is referencing the nbdev docs which says you have to use WSL to run nbdev on Windows.

2 Likes

Hi Michael,
Sorry about the challenge.

Looks like the error is related to an import issue in the quarto.py file of the nbdev package. Specifically, it’s having trouble importing the uname function from the os module.

You may try the following steps:

Check Python Version Compatibility: Ensure that the version of nbdev you’ve installed is compatible with your Python version. You can check the version requirements in the nbdev documentation or on the Python Package Index (PyPI).

Upgrade nbdev: Upgrade your nbdev installation to the latest version using the following
pip install --upgrade nbdev

Check Python Environment: Verify that you are using the correct Python environment. Ensure that the Python interpreter running your script is the one where nbdev is installed.

Check os.py Module: Inspect the os.py file in the specified location (C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\os.py) and check if the uname function is present. It’s a standard function in the os module, so it should be there.

Reinstall nbdev: Uninstall nbdev and then reinstall it:

pip uninstall nbdev
pip install nbdev

I hope this helps.