Wiki thread: lesson 1

Do we have homework assignments at the end of the lesson?

2 Likes

I ran into a problem running the first notebook, lesson1-rf.ipynb

Background:

On a PC running 64-bit windows 7, I followed the instructions in the section Setting up your computer if it already has Anaconda installed

There were two problems:

(1) The command ‘conda env update’
gave the following error in red:
pexpect 4.6.0 requires ptyprocess>=0.5, which is not installed. spacy 2.0.16 has requirement regex==2018.01.10, but you’ll have regex 2018.8.29 which is incompatible.

I am not sure if this is really a fatal error. Anyway, I tried to install ptyprocess, but got an error:

conda install ptyprocess
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  • ptyprocess

(2) The command
‘source activate fastai’
gave the error message:

‘source’ is not recognized as an internal or external command, operable program or batch file.

D’oh – this is because, being on a PC, I am not in a bash terminal.
So instead, I ran the command
‘conda activate fastai’, which seemed to work, because the prompt was then preceded by the string ‘(fastai)’

Then, in the directory /fastai/courses/ml1,
I ran the command
‘jupyter notebook’, and when the notebook server started, I ran the lesson1-rf.ipynb notebook.

Description of the Problem:

The 1st code cell ran successfully. But on running the 2nd code cell (where all the imports are), I got the following error message: ---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 from fastai.imports import *
2 from fastai.structured import *
3
4 from pandas_summary import DataFrameSummary
5 from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier

ModuleNotFoundError: No module named ‘fastai’

Bottom line, and question

I conclude that my setup is incorrect. What do I need to do to fix this problem, so that I can run the notebooks on my laptop?

1 Like

Yes, you must download the data from Kaggle. You can store it anywhere on your machine, but …/data/… is a typical directory structure. Just set the PATH variable to wherever you keep the data.

Is there any way to check the Seasonality(Additive or Multiplicative) of the time series data or do we have to identify manually by plotting the graph ?

Having same issue

Try ‘conda install -c fastai fastai’ command before initiating jupyter notebook.

I have the same two errors when running conda env update on windows in Anaconda Terminal

pexpect 4.6.0 requires ptyprocess>=0.5, which is not installed. 
spacy 2.0.16 has requirement regex==2018.01.10, but you’ll have regex 2018.8.29 which is incompatible.

Question 1: how should we install ptyprocess?
Question 2: what should we do about the spacy error?

Ignoring these errors for now I also have the same issue with not being able to import the fastai library when running my notebook. As suggested here i did the following

(fastai) C:\Users\Mark\Deep\fastai>conda install -c fastai fastai
Solving environment: done

## Package Plan ##

  environment location: C:\Users\Mark\Anaconda3\envs\fastai

  added / updated specs:
    - fastai


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    fastai-1.0.18              |             py_1          90 KB  fastai
    fastprogress-0.1.15        |             py_0          13 KB  fastai
    dataclasses-0.6            |             py_0          19 KB  fastai
    ------------------------------------------------------------
                                           Total:         122 KB

The following NEW packages will be INSTALLED:

    dataclasses:  0.6-py_0     fastai
    fastai:       1.0.18-py_1  fastai
    fastprogress: 0.1.15-py_0  fastai
    typing:       3.6.4-py36_0

Proceed ([y]/n)? y


Downloading and Extracting Packages
fastai-1.0.18        | 90 KB     | #################################### | 100%
fastprogress-0.1.15  | 13 KB     | #################################### | 100%
dataclasses-0.6      | 19 KB     | #################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(fastai) C:\Users\Mark\Deep\fastai>jupyter notebook

but still can’t execute the cell

from fastai.conv_learner import *

i get
ModuleNotFoundError no module named ‘fastai’

thanks for any help on these three issues
I am on a PC with cpu only

@MarkD Hi Mark, I was able to install fastai on my windows 7 64-bit PC by following the “Howto: Installation on Windows” instructions that @jeremy posted at Howto: installation on Windows
Just adapt the instructions to ML1 course instead of the DL1 course.

I was able to execute the first two cells in the ML1 lesson1-rf.ipynb notebook without error, so I think the fastai installation is successful.

Should work as long as we don’t try to execute commands that want to use the GPU.

I don’t know the solution to the first two issues so I’ll kick those cans down the road for now.

@jcatanza Thank you. Previously I was not changing the symbolic link.

we still don’t have resolution for the ptyprocess issue (don’t know when/whether it will matter).

The spacey issue may be addressed by Jeremy’s Additional notes on the page you referenced, i.e.
python -m spacy download en
I have not tried it as it’s for NLP and I’m interested in vision.

So since we are using …\old\fastai I’m guessing there’s a newer version of fastai now but the courses still use the old apis

Hi @MarkD thanks for reminding me about the spacy installation step. I am interested in NLP as well as computer vision, so I just did that step!

Looks like ptyprocess is not yet ported to Windows…

After installing the fastai library on my Windows 7 64-bit laptop,
runnning through ML lesson1-rf.ipynb, I encountered an issue with feather:

The command
df_raw.to_feather(‘tmp/bulldozers-raw’)
threw the following error, even though I had previously installed feather with
conda install feather-format -c conda-forge

Can anyone recommend a fix?

=======================

ImportError Traceback (most recent call last)
~\Anaconda3\envs\fastai\lib\site-packages\pandas\io\feather_format.py in _try_import()
13 try:
—> 14 import feather
15 except ImportError:

~\Anaconda3\envs\fastai\lib\site-packages\feather_init_.py in
16
—> 17 from feather.api import (read_dataframe, write_dataframe,
18 FeatherError, FeatherReader, FeatherWriter)

