Running lesson1 with fastai-cpu - Symbol not found: _clock_gettime

I am on my macbook pro using the fastai-cpu (not GPU).

I am trying to run step 2:
# This file contains all the main external libs we’ll use
from fastai.imports import *

But I get this error:

ImportError Traceback (most recent call last)
in ()
1 # This file contains all the main external libs we’ll use
----> 2 from fastai.imports import *

~/git/fastai/courses/dl1/fastai/imports.py in ()
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 random, pandas as pd, pickle, sys, itertools, string, sys, re, datetime, time, shutil
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 ()
2 import os
3
----> 4 from .cv2 import *
5 from .data import *
6

ImportError: dlopen(/anaconda3/envs/fastai-cpu/lib/python3.6/site-packages/cv2/cv2.cpython-36m-darwin.so, 2): Symbol not found: _clock_gettime
Referenced from: /anaconda3/envs/fastai-cpu/lib/python3.6/site-packages/cv2/.dylibs/libavutil.55.78.100.dylib (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
in /anaconda3/envs/fastai-cpu/lib/python3.6/site-packages/cv2/.dylibs/libavutil.55.78.100.dylib

Has anyone else seen this error, or know how to resolve it?

Can you please tell me where you found fastai-cpu?

Hi Vishal, in the README for the fastai github repo, I saw this :

To install a cpu only environment instead:

cd fastai
conda env update -f environment-cpu.yml

Can you help me with my problem I am having?

Based on this github discussion, it seems like you can either wait for a new version of open-cv to be released or you can upgrade your Mac OS (based on this discussion

I’ve actually been running fastai on my Mac within a Docker container (Ubuntu). It took a little while to get used to it, but once I got it set up I haven’t had any problems.

Thanks ! This is perfect. I did some initial googling, but didn’t see anything, but maybe that is because I included “fastai” in my search terms. Anyway, thanks again !

Upgrading Mac OS works! I solved it this way

I followed Issues with import of CV2 on mac OS X 10.11.6 which said to pip install opencv-python==3.3.0.10 .

2 Likes