Hello everyone,
I am using Amazon p2 instance for the lessons. I have installed Anaconda 3.5 version that was suggested by Jeremy. Is there any setup required from software packages perspective ?
When I run the Lesson 1 Jupyter notebook, I get the below error. I am assuming, I will get more, unless I have full setup.
Command in Jupyter Notebook
# This file contains all the main external libs we'll use
from fastai.imports import *
Error :
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-2f3a3d7866ce> in <module>()
1 # This file contains all the main external libs we'll use
----> 2 from fastai.imports import *
~/courses/fastai/courses/dl1/fastai/imports.py in <module>()
1 from IPython.lib.deepreload import reload as dreload
----> 2 import PIL, os, numpy as np, math, collections, cv2, threading, json, bcolz, random, scipy
3 import random, pandas as pd, pickle, sys, itertools, string, sys, re, datetime
4 import seaborn as sns, matplotlib
5 from abc import abstractmethod
ModuleNotFoundError: No module named 'cv2'
Should I install opencv ? I tried pip install opencv-python and it gave me another error. So I removed it.
Any suggestions ?
if you installed latest anaconda3 version in aws box you will have python 3.6 by default.
Then you can do ‘pip install opencv-python’ to solve cv2 module not available error.
Thanks, but I tried installing that in the past. I tried it again, but I get the below error.
ImportError Traceback (most recent call last)
<ipython-input-3-2f3a3d7866ce> in <module>()
1 # This file contains all the main external libs we'll use
----> 2 from fastai.imports import *
~/courses/fastai/courses/dl1/fastai/imports.py in <module>()
1 from IPython.lib.deepreload import reload as dreload
----> 2 import PIL, os, numpy as np, math, collections, cv2, threading, json, bcolz, random, scipy
3 import random, pandas as pd, pickle, sys, itertools, string, sys, re, datetime
4 import seaborn as sns, matplotlib
5 from abc import abstractmethod
~/anaconda3/lib/python3.6/site-packages/cv2/__init__.py in <module>()
7
8 # make IDE's (PyCharm) autocompletion happy
----> 9 from .cv2 import *
10
11 # wildcard import above does not import "private" variables like __version__
ImportError: libSM.so.6: cannot open shared object file: No such file or directory
Exactly the same issue I’m having. I thought it was a Windows thing but apparently not. I installed cv2 and some other missing libs only to find there was an unresolvable conflict in lib versions. I’ve restored my system and will try again. Perhaps I’ll have better luck a 2nd, 3rd time.
Thank you @satheesh !
I met the same problem and your solution worked for me. I just added sudo in front of your command as follows : sudo apt-get install libsm6 libxrender1 libfontconfig1
@satheesh I have executed all the code in the discussion, I’m running on linux, but there’s still with the problem of “No module name ‘cv2’” on my jupyter notebook.
@chingjunehao If you have tried with this commandsudo apt-get install libsm6 libxrender1 libfontconfig1 and pip install opencv-python and still have issues. I recommend setting up the environment as given by Jermey.
From the Github URL or in the jupyter notebook, you will find the environment.yml file at > courses/fastai/environment.yml
Go to bash and execute the below to install all dependencies using these two commands. conda env create -f ~/downloads/environment.yml Activate fastai
Now, it should have the dependencies installed and it should work. Exit and re-login to reflect the changes. No need to restart.
It should technically work…try and let me know.
I have tried with sudo apt-get install libsm6 libxrender1 libfontconfig1 and pip install opencv-python command, but still have issues of “No module name cv2” on my jupyter notebook.
Then, I tried the command of conda env create -f ~/fastai/environment.yml source activate fastai
after I ssh to the aws p2 instances and activate the env, there’s still with the issue of
Notebook Validation failed: {u'model_id': u'e126fec017aa43a391f342328c05b6df', u'version_minor': 0, u'version_major': 2} is not valid under any of the given schemas:
{
"model_id": "e126fec017aa43a391f342328c05b6df",
"version_minor": 0,
"version_major": 2
}
and the same module problem…
ImportError Traceback (most recent call last)
<ipython-input-1-2f3a3d7866ce> in <module>()
1 # This file contains all the main external libs we'll use
----> 2 from fastai.imports import *
/home/ubuntu/fastai/courses/dl1/fastai/imports.py in <module>()
1 from IPython.lib.deepreload import reload as dreload
----> 2 import PIL, os, numpy as np, math, collections, cv2, threading, json, bcolz, random, scipy
3 import random, pandas as pd, pickle, sys, itertools, string, sys, re, datetime, time
4 import seaborn as sns, matplotlib
5 from abc import abstractmethod
ImportError: No module named cv2
@jeremy@satheesh Thanks for the help, the problem of cv2 module is solved.
But Still don’t understand the error of notebook validation error:
Notebook Validation failed: {u'model_id': u'e126fec017aa43a391f342328c05b6df', u'version_minor': 0, u'version_major': 2} is not valid under any of the given schemas:
{
"model_id": "e126fec017aa43a391f342328c05b6df",
"version_minor": 0,
"version_major": 2
}
But after fixing those module problem, still have a problem of syntax error: