Fastai v0.7 install issues thread

(Yang Zheng) #68

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

0 Likes

(Stas Bekman) #69

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.

0 Likes

(Yang Zheng) #70

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

(enthusiast) #71

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

0 Likes

(amSaleh) #72

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.

0 Likes

(TonyTrinh) #73

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.

0 Likes

#74

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

0 Likes

Jupyter notebook fails to start
(Tom Hale) #75

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

0 Likes

(Shubhajit Das) #76

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?

0 Likes

How to know the document of version0.7?
About the Part 2 & Alumni (2018) category
(Vincent) #77

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

0 Likes

(Shubhajit Das) #78

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

0 Likes

(Shubhajit Das) #79

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.

0 Likes

#80

!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,

0 Likes

(ashis) #81

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

0 Likes

#82

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?

0 Likes

(Thomas) #84

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

0 Likes

(Ferhat H Kochan) #85

Hello, Im having issues downloading fastai. I’m getting this error but i did download pytoch

0 Likes

#86

fastai 0.7.0 not working Google Colaboratory anymore?

I am using Google Colaboratory and fastai 0.7.0

It worked fine some time back (I would guess in January this year),
now I am having a look at the notebooks, and they fail to run (without any code changes)

I have been using the dogs vs cats example from the course.

!pip install -q torchtext==0.2.3
!pip install -q fastai==0.7.0

torch.version
gives 0.3.1

arch=resnet34
data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
learn = ConvLearner.pretrained(arch, data, precompute=True)
learn.fit(0.01, 2)

module ‘torch.nn.init’ has no attribute ‘kaiming_normal_’

No idea why it worked some months back and what changed.

I try to figure out what the issue is, and it seems to be due a need to upgrade to pytorch:

I kill the Colab seesions, and reset try to upgrade
!pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.4.1-{platform}-linux_x86_64.whl torchvision

torch.version
gives 0.4.1

Running the code again
arch=resnet34
data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
learn = ConvLearner.pretrained(arch, data, precompute=True)
learn.fit(0.01, 2)

/usr/local/lib/python3.6/dist-packages/torch/cuda/init.py:114: UserWarning:
Found GPU0 Tesla T4 which requires CUDA_VERSION >= 9000 for
optimal performance and fast startup time, but your PyTorch was compiled
with CUDA_VERSION 8000. Please install the correct PyTorch binary
using instructions from http://pytorch.org

warnings.warn(incorrect_binary_warn % (d, name, 9000, CUDA_VERSION))

so I think it is runs on CPU now instead, and it never finishes (it runs out of memory on colab after a while)

If I try to upgrade to pytorch 1.1 I get

ERROR: fastai 0.7.0 has requirement torch<0.4, but you’ll have torch 1.1.0 which is incompatible.

Anyone successfully running 0.7.0 in Colab now?

0 Likes

(Kaushal Kumar Jha) #87

After creating the environment…when trying to activate by "
conda activate fastai-cpu"
I am getting below error
CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate’.
To initialize your shell, run

$ conda init <SHELL_NAME>
0 Likes

(Milind Deore) #88

I have created docker container for FastAI version 0.7.0. You can runn following command to pull the container:

docker pull mdeore/fastai_0_7_0

Hope this helps.

0 Likes