Fastai v1 install issues thread

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?

Thanks for the extra suggestions, @brismith.

My instructions already included:

conda install -y conda

unlike pip install -U with conda you don’t need to tell it to update, its normal install always updates if there is an update.

and his notebook shows the correct environment (right upper corner), just waiting to see the paths.

and we recently included nb_conda in conda deps, as some people had issued w/o this package.

1 Like

Here are the responses I got:

P.S. This was still using the Python [conda env:fastai-please-work]

Very odd. Perhaps your conda setup is screwed up? I mean not the environment, but the whole thing? Perhaps trying to install conda from scratch?

Can you load other packages from the notebook? Print their sys.modules[‘package_name_here’] and see that the path matches the real thing?

Hi Stas,

Sorry for super beginner question. But how to create new environment for fastai v1? If I understand this correctly it is command like this: conda env create -f environment.yml

Is there somewhere environment.yml for fastai v1?
Because for environment.yml what I found is comment:
# use/edit this file only for working with fastai-0.7.x version

BTW my environment is build on Ubuntu 18.04

Thanks a lot
Peter

conda create -n fastai python=3.7
conda activate fastai
conda install pytorch torchvision -c pytorch
conda install -c fastai fastai

The last two steps should install all you need in the fastai env. The remove an env you don’t need:
conda env remove -n fastai
To list all envs
conda env list

3 Likes

Could something bad or out of date get pulled in from cache - rather than re-loading? I agree that a fresh start sounds good. I haven’t seen a conda list output, but the earlier torchvision error looks like it is stuck on fastai 1.0.34,

But 1.0.34 is just 1 month old, so even with this outdated version, all those modules are the same. The stuckness is a different symptom (conflict with dependencies from other packages), but it should still load.

I reviewed your previous posts, @Raymond-Wu, and now I see that here it did actually do the right thing - it was able to start loading fastai.text, but it was loading it from courses/dl2/fastai symlink which points to the fastai-0.7 source. I think this is the problem. You are trying to run the course-v2 files which require fastai 0.7 with fastai v1.

If you’re trying however to run fastai-0.7 because you want to run course v2 files, then of course we can’t solve it, since we are solving the wrong problem. In this case this discussion should be done over at Fastai v0.7 install issues thread and you will be not installing fastai-v1 in that case, but fastai-v0, follow the instructions in that thread instead.

I actually tried loading thing from terminal and activating the environment. It just doesn’t seem to work from Jupyter?

https://pastebin.com/Cgpnwtks

Edit: Just saw stas’ new message. How do I point the symlink to a new folder?

How do I point the symlink to a new folder?

Please reread what I wrote, you’re mixing things up. You don’t need to change any symlinks.

Which course are you trying to follow?

!!! Stas thank you for being so patient with me. I reread your message and now got everything to work! I owe you a coffee or something. Thanks for unblocking me!

Yay, glad to hear we sorted this puzzle out. And I learned to ask a simple question of the output of pwd :wink:

1 Like

Hi guys,

Can you please tell me what I’m doing wrong?

I have fresh installation of Ubuntu 18.04. and I want install latest fastai. So currently v 1.0.39

Here are my steps:
Download latest conda. Currently Anaconda3-2018.12-Linux-x86_64.sh
Open terminal
command: $ bash Anaconda3-2018.12-Linux-x86_64.sh (installed successfully with no errors)
command: $ sudo apt install nvidia-390 (installed successfully with no errors)

Reboot system!

Open terminal again and run this commands:
$ conda create -n fastai python=3.7 (created with no errors)
$ conda activate fastai
$ conda install pytorch torchvision -c pytorch (installed successfully with no errors)
$ conda install -c fastai fastai (version 1.0.39 is installed successfully with no errors)

Reboot system!

Terminal again and:
$ conda activate fastai
$ jupyter notebook

This automatically open new browser window with jupyter notebook and until now everything looks correct.

But when I try ran:
from fastai import *
from fastai.vision import *
from fastai.docs import *
import torch

I have this error:
ModuleNotFoundError: No module named ‘fastai.vision’

So it is looks like I’m runnig v0.7 or something.

Any idea what I’m doing wrong and how can I fix it?

I already tried few other similar way how to install latest fastai including pip but I have still same result

ModuleNotFoundError: No module named ‘fastai.vision’

Thanks a lot for your help.
Peter