Fastai v0.7 install issues thread

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

Google Colab:
For a single code cell to successfully run v2 of lesson1.ipynb, check out this answer.

ssh-ing into gce with command gcloud compute --project " " ssh --zone " " jupyter@" " -- -L 8080:localhost:8080
I have followed the above steps 1a, 1b.
the problem is my notebook uses fastai v1.0.x , not v-0.7x (which is installed in the virtual env named fastai) , how do I access jupyter-notebook in v0.7 environment?

I am facing the same issue. The instructions lead to fastai-1.0 and not fastai-0.7

after installing conda install nb_conda_kernels , virtual env (fastai) is showing in the nb.
But after executing the cell containing from fastai.conv_learnerit’s showing the error ModuleNotFoundError: No module named ‘cv2’, below is the stack trace :

ModuleNotFoundError                 Traceback (most recent call last)
<ipython-input-8-4229a65c35de> in <module>
----> 1 from fastai.conv_learner import *
      2 from fastai.dataset import *
      3 
      4 from pathlib import Path
      5 import json

~/fastai/courses/dl2/fastai/conv_learner.py in <module>
----> 1 from .core import *
      2 from .layers import *
      3 from .learner import *
      4 from .initializers import *
      5 

~/fastai/courses/dl2/fastai/core.py in <module>
----> 1 from .imports import *
      2 from .torch_imports import *
      3 
      4 def sum_geom(a,r,n): return a*n if r==1 else math.ceil(a*(1-r**n)/(1-r))
      5 

~/fastai/courses/dl2/fastai/imports.py in <module>
      1 from IPython.lib.deepreload import reload as dreload
----> 2 import PIL, os, numpy as np, math, collections, threading, json, bcolz, random, scipy, cv2
      3 import pandas as pd, pickle, sys, itertools, string, sys, re, datetime, time, shutil, copy
      4 import seaborn as sns, matplotlib
      5 import IPython, graphviz, sklearn_pandas, sklearn, warnings, pdb

ModuleNotFoundError: No module named 'cv2'

Any way to solve this?

Note:
I had run pip freeze inside the virtual env (fastai), and opencv-python==4.0.0.21 is there. Also the symlink points to the corect location for v0.7 i.e. fastai -> ../../old/fastai

huh, what an idiot I am!!
just by doing pip install fastai==0.7 along with pip install torchtext==0.2.3 (otherwise, it will raise an error AttributeError: module ‘torch’ has no attribute ‘float32’) can make it work.

!pip install fastai==0.7.0
!pip install torchtext==0.2.3
from fastai.text import *
import html

I get Dataset not defined error.

NameError Traceback (most recent call last)
in
----> 1 from fastai.text import *
2 import html

~/notebooks/notebooks/fastai/courses/dl2/fastai/text.py in
1 from .core import *
----> 2 from .learner import *
3 from .lm_rnn import *
4 from torch.utils.data.sampler import Sampler
5 import spacy

~/notebooks/notebooks/fastai/courses/dl2/fastai/learner.py in
4 from .transforms import *
5 from .model import *
----> 6 from .dataset import *
7 from .sgdr import *
8 from .layer_optimizer import *

~/notebooks/notebooks/fastai/courses/dl2/fastai/dataset.py in
185 return full_names, label_arr, all_labels
186
–> 187 class BaseDataset(Dataset):
188 “”“An abstract class representing a fastai dataset. Extends torch.utils.data.Dataset.”""
189 def init(self, transform=None):

NameError: name ‘Dataset’ is not defined

How to resolve this? Can someone please help me?
Thank you,

Hi friends,
Recently, I came across many problems after installing fastai v 0.7.0 for Part 2 of the course.
Unfamiliar Error when Running learn.fit().
Did any of you folks came across such problem and managed to get a solution for this.
Really appreciate your efforts.
Thanks,
Ashis

Hi, I’m having the same error you talked about in here, and the symlink seems fine as well. Did you ever figure out what was the problem?

I forget the specifics now. But I think I was not running the conda environment. It was a simple fix like that.