Fastai v0.7 install issues thread

Ho sorry, it was with a \, but it got escaped by the forum, I doubled it :slight_smile: or yes, with quotes.

Even better:
!pip install torchtext==0.2.3

2 Likes

pip is a packaging tool, I’m not sure why you expect the kernel to have the latest unless you have run: pip update -U pip :wink:

1 Like

For anyone using kaggle kernels. Kaggle downgraded fastai to 0.7 in kernels. Not sure what’s the plans there to upgrade to v1. But old courses run fine for now.

1 Like

For anyone using paperspace this is what finally worked for me after multiple failed attempts.

1). Started from scratch by deleting fastai folder and followed install instructions above by @stas
2). Changed ~/.jupyter/jupyter_notebook_config.py file as follows: uncomment and set c.NotebookApp.open_browser = False, uncomment and set c.NotebookApp.ip = ‘0.0.0.0’, and uncomment and set c.NotebookApp.allow_remote_access =True
3). After launching jupyter notebook I inserted my ip before :888 i.e. http://[my_ip_here]:8888…

Also, make sure the fastai env is active otherwise you’ll get errors when running code in the notebooks.

just followed all the steps for installation on linux.
Getting same error message
ModuleNotFoundError: No module named 'bcolz’
If I comment out first line then:

`---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
in ()
1 #from fastai.imports import *
----> 2 from fastai.torch_imports import *
3 from fastai.transforms import *
4 from fastai.conv_learner import *
5 from fastai.model import *
~/Downloads/fastai/courses/dl1/fastai/torch_imports.py in ()
1 import os
2 from distutils.version import LooseVersion
----> 3 import torch, torchvision, torchtext
4 from torch import nn, cuda, backends, FloatTensor, LongTensor, optim
5 import torch.nn.functional as F

ModuleNotFoundError: No module named 'torchtext'

I have tried all other method posted but getting same errors!
Please help @stas

1 Like

Please use forum search for when encountering problems, there is a whole thread with solutions about this issue:

I’m struggling to get the fastai module to work on Spyder. I’ve followed the instructions in this thread and created a separate environment using conda, but when I run spyder in this environment and try to import the fastai library, I get this error:

import fastai
Traceback (most recent call last):

File “”, line 1, in
import fastai

File “C:\Users\User\Anaconda3\lib\site-packages\fastai_init_.py”, line 1, in
from .basic_train import *

File “C:\Users\User\Anaconda3\lib\site-packages\fastai\basic_train.py”, line 2, in
from .torch_core import *

File “C:\Users\User\Anaconda3\lib\site-packages\fastai\torch_core.py”, line 2, in
from .imports.torch import *

File “C:\Users\User\Anaconda3\lib\site-packages\fastai\imports_init_.py”, line 2, in
from .torch import *

File “C:\Users\User\Anaconda3\lib\site-packages\fastai\imports\torch.py”, line 3, in
from torch import nn, optim, as_tensor

ImportError: cannot import name ‘as_tensor’

I’m assuming its because I’ve got an incompatible version of one of the packages but I’m not adept with anaconda prompt, and have no idea how to downgrade packages if that’s whats needed.

Which packages are wrong and how do I fix them using conda?

Can someone explain how does method 1 works to install 0.7.0?
If you pull from the git, then fastai will be v1? Am I missing something?

On AWS ECS DLAMI instance, I also had to
conda install -c ericmjl environment_kernels
before jupyter notebook could launch.

I tried to install fastai (for GPU use), after installing fastai-cpu.
Got the following issue: ‘Solving Environment’:

"ResolvePackageNotFound:

  • cuda90"

EDIT: ‘Resolved’ it by commenting out cuda90 in the environment.yml file.
Well, at least it is working now.

1 Like

I have tried Lesson 1 in Google Colab and documented the steps here.

And here is my notebook with the exact steps and sample output.

Still facing one issue related to feather.read_dataframe. I think its a version mismatch issue. Many folks reported same issue in PyArrow forum also. I am still searching for a work around. For now I have ignored the error and went ahead with the remaining steps in the lesson.

Here are the forum threads I have came across. As per the update, the issue is fixed in latest version of pandas.:


I have tried Lesson 1 using Clouderizer and Google Colab. But facing one issue with PyArrow.

df_raw = pd.read_feather(’/content/clouderizer/fast.ai/data/bulldozers-raw’)

But got below error:


TypeError Traceback (most recent call last)
in ()
----> 1 df_raw = pd.read_feather(’/content/clouderizer/fast.ai/data/bulldozers-raw’)

/usr/local/lib/python3.6/dist-packages/pandas/io/feather_format.py in read_feather(path, nthreads)
110 return feather.read_dataframe(path)
111
–> 112 return feather.read_dataframe(path, nthreads=nthreads)

TypeError: read_feather() got an unexpected keyword argument ‘nthreads’


Ran pd.version in the cell
Output: ‘0.22.0’

Appreciate your help.

I have documented all the steps, screenshots and the workarounds I have tried here.

This is a bit confusing for me as well but it may be answered by the comments at the top of the environment.yml file in the fastai/fastai directory that is reference in the third step in 1a.

# use/edit this file only for working with fastai-0.7.x version
# for fastai-1.0+ edit "setup.py" and use "pip install -e ."
# or "pip install -e .[dev]" for extra developer requirements

At first, I want to say thx for your sharing. I am a new deep learning learner.when I follow your method 1 to install fastai , I met the problem below:

Complete output from command python setup.py egg_info:
Download error on https://pypi.org/simple/pbr/: Remote end closed connection without response -- Some packages may not be found!
Couldn't find index page for 'pbr' (maybe misspelled?)
Download error on https://pypi.org/simple/: Remote end closed connection without response -- Some packages may not be found!
No local packages or working download links found for pbr>=2.0.0
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-vuyhiu5p/cliff/setup.py", line 29, in <module>
    pbr=True)
  File "/home/nobabe/anaconda3/envs/fastai/lib/python3.6/site-packages/setuptools/__init__.py", line 142, in setup
    _install_setup_requires(attrs)
  File "/home/nobabe/anaconda3/envs/fastai/lib/python3.6/site-packages/setuptools/__init__.py", line 137, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/home/nobabe/anaconda3/envs/fastai/lib/python3.6/site-packages/setuptools/dist.py", line 586, in fetch_build_eggs
    replace_conflicting=True,
  File "/home/nobabe/anaconda3/envs/fastai/lib/python3.6/site-packages/pkg_resources/__init__.py", line 780, in resolve
    replace_conflicting=replace_conflicting
  File "/home/nobabe/anaconda3/envs/fastai/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1063, in best_match
    return self.obtain(req, installer)
  File "/home/nobabe/anaconda3/envs/fastai/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1075, in obtain
    return installer(requirement)
  File "/home/nobabe/anaconda3/envs/fastai/lib/python3.6/site-packages/setuptools/dist.py", line 653, in fetch_build_egg
    return cmd.easy_install(req)
  File "/home/nobabe/anaconda3/envs/fastai/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 673, in easy_install
    raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('pbr>=2.0.0')

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-vuyhiu5p/cliff/

CondaValueError: pip returned an error

Have you tried googling the error? https://www.google.com/search?q=“couldn’t+find+index+page+for+‘pbr’+(maybe+misspelled%3F)”. It doesn’t look to be related to fastai, but to your environment.

thx a lot, I have tried to google it, it seems my network problem I tried to solve it but failed, the next day I run the same command it goes well, I guess it‘s’ my network proxy problem。so anyone who met this problem could check the network is OK。

1 Like

Hi, I followed instructions here Wiki thread: lesson 1 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

Hello there!
I used this code for installation:

git clone https://github.com/fastai/fastai.git
cd fastai
conda env create -f environment.yml

Now I run imdb notebook and when I came to this line:
Tokenizer().process_all(texts)
I got this error:

---------------------------------------------------------------------------
    NameError                                 Traceback (most recent call last)
    <ipython-input-21-51e26f4b98a3> in <module>
    ----> 1 tok_trn, trn_labels = get_all(df_trn, 1)
          2 tok_val, val_labels = get_all(df_val, 1)

<ipython-input-19-2580616f3669> in get_all(df, n_lbls)
      3     for i, r in enumerate(df):
      4         print(i)
----> 5         tok_, labels_ = get_texts(r, n_lbls)
      6         tok += tok_;
      7         labels += labels_

<ipython-input-18-8adcf082b5c5> in get_texts(df, n_lbls)
      6 
      7 #     tok = Tokenizer().proc_all_mp(partition_by_cores(texts))
----> 8     tok = Tokenizer().process_all(texts)
      9     return tok, list(labels)

NameError: name 'Tokenizer' is not defined

I found that I need to import fastai.text to resolve this error but I don’t know how to install it!(It is not mentioned as dependencies on conda installation)
In the first line of notebook there is a description:

[quote=“amsali, post:72, topic:24652, full:true”]
Hello there!
I used this code for installation:

git clone https://github.com/fastai/fastai.git
cd fastai
conda env create -f environment.yml

Now I run imdb notebook and when I came to this line:
Tokenizer().process_all(texts)
I got this error:

---------------------------------------------------------------------------
    NameError                                 Traceback (most recent call last)
    <ipython-input-21-51e26f4b98a3> in <module>
    ----> 1 tok_trn, trn_labels = get_all(df_trn, 1)
          2 tok_val, val_labels = get_all(df_val, 1)

<ipython-input-19-2580616f3669> in get_all(df, n_lbls)
      3     for i, r in enumerate(df):
      4         print(i)
----> 5         tok_, labels_ = get_texts(r, n_lbls)
      6         tok += tok_;
      7         labels += labels_

<ipython-input-18-8adcf082b5c5> in get_texts(df, n_lbls)
      6 
      7 #     tok = Tokenizer().proc_all_mp(partition_by_cores(texts))
----> 8     tok = Tokenizer().process_all(texts)
      9     return tok, list(labels)

NameError: name 'Tokenizer' is not defined

I found that I need to import fastai.text to resolve this error but I don’t know how to install it!(It is not mentioned as dependencies on conda installation)
Can anybody help?
Thanks.

At Fast.ai we have introduced a new module called fastai.text which replaces the torchtext library that was used in our 2018 dl1 course. The fastai.text module also supersedes the fastai.nlp library but retains many of the key functions.

So fastai.text is introduced in version 1 but the imdb script is meant to be run on v0.7.

the notebooks under courses/*/*.ipynb currently still work with the v0.7 code base

Can anybody help?
Thanks.

Hey,

So I followed the instructions of:
git clone https://github.com/fastai/fastai.git
cd fastai
conda env create -f environment-cpu.yml

and then I:
source activate fastai-cpu

Then I: went into jupyter notebook and went into lesson1.ipynb.
However I’m having difficulties whenever I shift+enter the code to run it, it keeps on giving me errors. Is anyone else having this issue and how did you fixed it? I attached a screenshot for reference.

Hi
Although this a a fix that works for the Paperspace etc. I have this issue in my local environment, and consider setting

allow_remote_access = True

to be a security issue locally.

I am trying to set a local environment with python = 3.7 and have followed the installation instructions played out in the documents for V1 in a virtual environment. The only difference with other environments are fastai 0.7 and python 3.6 in which the command

jupyter notebook

work fine. Any ideas where this difference is in the environments. which must read the same ~/.jupyter config file.

remote access

I filed this also at the above URL until I came across a note pointing to this discussion. Note that the issue is different than that posted by @gnarmis.

It possibly is Linux specific because I followed the same path on my Mac OSX 10.11.6 machine and 'jupyter notebook works fine there. Or something has changed in the last few days no more than 2 since I conda installed pytorch and fastai in both environments
Regards

EDIT…

Using the following command my new fast-3.7 environment server is now running

jupyter notebook --ip=‘localhost’ --port=8888

I note also using the

jupiter notebook --debug option

That a config file is loaded from the env fastai3.7 which is not the same for the env fastai which is 3.6 specific.

Regards