Fastai v1 install issues thread

fatai doesn’t support Windows yet. A temporary fix is to set num_workers=0 each time you call a databunch to avoid doing multiprocessing.

Thanks @sgugger for your response. But I am already using num_workers=0.

Code:

data = (ImageItemList.from_folder(path/‘train’)
.random_split_by_pct(0.2)
.label_from_folder()
.transform(tfms, size=224,bs=32,padding_mode=‘zeros’,num_workers=0)
.databunch())

In databunch, transform doesn’t know what to do with it :wink:

Okay…so how can i fix this issue? Please suggest

PicklingError: Can’t pickle <function crop_pad at 0x000001F39C8A9A60>: it’s not the same object as fastai.vision.transform.crop_pad

Thanks for pointing me in the right direction! I had to do the installation a bit differnet (Ubuntu 18.04 / Cuda 9.2) because the nvidia-396 package was not found with apt install, even after adding the ppa repo?

I did follow the instructions here and now everything works fine again :slight_smile:

sudo apt purge nvidia-*
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo ubuntu-drivers autoinstall <- checks if there are dependency problems
sudo apt upgrade
sudo ubuntu-drivers autoinstall
sudo reboot

I’m encountering this??
It was working with 1.0.28.dev0
I think something it’s missing on the GitHub
++++

Installing collected packages: fastai
Found existing installation: fastai 1.0.29.dev0
Uninstalling fastai-1.0.29.dev0:
Successfully uninstalled fastai-1.0.29.dev0
Running setup.py develop for fastai
Successfully installed fastai

++++
(base) C:\Users\gerar\fastai>python
Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type “help”, “copyright”, “credits” or “license” for more information.

import fastai
C:\Users\gerar\Anaconda3\lib\importlib_bootstrap.py:219: RuntimeWarning: cymem.cymem.Pool size changed, may indicate binary incompatibility. Expected 48 from C header, got 64 from PyObject
return f(*args, **kwds)
C:\Users\gerar\Anaconda3\lib\importlib_bootstrap.py:219: RuntimeWarning: cymem.cymem.Address size changed, may indicate binary incompatibility. Expected 24 from C header, got 40 from PyObject
return f(*args, **kwds)
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\gerar\fastai\fastai_init_.py”, line 10, in
from .train import *
File “C:\Users\gerar\fastai\fastai\train.py”, line 3, in
from .callbacks import *
File “C:\Users\gerar\fastai\fastai\callbacks_init_.py”, line 11, in
from .loss_metrics import *
ModuleNotFoundError: No module named ‘fastai.callbacks.loss_metrics’

This was a temporary break. Should be fixed now.

Thanks!!

After making a conda update --all I get this error when loading from fastai import * in the lesson5-sgd-mnist.ipynb notebook:

~/anaconda3/lib/python3.6/site-packages/spacy/compat.py in <module>
     32     from thinc.neural.optimizers import Optimizer
     33 except ImportError:
---> 34     from thinc.neural.optimizers import Adam as Optimizer
     35 
     36 pickle = pickle

ImportError: cannot import name 'Adam'

The error seems to come from Spacy/Thinc but those packages were not updated in the last conda update.

Those are my versions of those packages:

# Name    Version    Build  Channel
spacy     2.0.12     py36h6440ff4_0  
thinc     6.10.3     py36h6440ff4_0

I also found this GitHub issue thread with @Stas: https://github.com/explosion/spaCy/issues/2849

When I remove Spacy from the core.py the import works.

Kind regards
Michael

(I moved your post to this thread from dev chat, @MicPie)

You’re not using the right spacy. You need: spacy ==2.0.16

try:

conda install fastai -c fastai

And if you do conda update --all check that some other package doesn’t downgrade it to 2.0.12, but it shouldn’t happen since it’d conflict with fastai dependency.

1 Like

Hello! After fastai v1 installation I’m trying to run examples. However I see differenet errors:



Diagnostic info is also there.
What could be the problem?

@turegum, you installed fastai-1.0.6, whereas the current version is 1.0.29. That’s why your code isn’t working.

=== Software === 
python version  : 3.6.6
fastai version  : 1.0.6
torch version   : 1.0.0.dev20181124

Please follow the instructions here and make sure you have the latest version installed before attempting to run the code. https://github.com/fastai/fastai/blob/master/README.md#installation

@stas, thank you for reply, but how to do it exactly?
I follow installation doc (using conda), but version 1.0.6 is installed and cannot be upgraded:

(fastai) oleg@ubuntu-pc:~/DL$ conda install -c fastai fastai
Solving environment: done

## Package Plan ##

  environment location: /home/oleg/anaconda3/envs/fastai

  added / updated specs: 
    - fastai


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    fastprogress-0.1.16        |             py_0          13 KB  fastai

