Fastai v1 install issues thread

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.

installing dev dependencies triggered an update to your pip.

Google is your friend (well, sometimes) - please always try to search for the error on google first.

This seems to be an issue with pyenv.

But I found a thread that compiles all potential reasons.

This one suggests a conflict between ubuntu pip and manually installed pip.

You are right; in retrospect, this is more of a gripe with whatever python is doing, and that pip can just be overwritten even when I’m not using sudo. I thought it might be due to something in the fastai install, but I suppose not. My apologies. To be fair, I did read all of those prior to posting here, and thought that it was odd that only the final fastai installation step (from the git repo) nuked my pip3, but if this is the norm, so be it.

No damage done, it’s often hard to tell what triggered the problem. I personally just have a habit to instantly paste the error into google and often that gets resolved instantly.

Moreover, we do want to hear about dependency issues like what you have reported, so that we could document them to make the installation process as pain-free as possible. It could go into http://docs-dev.fast.ai/troubleshoot.html.

Therefore, once you find a solution to your problem, please post it here in reply to your message.

Thank you, @jamesp

I do see what you’re talking about in the installation log:

Collecting pip>=18.1 (from fastai==1.0.7.dev0)
  Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl

I will see if I can figure out how to safely upgrade to 18.1+ before installing fastai. Alternatively, if fastai doesn’t really require 18.1+, that might be useful.

And from setup.py:

dev_requirements = { 'dev' : to_list("""
    distro
    jupyter_contrib_nbextensions
    pip>=18.1
    pipreqs>=0.4.9
    pytest
    wheel>=0.30.0
""") }

So, it’s defined as a requirement in the dev build. If that’s really a requirement, I’ll see what I can figure out about the Ubuntu 18 mess. Thanks!

It’s unlikely we will downgrade this requirement. It’s a foundational tool and older versions have their own problems. If it has a problem it needs to be fixed and not worked around it. If your situation is not covered by the 3 links I posted earlier, open a new issue with pip on that same site the links are on.

And yes, isolating the upgrade from fastai is a very smart approach.

1 Like

I’m on ubuntu 18 and I don’t have any issue with it.

Perhaps switch to using a conda env? This is what I use. Somethink like: http://docs-dev.fast.ai/release#run-install-tests-in-a-fresh-environment

I think it’s an important recommendation because you don’t want to mess with system-wide packages. Earlier I did and broke something things. This time around I don’t touch system-wide python at all.

I will add this recommendation to docs.

1 Like

I think you are exactly right. In my case, it’s probably less about fastai messing with my system, as it is my system having messed up settings, causing fastai’s installation to reveal the brokenness. I say this because when I follow the docs on a fresh vm without any modification, I have no issues. Thanks for your pointers re: conda.

1 Like

Have you tried, with CUDA 9.2?