Fastai v1 install issues thread

I tried to install fastai again in a new EC2 Instance. But I got an error when I install torchvision-nightly using “conda install -c fastai torchvision-nightly”. The error is:

Solving environment: failed

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

  • torchvision-nightly

Current channels:

To search for alternate channels that may provide the conda package you’re
looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.

Any idea?

The installation instructions have changed, please see: https://github.com/fastai/fastai/blob/master/README.md#installation

1 Like

I used

conda install -c pytorch -c fastai fastai

and it worked like a charm.

It would be nice if the installation description at AnacondaCloud would also be updated:
https://anaconda.org/fastai/fastai

I am trying to execute the code but getting following error when i try to execute
from fastai.vision import *
ModuleNotFoundError: No module named ‘fastai.vision’

But,
from fastai import * - this works smoothly

I am not sure, is this the correct thread to ask this issue

It’s not possible at the moment. Anaconda.org thinks it’s the right command, and won’t let the maintainer to edit it to set it right. I have the same problem with other modules that require custom -c channel.

I filed a bug report with anaconda.org, but based on my previous experience with doing that, it may take months for anybody to respond there, and then usually a clueless support person will have no idea what to do with it and would say, I will pass the request on, thank you. :frowning:

This is the right place, @niki196 . But, please, see: https://docs.fast.ai/support.html#reporting-installation-issues

Most likely you installed fastai into one location, but running your notebook from another. But I have no way of telling what you have been doing to give you a helpful answer.

Thanks @stas… you are absolutely correct :slight_smile:

1 Like

I’m having issues installing as well. Hoping to get some help as well @stas .

Problem:

  • No module named ‘fastai.vision’
  • CUDA no longer detected. Worked fine in my FastAI .7 installation

Steps I’ve tried:

  1. Works:
    import torchvision
    from fastai.text import *

  2. import sys
    print(sys.path)
    [’’, ‘/home/ray/anaconda3/envs/fastai/lib/python36.zip’, ‘/home/ray/anaconda3/envs/fastai/lib/python3.6’, ‘/home/ray/anaconda3/envs/fastai/lib/python3.6/lib-dynload’, ‘/home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages’, ‘/home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages/defusedxml-0.5.0-py3.6.egg’, ‘/home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages/torchvision-0.2.0-py3.6.egg’, ‘/home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages/IPython/extensions’, ‘/home/ray/.ipython’]

  3. Steps documented in https://docs.fast.ai/support.html#reporting-installation-issues . This is the output

(fastai) ray@rayml:~$ python -c ‘import fastai.utils.collect_env; fastai.utils.collect_env.show_install(1)’

=== Software === 
python version : 3.6.8
fastai version : 1.0.34
torch version  : 1.0.0
nvidia driver  : 396.44
torch cuda ver 
torch cuda is  : **Not available** 

=== Hardware === 
nvidia gpus    : 1
Have 1 GPU(s), but torch can't use them (check nvidia driver) 

=== Environment === 
platform       : Linux-4.4.0-21-generic-x86_64-with-debian-stretch-sid
distro         : #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016
conda env      : fastai
python         : /home/ray/anaconda3/envs/fastai/bin/python
sys.path       : 
/home/ray/anaconda3/envs/fastai/lib/python36.zip
/home/ray/anaconda3/envs/fastai/lib/python3.6
/home/ray/anaconda3/envs/fastai/lib/python3.6/lib-dynload
/home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages
/home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages/defusedxml-0.5.0-py3.6.egg
/home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages/torchvision-0.2.0-py3.6.egg
/home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages/IPython/extensions

Tue Jan  8 23:02:32 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.44                 Driver Version: 396.44                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1070    Off  | 00000000:01:00.0 Off |                  N/A |
|  0%   46C    P5    21W / 151W |      0MiB /  8117MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