The following NEW packages will be INSTALLED:

    dataclasses:  0.6-py_0     fastai
    fastai:       1.0.6-py_1   fastai
    fastprogress: 0.1.16-py_0  fastai
    typing:       3.6.4-py36_0       

Proceed ([y]/n)? y


Downloading and Extracting Packages
fastprogress-0.1.16  | 13 KB     | ##################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(fastai) oleg@ubuntu-pc:~/DL$ conda update fastai
Solving environment: done

# All requested packages already installed.

You have a conflict of dependencies. You have some package installed in your conda env that pinned another package to a fixed version and only fastai-1.0.6’s dependencies agree with that fixed version. Unfortunately conda is not user-friendly to tell you that. You may have to add -v, -vv, or -vvv and look through the verbose output to see which package conflicts.

conda install -v -c fastai fastai

The easiest solution is to create a new conda environment for fastai as the docs suggest.
Alternatively use pip install (onto the same conda env), but it’ll probably break that other package that depends on some fixed number of another dependency.

Here is a little example to understand the dependency conflict.

say anaconda.org has these 5 packages:

package A==1.0.17 depends on package P==1.0.5
package B==1.0.06 depends on package P==1.0.5
package B==1.0.29 depends on package P==1.0.6
package P==1.0.5
package P==1.0.6

if you conda installed A==1.0.17, and now trying to install conda install B, conda will install an older B==1.0.6 version of that package, rather than the latest B==1.0.29, because it needs a higher version of P, but conda can’t install B==1.0.29 because then it’ll break previously installed package A. However if it installs B==1.0.6 there is no conflict.

It’d have been nice for conda to just tell us that: there is a newer package B available, but it can’t install it because it conflicts on dependency with package A which needs P of such and such version. But this is not the case.

2 Likes

Thank you for your patience! I catch your idea and now it works perfectly.

1 Like

I have just created a new environment of conda but can not install torchvision-nightly by conda install -c fastai torchvision-nightly

The commands I used are:

conda create -n fastaiv1
source activate fastaiv1
conda install -c pytorch pytorch-nightly cuda92
conda install -c fastai torchvision-nightly

This error appeared:

SafetyError: The package for torchvision-nightly located at /home/hoatruong/anaconda3/pkgs/torchvision-nightly-0.2.1-py_0
appears to be corrupted. The path 'site-packages/torchvision/transforms/transforms.py'
has a sha256 mismatch.
reported sha256: 23cb9d2c348b3299ed5d85b41f614154be238171f85779d26f71e20c7268eaae
actual sha256: 0f679e0e1f391a391828828d53c313482359b403df5ba8a8afbbef661198677e

This is a first time I install the library in a virtual environment of conda since the library is changing fastly and I need to update the library while keeping my old code works :smiley: . I am appreciated if someone can help me on this problem.

Hi, I am trying to import fastai on Google Colab but I am facing a ‘ModuleNotFoundError’ issue:

ModuleNotFoundError Traceback (most recent call last)
in ()
----> 1 import fastai
2 from fastai import *
3 from fastai.text import *
4 import pandas as pd
5 import numpy as np

/usr/local/lib/python3.6/dist-packages/fastai/init.py in ()
----> 1 from .basic_train import *
2 from .callback import *
3 #from .callbacks import *
4 from .core import *
5 from .basic_data import *

/usr/local/lib/python3.6/dist-packages/fastai/basic_train.py in ()
1 "Provides basic training and validation with Learner"
----> 2 from .torch_core import *
3 from .basic_data import *
4 from .callback import *
5

/usr/local/lib/python3.6/dist-packages/fastai/torch_core.py in ()
1 “Utility functions to help deal with tensors”
----> 2 from .imports.torch import *
3 from .core import *
4
5 AffineMatrix = Tensor

/usr/local/lib/python3.6/dist-packages/fastai/imports/init.py in ()
----> 1 from .core import *
2 from .torch import *

/usr/local/lib/python3.6/dist-packages/fastai/imports/core.py in ()
11 from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
12 from copy import copy, deepcopy
—> 13 from dataclasses import dataclass, field
14 from enum import Enum, IntEnum
15 from fastprogress import master_bar, progress_bar

ModuleNotFoundError: No module named ‘dataclasses’

I suspect it is because the nightly version of Pytorch was just recently updated on 20181205. I was able to import fastai without any issues the day before. Is there any way to fix the issue? Thank you very much!

Here’s what I did on google colab (after running the script that installs latest torch and fastai):

!pip uninstall fastai 
!pip install fastai==1.0.32

That was 12 hrs ago. Not sure if more recent changes were made to either torch or fast.

It should be fixed with the latest release.

2 Likes

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