Fastai v1 install issues thread

Will the fast.ai deep learning part 1 course notes work with v1?

it will not. New part one will be happening shortly and that one will.

okay, thanks

Wiki mode has been turned on for the first post so you can edit it to improve it. Thank you.

I updated my fastai v1 library from the github repo just now (previously updated last night and working fine). Now, when I try to call image_data_from_csv, I am told it is not defined:

from fastai import *
from fastai.vision import *

data = image_data_from_csv(...)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-15-d7d8b5020c48> in <module>()
----> 1 data = image_data_from_csv('/root', 
      2     folder='1FhbiyAFNKcIbhL',
      3     test='/root/1FhbiyAFNKcIbhL-test',
      4     csv_labels='T1Mapped.' + trait + '.2col.tsv',
      5     ds_tfms=get_transforms(do_flip=False),

NameError: name 'image_data_from_csv' is not defined

Did the imports get rearranged in the nightly update?

There has been a changed of API as mentioned here. Look at the examples or the docs for more information.

Thanks. Now I am loading ImageDataBunch.from_csv(...) but I wonder if there has been a regression with the front slash / path / division issue:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-21-4ca507aa97d0> in <module>()
      5     ds_tfms=get_transforms(do_flip=False),
      6     bs=128, # Need larger batch size for rarer things (or balance them artificially)
----> 7     size=128)

/app/fastai/fastai/vision/data.py in from_csv(cls, path, folder, sep, csv_labels, valid_pct, fn_col, label_col, test, suffix, header, **kwargs)
    301             header:Optional[Union[int,str]]='infer', **kwargs:Any)->'ImageDataBunch':
    302         "Create from a csv file."
--> 303         df = pd.read_csv(path/csv_labels, header=header)
    304         return cls.from_df(path, df, folder=folder, sep=sep, valid_pct=valid_pct, test=test,
    305                 fn_col=fn_col, label_col=label_col, suffix=suffix, header=header, **kwargs)

TypeError: unsupported operand type(s) for /: 'str' and 'str'

Pass a Path object (by calling Path(path)) for now, we’ll add it there soon. Thanks for warning us!

1 Like

Perfect - that worked like a charm. Thank you!

Fixed in master. (Dunno who broke it. It really doesn’t matter. Right?)

3 Likes

Looks like there is an issue with spacy’s conda package dependencies, to get the newly released fastai-1.0.6 with conda working, I had to:

conda uninstall cymem spacy

and then:

conda install fastai -c fastai

It’s possible that the issue is only mine, since I was installing various versions of cymem a few days ago, trying to fix spacy's faulty 2.0.15 release. So perhaps it doesn’t affect anybody else. But the deps are still wrong.

I filed an issue here: https://github.com/explosion/spaCy/issues/2859

edit: the outcome of the issue - for the foreseeable future, until cymem-2 is released on conda, don’t mix pip and conda in the same environment when installing fastai due its dependency on spacy.

I had the same problem with spacy,.

Hi I’m having issues running jupyter notebook after installing fastai library on Ubuntu 18.04
Following previous instructions I created a separate conda env and installed packages as such (with cuda9.1):

conda create -y  python=3.6 --name fastai-py3.6
conda activate fastai-py3.6
conda install -y conda
conda install -y pip setuptools
conda install -y -c pytorch pytorch-nightly cuda91
conda install -y -c fastai torchvision-nightly
conda install -y -c fastai fastai
conda uninstall -y fastai
pip install -e .[dev]

I then activated my env and tried to run jupyter:

source activate  fastai-py3.6
jupyter notebook

which raised the following errors:

Traceback (most recent call last):
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/site-packages/traitlets/traitlets.py", line 528, in get
    value = obj._trait_values[self.name]
KeyError: 'allow_remote_access'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/site-packages/notebook/notebookapp.py", line 869, in _default_allow_remote
    addr = ipaddress.ip_address(self.ip)
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/ipaddress.py", line 54, in ip_address
    address)
ValueError: '' does not appear to be an IPv4 or IPv6 address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/workfit/anaconda3/envs/fastai-py3.6/bin/jupyter-notebook", line 11, in <module>
    sys.exit(main())
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/site-packages/notebook/notebookapp.py", line 1629, in initialize
    self.init_webapp()
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/site-packages/notebook/notebookapp.py", line 1379, in init_webapp
    self.jinja_environment_options,
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/site-packages/notebook/notebookapp.py", line 158, in __init__
    default_url, settings_overrides, jinja_env_options)
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/site-packages/notebook/notebookapp.py", line 251, in init_settings
    allow_remote_access=jupyter_app.allow_remote_access,
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/site-packages/traitlets/traitlets.py", line 556, in __get__
    return self.get(obj, cls)
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/site-packages/traitlets/traitlets.py", line 535, in get
    value = self._validate(obj, dynamic_default())
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/site-packages/notebook/notebookapp.py", line 872, in _default_allow_remote
    for info in socket.getaddrinfo(self.ip, self.port, 0, socket.SOCK_STREAM):
  File "/home/workfit/anaconda3/envs/fastai-py3.6/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

Any idea what’s going on?

it appears that issue was raised in another thread: Jupyter notebook keyerror thread
editing ~/.jupyter/jupyter_notebook_config.py worked for me

I am having issues installing on Windows 8.1. I have built pytorch but I cannot install torchvision-nightly. The output from

conda install -c fastai torchvision-nightly

is

Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  • torchvision-nightly
  • pytorch-nightly

Current channels:

I have therefore downloaded torchvision from

https://github.com/pytorch/vision/tree/master/torchvision

