Nbdev - urlsend not defined on windows

Hi,
I am having problems using nbdev 2 on windows.
When I run nbdev_new i get the following error:

...\AppData\Roaming\Python\Python37\site-packages\ghapi\core.py", line 105, in __call__
res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, debug=self.debug, return_headers=True,
NameError: name 'urlsend' is not defined

I am using python=3.7 (Edit -->I tried with 3.9 and 3.10 as well)
I installed fastocre with: conda install -c conda-forge fastcore
and nbdev with conda install -c fastai nbdev

The imports from ghapi.core are:

from fastcore.utils import *
from fastcore.foundation import *
from fastcore.meta import *
from .metadata import funcs

Is it possible that from fastcore.nets import * or from fastcore.nets import urlsend is missing?

Have you tried upgrading ghapi?

Hi,
Thanks for your answer. It is indeed related to that package. I think I located my error but have not found a solution yet.

So I was testing within a conda env

(base) C:\Users\xxx\GIT\nbdev_test>conda activate nbdev2

As you can see nbdev is installed and its commands can be found within the environment

(nbdev2) C:\Users\xxx\GIT\nbdev_test>where nbdev_new

C:\Users\xxx\AppData\Local\Continuum\anaconda3\envs\nbdev2\Scripts\nbdev_new

But when I try to run it it fails

(nbdev2) C:\Users\xxx\GIT\nbdev_test>nbdev_new
Traceback (most recent call last):
  File 
  ...
"C:\Users\xxx\AppData\Roaming\Python\Python37\site-packages\ghapi\core.py", line 105, in __call__
    res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, debug=self.debug, return_headers=True,
NameError: name 'urlsend' is not defined
(nbdev2) C:\Users\xxx\GIT\nbdev_test>conda list -n nbdev2
# packages in environment at C:\Users\xxx\AppData\Local\Continuum\anaconda3\envs\nbdev2:
#
# Name                    Version                   Build  Channel
...
fastcore                  1.5.22                     py_0    fastai
ghapi                     1.0.1                      
...

Somehow even though the latest version of ghapi is installed in the environment, it is accessing the previous version i had for nbdev 1 (from the base env I guess)

Could it be that when it calls ghapi it just calls the first one it finds instead of the one from the current working environment?

btw, Jeremy’s advise during the course was to avoid using multiple environments. It simplifies things to operate in only the base environment - for as long as possible, until you hit a situation you can’t work around without multiple envs.

While many experts isolate their tutorials in a new environment, mostly YAGNI, especially true for beginners.

4 Likes