New User: need help

Hello,

I am trying to follow the steps given in https://docs.fast.ai/tabular.html.

As ADULT_SAMPLE was not available, I used url of ADULT instead

from fastai import *
from fastai.tabular import * 
path = untar_data(URLs.ADULT)
path
df = pd.read_csv(path/'adult.csv')
df.head()
procs = [FillMissing, Categorify, Normalize] # Error 1
valid_idx = range(len(df)-2000, len(df))
dep_var = '>=50k'
cat_names = ['workclass', 'education', 'marital-status', 'occupation', 'relationship', 'race', 'sex', 'native-country']
data = TabularDataBunch.from_df(path, df, dep_var, valid_idx=valid_idx, procs=procs, cat_names=cat_names)
print(data.train_ds.cont_names)  # `cont_names` defaults to: set(df)-set(cat_names)-{dep_var}

I searched the forum of the error.
Errors:

  1. Normalize is not defined
  2. If i remove normalize from procs, and continue, running tabulardatabunch shows this new error:
    TypeError: from_df() missing 1 required positional argument: ‘dep_var’

Can somebody please help me out?

Regards,
Prateek

using fastai v1

You probably don’t have the latest version of fastai (since you don’t have Normalize). You should update your library.

Thanks for replying.

I used conda to install the fast ai library.

conda install -c pytorch pytorch torchvision
conda install -c fastai fastai

Does it not install the latest version?

It should, but you may have an old install that’s messing things up. Run the line

fastai.show_install(1)

and paste your result here so we can help.

1 Like

Hi…

I moved to ubuntu OS from Windows, and it is running correctly now

Hi,

I am working with fastai in windows. I am just trying to load a simple dataset as you prepared in Minimal-training-example. Here is my code and the error I got:

from fastai.vision import *
path = untar_data(URLs.MNIST_SAMPLE)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'untar_data' is not defined

I have installed fastai using conda package manager using following command:

conda install -c pytorch pytorch-cpu torchvision
conda install -c fastai fastai

and also here is the output of fastai.show_install(1):

=== Software ===
python version : 3.6.7
fastai version : 1.0.34
torch version  : 1.0.0
torch cuda ver
torch cuda is  : **Not available**

=== Hardware ===
No GPUs available

=== Environment ===
platform       : Windows-10-10.0.14393-SP0
conda env      : fastai-cpu
python         : C:\Users\Mohammad\Anaconda3\envs\fastai-cpu\python.exe
sys.path       :
C:\Users\Mohammad\Anaconda3\envs\fastai-cpu\python36.zip
C:\Users\Mohammad\Anaconda3\envs\fastai-cpu\DLLs
C:\Users\Mohammad\Anaconda3\envs\fastai-cpu\lib
C:\Users\Mohammad\Anaconda3\envs\fastai-cpu
C:\Users\Mohammad\Anaconda3\envs\fastai-cpu\lib\site-packages
C:\Users\Mohammad\Anaconda3\envs\fastai-cpu\lib\site-packages\win32
C:\Users\Mohammad\Anaconda3\envs\fastai-cpu\lib\site-packages\win32\lib
C:\Users\Mohammad\Anaconda3\envs\fastai-cpu\lib\site-packages\Pythonwin
C:\Users\Mohammad\Anaconda3\envs\fastai-cpu\lib\site-packages\IPython\extensions
no supported gpus found on this system

Could you possibly help me what is the problem and how can I solve it?

Add from fastai.datasets import untar_data

You are right, but I don’t know why the snippet provided by fastai author does not work. Anyway, thank you.