that’s what i did as well and worked for me. somehow the fastai folder got mixed up after running conda env update.
@Stas got my windows 7 updated to windows 10 (apparently its still a free upgrade).After running through the instructions and recreating the symlink (as admin), SUCCESS!!! These all ran successfully for the first time on my pc (that last one makes me feel really good)…
Word to the wise - don’t do this with Windows 7 and probably not windows 8 either.
Two days back I ran my model using fastai 0.7.0 on google colab.
And for two days I got busy and now if I am trying to run it , its throwing me an error, on the execution of the line
*"from fastai.transforms import ’ .
the error is AttributeError: module ‘torch’ has no attribute ‘float32’.
I am also stuck at:
from fastai.imports import *
ModuleNotFoundError Traceback (most recent call last)
1 # This file contains all the main external libs we’ll use
----> 2 from fastai.imports import *
ModuleNotFoundError: No module named ‘fastai’
It seems to be a path issue but i am not very good at solving it. Looking at your solution and using sys.path I can see that all of the paths are to the environment fastai. as such:
[’’, ‘C:\Users\Andrew\Anaconda3\envs\fastai\python36.zip’, ‘C:\Users\Andrew\Anaconda3\envs\fastai\DLLs’, ‘C:\Users\Andrew\Anaconda3\envs\fastai\lib’,
‘C:\Users\Andrew\Anaconda3\envs\fastai’, ‘C:\Users\Andrew\Anaconda3\envs\fastai\lib\site-packages’, ‘C:\Users\Andrew\Anaconda3\envs\fastai\lib\site-packages\IPython\extensions’, ‘C:\Users\Andrew\.ipython’]
Nothing seems to be related to where the actual fastai directory is:
Also, old/fastai/… has all the necessary files it seems.
What am i missing here?
Sorry for what is probably an obvious question to you, i am not very good at figuring this out.
It’s very difficult for me to give much/any help to those who try this on windows, you guys really need to find someone who has windows access and knows it well to be of any guidance.
As you can see from the outputs
C:\Users\Andrew\Anaconda3\fastai\old needs to be in
sys.path and it’s not. The quick one off hack would be to start the notebook with:
import sys sys.path.append("C:\Users\Andrew\Anaconda3\fastai\old") import fastai
where you tell python explicitly where to find fastai. That’s if haven’t installed fastai and want to you use it directly from the clone. If you have installed it, then first check under those folders in
sys.path and see whether the
fastai folder is there physically. If it is then it should just work.
But the correct solution is to figure out the windows symlinks, but I’m not your man for that. You need to look here instead.
python -c 'import torch; print(torch.__version__)'
Setup on Salamander
Thank you @stas, that fix solved it. Everything else seems to work now too.
As you said though, this seems like the temporary hack to fix it but i am glad I know it does work.
Now to try and figure out the symlink issue.
Appreciate the help!
@stas one more req. to add to the list - make sure your graphics card is up to date. I had a old Geforce GTX 560 that was on the approved CUDA list, but was no longer supported by PyTorch! Folks should be ok with any Geforce GTX 10series (1000 +) cards. I picked up a GTX 1050 and had lesson 1 run in 5 mins. Otherwise get a error like this when trying to train models:
Found GPU0 GeForce GTX 950M which is of cuda capability 5.0.
PyTorch no longer supports this GPU because it is too old.
As explained in this link…
So to wrap-up my lessons learned:
- Update to windows 10 (its still a free download) from windows 7/8
- Follow the instructions correctly and create a good symlink using admin privileges (mklink /d fastai …\old\fastai)
- don’t use an outdated graphics card even if its on the CUDA supported list
I added the link to the CUDA-supported cards in general. I wasn’t aware that it doesn’t map 1:1 to pytorch supported cards. Do pytorch folks provide their narrowed-down list somewhere, or documented the exclusions? I
hi there, just want to share my finding when running 0.7.0 on crestle.
If you have only install fastai (0.7.0) without install torch (0.3.1) before, then it used to using torch 0.3.1 (automatically). but crestle has recently upgraded torch to 0.4.0, and most importantly, the related packages.
so you may need to install torch 0.3.1 and torchtext 0.2.3, if you didn’t install torch before.
Crestle with (old) fast ai
I am also having trouble starting with v0.7. I followed the instructions at the top of this thread for cpu.
I open the first course and shift-enter through each cell(first time Jupyter Notebook and Python user). I see the below error:
--------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-30-713ddf51e021> in <module> ----> 1 from fastai.imports import * 2 from fastai.structured import * 3 4 from pandas_summary import DataFrameSummary 5 from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier ~/fastai/courses/ml1/fastai/imports.py in <module> 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 ~/anaconda3/envs/fastai-cpu/lib/python3.6/site-packages/cv2/__init__.py in <module> 1 import importlib 2 ----> 3 from .cv2 import * 4 from .data import * 5 ImportError: libSM.so.6: cannot open shared object file: No such file or directory
Any help would be appreciated.
you need to ensure that your symlink is pointing to the correct fastai directory (ie. https://github.com/fastai/fastai/tree/master/old/fastai)
@stas, thanks for the hint the pytorch version was correct but
“** torchtext**” version was not compatible it has to be “torchtext==0.2.3.” for pytorch 0.3.1.
I’m on 18.04, freshly installed.
Installed fastai v1 first, in a dedicated env (it seems to work). Then I installed fastai 0.7 following the procedure described (which is the usual procedure).
As I try to import fastai modules, it complains what follows:
It starts from:
and ends with:
The symlink seems to be OK…
So, what’s wrong?
torchtext. Downgrade it to the previous version with
Source (for example): Google Colab-AttributeError: module 'torch' has no attribute 'float32'
environment*.yml were just updated to pin
torchtext=0.2.3. Thank you all for the input and testing.
I am using clouderizer.com Fast.ai project template for the course and to run the template I use google colab like a backend and I am not able to import the library properly. I have already posted my query here and the solution I received was for the case when we run the complete notebook on google colab itself or I may not be able to understand it because these things are new to me. If someone in the forum is using clouderizer and has found a solution, please help!.
Thanks in advance.
Edit: Finally found a solution. Click on edit project, go to the setup section, in the setup script column, add
pip install torchtext==0.2.3. Now I am able to run the notebooks without any problem.
Window10 : cannot import name 'as_tensor'
I was getting error related to torchtext=0.2.3.
I replaced it with torchtext==0.2.3 in the enviornment.yml file and it worked
will that work with
!pip install fastai==0.7.0 in kaggle kernels?