Please make sure to include opening/closing ``` when you paste into forums/github to make the reports appear formatted as code sections.

Optional package(s) to enhance the diagnostics can be installed with:
pip install distro
Once installed, re-run this utility to get the additional information

Does the error come in the notebook cell, or the console, @Raymond-Wu ? did you make sure you activated your conda env before starting jupyter?

Run the same show_install code from the notebook cell, so you will know for sure.

Besides, you’re using an old version of fastai, which tells me you probably have some kind of environment issues. i.e. if you have just installed fastai, it would have been version 1.0.39.

If everything else fails, create a new env, activate it, install fastai in there and check whether it works.

Here’s a notebook output @stas . I am using my fastai environment in both the terminal as well as the notebook.

Odd regarding the Fastai version. I just updated it right before I posted. This is the latest version I’m getting from conda install

Try to install the specific (latest as of this comment) version:

conda install -c fastai fastai==1.0.39

If it doesn’t install that means you have a conflict of dependencies, create a fresh env and install there
https://docs.fast.ai/troubleshoot.html#cant-install-the-latest-fastai-conda-package

Tried creating a brand new environment as well and installing there. This was the error that popped up in my old fastai environment as well as the new fastaiv1test environment

Sorry, forgot to add the pytorch channel, please try again with:

conda install -c pytorch -c fastai fastai==1.0.39

Not needed. I redid python -c ‘import fastai.utils.collect_env; fastai.utils.collect_env.show_install(1)’ in the terminal and this was the output. It seems to have upgraded fastai to 1.0.40. Unfortunately I’m still getting the same issue shown in my notebook in the last post where the notebook I have set up (with accompanying fastai env):

ModuleNotFoundError: No module named ‘fastai.utils’
ModuleNotFoundError: No module named ‘fastai.vision’

=== Software === 
python        : 3.6.8
fastai        : 1.0.40.dev0
fastprogress  : 0.1.18
torch         : 1.0.0
nvidia driver : 396.44
torch cuda    : None / is **Not available** 

=== Hardware === 
nvidia gpus   : 1
Have 1 GPU(s), but torch can't use them (check nvidia driver) 

=== Environment === 
platform      : Linux-4.4.0-21-generic-x86_64-with-debian-stretch-sid
distro        : #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016
conda env     : fastai
python        : /home/ray/anaconda3/envs/fastai/bin/python
sys.path      : 
/home/ray/anaconda3/envs/fastai/lib/python36.zip
/home/ray/anaconda3/envs/fastai/lib/python3.6
/home/ray/anaconda3/envs/fastai/lib/python3.6/lib-dynload
/home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages
/home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages/defusedxml-0.5.0-py3.6.egg
/home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages/torchvision-0.2.0-py3.6.egg

Wed Jan  9 10:43:11 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.44                 Driver Version: 396.44                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1070    Off  | 00000000:01:00.0 Off |                  N/A |
|  0%   46C    P5    21W / 151W |      0MiB /  8117MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

Edit: I’m going to try updating CUDA + accompanying driver version since that is the only glaring issue I can see.

You’re having 1.0.40.dev0, please don’t mix it with 1.0.40 which hasn’t been released. It means you have installed fastai from git.

Those are two completely different issues.

Can you check that the fastai library is actually there?

ls -l /home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages/fastai/

It’s odd that you have

torchvision-0.2.0-py3.6.egg

in your path, it’s an old torchvision version - uninstall it with pip uninstall torchvision (sometimes have to do it twice), and then reinstall with conda/pip should be 0.2.1

My apologies for the confusion. In terms of this command

this is the returned output:

(fastai) ray@rayml:/var/log$ ls -l /home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages/fastai/
total 184
-rw-rw-r-- 3 ray ray 8502 Dec 6 08:39 basic_data.py
-rw-rw-r-- 3 ray ray 19832 Dec 5 09:54 basic_train.py
-rw-rw-r-- 3 ray ray 14524 Dec 4 10:17 callback.py
drwxrwxr-x 3 ray ray 4096 Jan 8 22:08 callbacks
-rw-rw-r-- 3 ray ray 4431 Dec 4 10:17 collab.py
-rw-rw-r-- 3 ray ray 11463 Dec 4 10:17 core.py
-rw-rw-r-- 3 ray ray 25557 Dec 5 10:16 data_block.py
-rw-rw-r-- 3 ray ray 4729 Dec 5 09:54 datasets.py
drwxrwxr-x 3 ray ray 4096 Jan 8 22:08 gen_doc
drwxrwxr-x 3 ray ray 4096 Jan 8 22:08 imports
-rw-rw-r-- 3 ray ray 807 Dec 4 10:17 init.py
-rw-rw-r-- 3 ray ray 10286 Dec 6 08:39 layers.py
-rw-rw-r-- 3 ray ray 3155 Dec 4 10:17 metrics.py
drwxrwxr-x 2 ray ray 4096 Jan 8 22:08 pycache
drwxrwxr-x 3 ray ray 4096 Jan 8 22:08 tabular
drwxrwxr-x 4 ray ray 4096 Jan 8 22:08 text
-rw-rw-r-- 3 ray ray 12573 Dec 4 10:17 torch_core.py
-rw-rw-r-- 3 ray ray 4081 Dec 4 10:17 train.py
drwxrwxr-x 3 ray ray 4096 Jan 8 22:08 utils
-rw-rw-r-- 3 ray ray 49 Dec 6 09:29 version.py
drwxrwxr-x 4 ray ray 4096 Jan 8 22:08 vision
drwxrwxr-x 3 ray ray 4096 Jan 8 22:08 widgets

I will also uninstall my old torchvision. Thanks so much for your help thus far!

Update: When trying to reinstall torchvision it kept trying to give me the old .2.0 version so I tried forcing an upgrade
pip install -I torchvision==0.2.1

Will be trying to satisfy these requirements.

Update2: CUDA now detected but fastai.vision as well as util modules not found.

No need to apologize, let’s focus on figuring it out.

So the listing shows the right fastai files.

It’s odd, but if you were to try:

import sys
sys.path.insert(0, '/home/ray/anaconda3/envs/fastai/lib/python3.6/site-packages/')
import fastai.vision

we are making it explicit that the first path is where you have the correct fastai (perhaps you have an old fastai stuck somewhere there).

wrt torchvision, this is good that you can’t install the latest version. As I suggested at the very beginning you have other python packages installed that have conflicting dependencies!!!

are you sure you made a new fresh environment from scratch? I mean really from scratch, start a new env and install just:

conda install -c pytorch -c fastai fastai==1.0.39

which will install the latest torchvision and the rest.

I would like you to do that (new env + install fastai), and please paste all the commands and the outputs to pastebin.com and send it here.

conda create -y python=3.6 --name fastai-please-work
conda activate fastai-please-work
conda install -y conda
conda install -y pip setuptools
conda install -y -c fastai -c pytorch fastai
conda install -y jupyter
jupyter notebook
# and test from the notebook

glad to hear you sorted out CUDA.

Alright following only your exact commands listed below:

conda create -y python=3.6 --name fastai-please-work
conda activate fastai-please-work
conda install -y conda
conda install -y pip setuptools
conda install -y -c fastai -c pytorch fastai
conda install -y jupyter
jupyter notebook
# and test from the notebook

https://pastebin.com/DvXZjBYh

Screenshot showing I’m using the fastai-please-work conda env

Updated notebook + outputs

This is quite a mystery, perhaps we haven’t used enough please in the env name to appease to the fairies.
The install logs look correct.

What happens if you run from a notebook:

import fastai, sys
print(fastai.__version__)
print(sys.modules['fastai'])

and in another cell as I suggested earlier:

import sys
sys.path.insert(0, '/home/ray/anaconda3/envs/fastai-please-work/lib/python3.6/site-packages/')
import fastai.vision

you don’t need to include the notebook, just a snapshot is fine.

Do you need to update Conda? I’m sure I’ve seen similar issues resolved by a Conda update. If you run Conda list in your current ‘please work’ environment which FastAI version do you now see?