Fastai v1 install issues thread

Probably a network issue on your side. Try again. But notice that pytorch-1.0 is out, so the instructions have changed: https://github.com/fastai/fastai/blob/master/README.md#installation

1 Like

… *requires PyTorch v1 (currently in preview) …
should read: (available).

Thanks @stas . I have tried last night with the new command and it worked perfectly

1 Like

!curl https://course-v3.fast.ai/setup/colab | bash
I face all of sudden installation issue in colab.

Every thing was fine till morning .
Is any change done in fai version
Please help…

—> 2 from .data import *
3 from .image import *
4 from .transform import *
5 from .tta import *

/usr/local/lib/python3.6/dist-packages/fastai/vision/data.py in ()
200
201 def verify_image(file:Path, idx:int, delete:bool, max_size:Union[int,Tuple[int,int]]=None, dest:Path=None, n_channels:int=3,
–> 202 interp=PIL.Image.BILINEAR, ext:str=None, img_format:str=None, resume:bool=False, **kwargs):
203 “Check if the image in file exists, maybe resize it and copy it in dest .”
204 try:

AttributeError: module ‘PIL’ has no attribute ‘Image’
AttributeError: module ‘PIL’ has no attribute ‘Image’

Thank you, @AbuFadl. Fixed.

AttributeError: module ‘PIL’ has no attribute ‘Image’

There is a whole colab-specific thread about that: AttributeError: module ‘PIL.Image’ has no attribute ‘register_extensions

As PyTorch has released the stable v1 version few days ago, I tried to install that on Windows 10. The installation works fine (and pretty quick) and I import all libraries successfully! However when I run the first “learn.fit_one_cycle” in the “tutorial.data.ipynb”, I got error:

RuntimeError: Expected object of scalar type Long but got scalar type Int for argument #2 ‘target’

The target in this small MNIST dataset is a “fastai.core.Category”, and in this case it’s indeed set to “int” by fastai, on Windows. Just found out that this issue is addressed in PR #1267.

Anyway, in here I just want to share that if you have Windows, probably you want to use the stable version rather than building the nightly version, which takes very long time and has all kinds of weird issues…

fastai v1 doesn’t support windows yet, we will be working on it in the next few weeks.

2 Likes

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

Hi,
I’m trying to train my first network with fastai, but after trying to run
learn = ConvLearner.pretrained(arch, data, precompute=True)
I get this error:


NameError Traceback (most recent call last)
in
6 data = ImageClassifierData.from_csv(path=PATH, folder=‘test’, csv_fname=label_file,
7 val_idxs=val_idxs, suffix=’.jpg’, tfms=tfms_from_model(arch, sz), bs=bs)
----> 8 learn = ConvLearner.pretrained(arch, data, precompute=True)

~/anaconda3/envs/fastai/lib/python3.6/site-packages/fastai/conv_learner.py in pretrained(cls, f, data, ps, xtra_fc, xtra_cut, **kwargs)
92 @classmethod
93 def pretrained(cls, f, data, ps=None, xtra_fc=None, xtra_cut=0, **kwargs):
—> 94 models = ConvnetBuilder(f, data.c, data.is_multi, data.is_reg, ps=ps, xtra_fc=xtra_fc, xtra_cut=xtra_cut)
95 return cls(data, models, **kwargs)
96

~/anaconda3/envs/fastai/lib/python3.6/site-packages/fastai/conv_learner.py in init(self, f, c, is_multi, is_reg, ps, xtra_fc, xtra_cut)
46 fc_layers = self.get_fc_layers()
47 self.n_fc = len(fc_layers)
—> 48 self.fc_model = to_gpu(nn.Sequential(fc_layers))
49 apply_init(self.fc_model, kaiming_normal)
50 self.model = to_gpu(nn.Sequential(
(layers+fc_layers)))

NameError: name ‘to_gpu’ is not defined

Can somebody help me with this issue?
I use VM on google cloud with ubuntu system with fastai v. 1.0.36

Please see: https://docs.fast.ai/troubleshoot#support

If it doesn’t help please post the output of:

python -c 'import fastai; fastai.show_install(1)'

@Adam_Z, this thread is for installation issues.

Please post in another thread (probably a new one), and you will want to show all of the code leading to the error and not just the last line of it - and also please post your setup info as explained here https://docs.fast.ai/troubleshoot#support

I will make new thread then.
Thanks

I don’t have it running yet, I don’t know why I find to get it working so hard.

So here’s the exact steps I took :

  • create new conda env with python 3.6
  • installed fastai and pytorch usingconda install -c pytorch -c fastai fastai
  • uninstalled fastai with conda uninstall fastai (also checked there’s no pip installation)
  • Ran the following commands

git clone https://github.com/fastai/fastai
cd fastai
tools/run-after-git-clone
pip install -e .[dev]

But then importing fastai doesn’t work in the notebooks :ImportError: No module named 'fastai'

I really don’t see what I could be doing wrong, I followed the simplest doc I could find to the letter.

Please tell me if I should be posting this elsewhere.

@PierreO, I moved your post to this thread where it belongs.

First, I updated the instructions https://github.com/fastai/fastai/blob/master/README.md#developer-install - so it’s just the code you quoted, w/o needing to install/uninstall anything.

Second, you probably don’t have your conda env activated when you start jupyter so it’s looking for fastai in the system-wide python.

You can check with: https://docs.fast.ai/troubleshoot.html#support

python -c 'import fastai; fastai.show_install(1)'
2 Likes

All right it’s working thank you very much !

1 Like

Glad to hear it’s working.

And for the future, when you ask a question and then sort it out, please add details of what you did differently from your original post to make it work, so that others with the same issue will know how to resolve it too reading your resolution. Thank you.

1 Like

Note that:

python -c 'import fastai; fastai.show_install(1)'

has changed to:

python -m fastai.utils.show_install

2 posts were merged into an existing topic: Developer chat

@stas, I had a similar issue.

  1. Created an environment
  2. Ran conda install -c pytorch -c fastai fastai. At this point my jupyter notebook would fail when running from fastai import * and from fastai import vision.
  3. I then ran conda install nb_conda_kernels (as per this solution: https://stackoverflow.com/questions/39604271/conda-environments-not-showing-up-in-jupyter-notebook) and it worked perfectly.

I am using:

  • Python 3.6.7 :: Anaconda custom (64-bit)
  • OS: OSX 10.13.6