~\Anaconda3\envs\fastai\lib\site-packages\feather\api.py in
14
—> 15 from pyarrow.feather import (read_feather as read_dataframe, # noqa
16 write_feather as write_dataframe,

~\Anaconda3\envs\fastai\lib\site-packages\pyarrow_init_.py in
46
—> 47 from pyarrow.lib import cpu_count, set_cpu_count
48 from pyarrow.lib import (null, bool_,

ImportError: DLL load failed: The specified procedure could not be found.

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
in
1 os.makedirs(‘tmp’, exist_ok=True)
----> 2 df_raw.to_feather(‘tmp/bulldozers-raw’)

~\Anaconda3\envs\fastai\lib\site-packages\pandas\core\frame.py in to_feather(self, fname)
1890 “”"
1891 from pandas.io.feather_format import to_feather
-> 1892 to_feather(self, fname)
1893
1894 def to_parquet(self, fname, engine=‘auto’, compression=‘snappy’,

~\Anaconda3\envs\fastai\lib\site-packages\pandas\io\feather_format.py in to_feather(df, path)
49 raise ValueError(“feather only support IO with DataFrames”)
50
—> 51 feather = _try_import()
52 valid_types = {‘string’, ‘unicode’}
53

~\Anaconda3\envs\fastai\lib\site-packages\pandas\io\feather_format.py in _try_import()
16
17 # give a nice error message
—> 18 raise ImportError(“the feather-format library is not installed\n”
19 “you can install via conda\n”
20 “conda install feather-format -c conda-forge\n”

ImportError: the feather-format library is not installed
you can install via conda
conda install feather-format -c conda-forge
or via pip
pip install -U feather-format

Thank you for the help.

Hi, is anyone else having a problem receiving an activation email from kaggle.com?

And for the mean time could someone provide me the bulldozers data (Train.zip).
Thank you in advance.

I received activation fine (via facebook), but cannot accept the rules for bluebook bulldozer to download the dataset. Can accept other competition rules OK. If anyone can dump the train.zip somewhere to get moving with this course, it would be appreciated!

edit: for those interested, i have found a similar competition that may be good enough to play with: https://www.kaggle.com/c/house-prices-advanced-regression-techniques (and I can accept the rules for this one).

For those having trouble accepting rules: you must verify your phone number in your profile to accept the rules. It fixed the issue for me, so just double check your phone is verified!

I tried reinstalling feather as suggested, and am now getting this error on the read_feather call:

TypeError: read_feather() got an unexpected keyword argument 'nthreads'

Have you run into that at all?

But in any event, you were correct that the feathered version was causing the crash, and I was able to get the notebook to work by simply skipping the feathering/unfeathering steps and keeping df_raw in its original form. Thanks for getting me unblocked! :smile:

Guys, is Google Colab fit for this work ?

Hi, I followed your instructions and launched jupyter notebook. i opened a notebook and tried importing libraries.

from fastai import *
from fastai.text import *

Below is the error message i am getting.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-9acdcc7330cd> in <module>
----> 1 from fastai import *        # Quick access to most common functionality
      2 from fastai.text import *   # Quick access to NLP functionality

~/.local/lib/python3.6/site-packages/fastai/__init__.py in <module>
----> 1 from .basic_train import *
      2 from .callback import *
      3 #from .callbacks import *
      4 from .core import *
      5 from .basic_data import *

~/.local/lib/python3.6/site-packages/fastai/basic_train.py in <module>
      1 "Provides basic training and validation with `Learner`"
----> 2 from .torch_core import *
      3 from .basic_data import *
      4 from .callback import *
      5 

~/.local/lib/python3.6/site-packages/fastai/torch_core.py in <module>
      1 "Utility functions to help deal with tensors"
----> 2 from .imports.torch import *
      3 from .core import *
      4 
      5 AffineMatrix = Tensor

~/.local/lib/python3.6/site-packages/fastai/imports/__init__.py in <module>
----> 1 from .core import *
      2 from .torch import *

~/.local/lib/python3.6/site-packages/fastai/imports/core.py in <module>
      4 import abc, collections, hashlib, itertools, json, operator, pathlib
      5 import mimetypes, inspect, typing, functools, importlib
----> 6 import html, re, spacy, requests, tarfile, numbers
      7 
      8 from abc import abstractmethod, abstractproperty

~/.local/lib/python3.6/site-packages/spacy/__init__.py in <module>
      6 
      7 # These are imported as part of the API
----> 8 from thinc.neural.util import prefer_gpu, require_gpu
      9 
     10 from .cli.info import info as cli_info

~/.local/lib/python3.6/site-packages/thinc/neural/__init__.py in <module>
----> 1 from ._classes.model import Model

~/.local/lib/python3.6/site-packages/thinc/neural/_classes/model.py in <module>
     10 
     11 from .. import util
---> 12 from ..train import Trainer
     13 from ..ops import NumpyOps, CupyOps
     14 from ..mem import Memory

~/.local/lib/python3.6/site-packages/thinc/neural/train.py in <module>
      1 from __future__ import unicode_literals, print_function
      2 
----> 3 from .optimizers import Adam, SGD, linear_decay
      4 from .util import minibatch
      5 

optimizers.pyx in init thinc.neural.optimizers()

ops.pyx in init thinc.neural.ops()

ImportError: /home/user/.local/lib/python3.6/site-packages/murmurhash/mrmr.cpython-36m-x86_64-linux-gnu.so: file too short

Please suggest

Sounds like your versions are a bit wonky. I have been playing with fast.ai v1 and the feather stuff works with these lines to load it:

import feather
df_raw = feather.read_dataframe(‘tmp/bulldozers-raw’)

This thread is useful: Read_feather() function error