Fastai v1 install issues thread

ImportError: cannot import name ‘Optional’

How to replicate
Tried installing FastAI on windows PC using following commands
1)first created conda using following command
conda create -n fastai_v1 python=3.6
2)conda activate fastai_v1
3)(fastai_v1) C:>conda install -c pytorch pytorch-cpu torchvision
Install succesful
4)(fastai_v1) C:>conda install -c fastai fastai
Succesful
5) tried importing fastai and error occurred

Error
##################
(fastai_v1) C:>python
Python 3.6.10 |Anaconda, Inc.| (default, Jan 7 2020, 15:18:16) [MSC v.1916 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

from fastai.vision import *
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\JOHNY\Anaconda3\envs\fastai_v1\lib\site-packages\fastai\vision_init_.py”, line 3, in
from .learner import *
File “C:\Users\JOHNY\Anaconda3\envs\fastai_v1\lib\site-packages\fastai\vision\learner.py”, line 6, in
from . import models
File “C:\Users\JOHNY\Anaconda3\envs\fastai_v1\lib\site-packages\fastai\vision\models_init_.py”, line 2, in
from torchvision.models import ResNet,resnet18,resnet34,resnet50,resnet101,resnet152
File “C:\Users\JOHNY\Anaconda3\envs\fastai_v1\lib\site-packages\torchvision_init_.py”, line 3, in
from torchvision import models
File “C:\Users\JOHNY\Anaconda3\envs\fastai_v1\lib\site-packages\torchvision\models_init_.py”, line 5, in
from .inception import *
File “C:\Users\JOHNY\Anaconda3\envs\fastai_v1\lib\site-packages\torchvision\models\inception.py”, line 8, in
from torch.jit.annotations import Optional
ImportError: cannot import name ‘Optional’
####################

Output from (fastai_v1) C:>python -m fastai.utils.show_install

=== Software ===
python       : 3.6.10
fastai       : 1.0.60
fastprogress : 0.2.2
torch        : 1.1.0
torch cuda   : None / is **Not available**

=== Hardware ===
No GPUs available

=== Environment ===
platform     : Windows-10-10.0.18362-SP0
conda env    : fastai_v1
python       : C:\Users\JOHNY\Anaconda3\envs\fastai_v1\python.exe
sys.path     :
C:\Users\JOHNY\Anaconda3\envs\fastai_v1\python36.zip
C:\Users\JOHNY\Anaconda3\envs\fastai_v1\DLLs
C:\Users\JOHNY\Anaconda3\envs\fastai_v1\lib
C:\Users\JOHNY\Anaconda3\envs\fastai_v1
C:\Users\JOHNY\Anaconda3\envs\fastai_v1\lib\site-packages
no supported gpus found on this system

Solved this by upgrading pytorch.
Then another error occurred
Preformatted textfrom PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION ImportError: cannot import name 'PILLOW_VERSIONPreformatted text
This was solved up upgrading pytorch to nightly version

This is a brilliant idea. Thanks for this I am looking for this on our project at data science company

Hi All,

I am trying to install fastai v1 on my laptop which has no GPU. So, I first installed pytorch using: conda install pytorch torchvision cpuonly -c pytorch. Then, I installed fastai using pip install fastai.

While running the first notebook in the dl1 course, I got the following error while trying to:
from fastai.vision import *
from fastai.metrics import error_rate

ImportError: libcudart.so.10.0: cannot open shared object file: No such file or directory

Can someone please explain what I have missed?

Do I need to install Nvidia drivers as this page says (https://github.com/fastai/fastai/blob/master/README.md#installation-issues)?. Please note that my machine has no GPU.

The following works:
import torch
x = torch.rand(5, 3)
print(x)

But
import torchvision

fails with the error ImportError: libcudart.so.10.0: cannot open shared object file: No such file or directory

I have built and used Singularity containers with fastai. Actually works quite well in a multi-user HPC cluster environment with shared network drives and a common DL data store, as the Singularity container tech automatically inherits and preserves the user’s permissions, avoiding the risk of accidentally breaking/messing up the things/files of other users/groups, while easily allowing access to a common data store without having to worry too much about “mounting” volumes with the right permissions/groups etc.

Let me know what trouble/problem you have, and we can try and figure something out together?

(Apologies for the super-delayed reply here – in recent months I have not had time to follow fastai and the forums as much as I wanted to.)

Regards,
Yijin

If your machine has no GPU, you don’t have to install NVIDIA drivers (since there is no NVIDIA GPU to ‘drive’!)

Though note that your DL work will also be quite (very!) slow on CPU…

Regards,
Yijin

@paulmp, in case you are still using Singularity+fastai, I have now written a blog post about my use of fastai2 in Singularity. Please see my forum post here, and the link to the blog post here. Thanks.

Yijin

I was following the fastai install instructions at https://github.com/fastai/fastai/blob/master/README.md#installation and successfully installed fastai. from fastai import * works but from fastai.vision import * fails with

ImportError: cannot import name ‘ResNet’ from ‘torchvision.models’ (unknown location)

I am working on a IBM Power (ppc64le) system

(fastai-new) [cecuser@p605-kvm1 ~]$ uname -a
Linux p605-kvm1 4.14.0-115.8.1.el7a.ppc64le #1 SMP Thu May 9 14:45:13 UTC 2019 ppc64le ppc64le ppc64le GNU/Linux

Here is the conda info if that helps …

     active environment : fastai-new
    active env location : /home/cecuser/anaconda3/envs/fastai-new
            shell level : 3
       user config file : /home/cecuser/.condarc
 populated config files : /home/cecuser/anaconda3/.condarc
                          /home/cecuser/.condarc
          conda version : 4.7.10
    conda-build version : 3.18.8
         python version : 3.7.3.final.0
       virtual packages : __cuda=10.1
       base environment : /home/cecuser/anaconda3  (writable)
           channel URLs : http://129.40.242.3/repos/powerai/1.6.2/ibm-ai/conda/linux-ppc64le
                          http://129.40.242.3/repos/powerai/1.6.2/ibm-ai/conda/noarch
                          http://129.40.242.3/repos/powerai/1.6.2/conda/pkgs/r/linux-ppc64le
                          http://129.40.242.3/repos/powerai/1.6.2/conda/pkgs/r/noarch
                          http://129.40.242.3/repos/powerai/1.6.2/conda/pkgs/main/linux-ppc64le
                          http://129.40.242.3/repos/powerai/1.6.2/conda/pkgs/main/noarch
          package cache : /home/cecuser/anaconda3/pkgs
                          /home/cecuser/.conda/pkgs
       envs directories : /home/cecuser/anaconda3/envs
                          /home/cecuser/.conda/envs
               platform : linux-ppc64le
             user-agent : conda/4.7.10 requests/2.22.0 CPython/3.7.3 Linux/4.14.0-115.8.1.el7a.ppc64le rhel/7.6 glibc/2.17
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

Hi all,

Not sure how active this is but I’m trying to install on windows to use a GAN.
When I get to “conda install -c pytorch -c fastai fastai” - I get a couple fails, then it finds conflicts and finally fails saying the following:

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versionsThe following specifications were found to be incompatible with your CUDA driver:

  • feature:/win-64::__cuda==10.2=0
  • feature:|@/win-64::__cuda==10.2=0

Even on pip install I had a problem saying it “Failed to build bottleneck
ERROR: Could not build wheels for bottleneck which use PEP 517 and cannot be installed directly”.

ANY HELP PLEASE? Young person with no experience coding except a bit in Houdini FX.

Hi, not sure if this is the right place to say this but I’m having issues starting an AWS SageMaker notebook with the fastai library. I’ve tried starting up my existing notebook and creating a new one using the CloudFormation template on the “Server setup” page of the course’s setup instructions (https://course.fast.ai/start_sagemaker.html) but it keeps failing after taking more than 5 minutes to start up. Looking at the logs, the last line I see is “Update fastai library”. Is this likely just a temporary network issue?

Hi guys and gals,
I’m trying to add fastai to a conda environment as shown in the installation guide on the github repo and the MOOC. I am however running into a strange issue which I am unable to find any information about.
Whenever I run conda install -c pytorch -c fastai fastai, this is the result:

(fastai) C:\>conda install -c pytorch -c fastai fastai
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versionsThe following specifications were found to be incompatible with your CUDA driver:

  - feature:/win-64::__cuda==11.0=0

Your installed CUDA driver is: 11.0

I was previously experiencing the same issue when I had version 9.1 of cuda drivers, I thought upgrading my GPU would resolve this but this has not been the case. Do you have any suggestions on how I can go about resolving this? I would like to get started on that MOOC ASAP!

PS. I’m running on a Windows 10 env with a NVIDIA GeForce 1050 GPU

In case anyone else is running into the SamgeMaker CloudFormation issue, there’s a few workarounds on this GitHub issue: https://github.com/fastai/course-v3/issues/518

@stas,
Could you kindly help me in installing fastai into my local mission-CPU.
while running below code, I’m getting following error:

code: from fastai.vision import *

error: module ‘torch.jit’ has no attribute ‘unused’

@dasthu, I haven’t been involved with fastai for awhile now, I trust that someone else will be able to solve this for you. If you get no responses here, please consider filing an Issue on the fastai github.

Hello,

I am having some issue with conda version 4.5.12.

Please see the error below.

Any ideas?

Best regards,
lavish

frank@frank-UNIX:~$ conda install -c pytorch -c fastai fastai
Solving environment: done

Could you please clarify how we can continue to get Fastai v1 on Conda now that fastai 2 is standard?

Hey, After a lot of study and practice in google colab I have finally decided to make a project using fastai V1 in amazon EC2. But, now with the release of fastai v2, I am lost. I want to use conda to install fastaiV1 but its FastaiV2 in conda right now. Is there a way to install fastaiv1 from conda ?? Please help me. Thanks in advance.

Yes you can!
type pip install fastai==1 in the command line. I think that should work. Or if you dont want to touch v2 at all for now, and have not upgraded to v2 yet, you can simply continue with the library you have installed.
Cheers!