and installed following their instructions with

python setup.py install

I then can install fastai and run the below without any problems.

from fastai import *

however

from fastai.vision import *

is not found and results in the following error

ModuleNotFoundError: No module named ‘fastai.vision’

I am a beginner to python so I am not sure what I am missing?

Additionally I get the following output

=== Software ===
python version : 3.6.6
fastai version : 1.0.6
torch version : 1.0.0a0+7edfe11
torch cuda ver : 9.2
torch cuda is : available
torch cudnn ver : 7301
torch cudnn is : enabled

=== Hardware ===
torch available : 1

  • gpu0 : GeForce GTX 980M

=== Environment ===
platform : Windows-8.1-6.3.9600-SP0
conda env : test_fastai
python : D:\c_progs\Anaconda3\envs\test_fastai\python.exe
sys.path :
D:\c_progs\Anaconda3\envs\test_fastai\python36.zip
D:\c_progs\Anaconda3\envs\test_fastai\DLLs
D:\c_progs\Anaconda3\envs\test_fastai\lib
D:\c_progs\Anaconda3\envs\test_fastai
C:\Users\b8\AppData\Roaming\Python\Python36\site-packages
D:\c_progs\Anaconda3\envs\test_fastai\lib\site-packages
D:\c_progs\Anaconda3\envs\test_fastai\lib\site-packages\torchvision-0.2.1-py3.6.egg
D:\c_progs\Anaconda3\envs\test_fastai\lib\site-packages\win32
D:\c_progs\Anaconda3\envs\test_fastai\lib\site-packages\win32\lib
D:\c_progs\Anaconda3\envs\test_fastai\lib\site-packages\Pythonwin
D:\c_progs\Anaconda3\envs\test_fastai\lib\site-packages\IPython\extensions

from

python -c “import fastai; fastai.show_install(0)”

You’re a brave soul, @cudawarped. I think you might be the first one over here to build that on windows. It’s good to know that it works. Was it a straightforward follow the pytorch docs or did you need to use some know-how. I’m asking since perhaps you could start a fastai v1 windows 8 thread and share your tips there with others.

And yes you did have to build torchvision from source as you figured out. I will update the docs.

I then can install fastai and run the below without any problems.
fastai version : 1.0.6

This tells me you installed the prepackaged fastai (pip or conda)

from fastai import *
however
from fastai.vision import *
is not found and results in the following error
ModuleNotFoundError: No module named ‘fastai.vision’

do the following work?

  1. import torchvision
    testing that torchvision works.
  2. from fastai.text import *
    testing that other parts of fastai work

update: I added https://github.com/fastai/fastai/blob/master/README.md#building-from-source let me know if you suggest any additions to that section.

Hi, thank you for your response. Yes windows is unfortunate, however that’s the OS I develop for, and I would like to try the dl for coders part one course without having to dual boot my machine or pay to use the cloud.

Regarding pytorch, I compiled with Visual Studio Community 2017 and the steps were exactly as detailed on the website

https://github.com/pytorch/pytorch

I had to install the 14.11 toolset, because it wasn’t installed by default, but this is detailed in the pytorch instructions. I didn’t time the build, but it must have taken at least 3 hours. I tried to use ninja but without any success.
Once installed I had a missing dll error when importing torch but this was fixed with

conda install -c defaults intel-openmp -f

I think my installation may be missing a few components because some of the tests are failing, specifically test\test_torch.py, fails with the below error.

RuntimeError: No CUDA implementation of ‘gesdd’. Install MAGMA and rebuild cutorch (http://icl.cs.utk.edu/magma/) at D:\repos\pytorch\aten\src\thc\generic/THCTensorMathMagma.cu:332

My plan is to address that once I get fastai v1 to “work”(obviously if torch is slightly broken it can’t work 100%).

I can successfully do

  1. import torchvision
    however

  2. from fastai.text import *
    gives me


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

~\fastai\courses\dl1\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

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

~\fastai\courses\dl1\fastai\imports.py in
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 ‘bcolz’

Most likely this is something on my end, but on Ubuntu 18.04, I’m installing with pip3:

pip3 install torch_nightly -f https://download.pytorch.org/whl/nightly/cu92/torch_nightly.html
pip3 install fastai
pip3 uninstall fastai

Then I download the fastai library:

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

The weird thing is that after I install fastai from the repo, pip3 gets broken(!):

$ pip3
Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ImportError: cannot import name 'main'

I have actually fully uninstalled and reinstalled pip3 including all of its packages and confirmed that I can reproduce this on my machine. Anyone else seeing this?

Well done !

  • I spend a day without succes following the same steps af you. It fails on building caffe2 (one of the registrered issues on pytorch)
  • I am on windows 10 using cuda 10 for 1080TI.
  • Use d community version of visual studio and activated 14.11 as described on microsoft support pages

OK, we are hitting already enough of platform-specific problems to continue this discussion in a dedicated thread - I suggest that so that others like yourself will have an easier time finding all the windows8-related fastai-v1 issues in one place.

So would you kindly start a new thread, share everything you shared so far including errors (very important as people will search for those). And then reply to this post with the link to where this discussion has moved.

And afterwards see if this helps: "Error: No module named 'bcolz'." but bcolz is already installed.

Of course, most of the windows issues are the same for fastai 0.7 or 1.0 since they mostly have nothing to do with fastai which is just pure python code, but the building blocks which are platform-specific at times, with the only difference that fastai 1.0 has slightly different prerequisites and we have been trying hard to remove any dependencies on problematic packages.

Thank you.