I'm working in Google Colab and have already imported dlib
!pip install dlib
import dlib
and installed face_recognition module.
!pip install face_recognition
But, I'm getting error for this line:
import face_recognition
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from matplotlib.patches import Circle
import numpy as np
import cv2
%matplotlib inline
The error is as follows:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-159-91aca6eea0d3> in <module>()
----> 1 import face_recognition
2 import matplotlib.pyplot as plt
3 from matplotlib.patches import Rectangle
4 from matplotlib.patches import Circle
5 import numpy as np
1 frames
/usr/local/lib/python3.6/dist-packages/face_recognition/api.py in <module>()
24
25 cnn_face_detection_model = face_recognition_models.cnn_face_detector_model_location()
---> 26 cnn_face_detector = dlib.cnn_face_detection_model_v1(cnn_face_detection_model)
27
28 face_recognition_model = face_recognition_models.face_recognition_model_location()
RuntimeError: Error while calling cudaGetDevice(&the_device_id) in file /tmp/pip-wheel-66glv9rf/dlib/dlib/cuda/gpu_data.cpp:201. code: 100, reason: no CUDA-capable device is detected
What can be done?
From the error I can see you (probably) have not enabled GPU acceleration.
Go to Runtime -> Change Runtime -> Select GPU
Then Run the code !pip install face_recognition
This should install the library (and dependencies) without issue. Besides you don't need to install dlib separately. Let face_recognition build it alongside it.
Related
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.dates as md
import datetime as dt
import time
from zipfile import ZipFile
from matplotlib.pyplot import xticks
%matplotlib inline
--------------------------------------------------------------------------- ImportError Traceback (most recent call
last) in
1 import numpy as np
----> 2 import pandas as pd
3 import matplotlib.pyplot as plt
4 import seaborn as sns
5 import matplotlib.dates as md
~\anaconda3\lib\site-packages\pandas_init_.py in
20
21 # numpy compat
---> 22 from pandas.compat.numpy import (
23 np_version_under1p17 as _np_version_under1p17,
24 np_version_under1p18 as _np_version_under1p18,
ImportError: cannot import name 'np_version_under1p17' from
'pandas.compat.numpy' (C:\Users\XX\anaconda3\lib\site-packages\pandas\compat\numpy_init_.py)
I have upgraded all conda libraries, uninstalled/installed pandas again, but its still stuck
I encountered the same problem and I think that there is no "one-step" solution.
For me, I recently installed python 64-bit version as I was using the 32-bit version till then. But due to some reason the new version was installed in a different location.
My problem was actually with the notebook. So I deleted all the files(the folder in which the old 32-bit python was installed) in the old path and reinstalled the notebook using pip install notebook and everything worked fine.
Before that try upgrading the current pandas version using pip3 --upgrade pandas. For me the problem was messed up installation.
Before someone says that this is a repeated question and I should just install it, hear my case:
I am running a jupyter notebook from a conda environment in which opencv is already installed
I have had no problem using opencv so far in this environment.
I have downloaded a jupyter notebook, I have also created my own.
In my own newly created notebook I put
import numpy as np
import cv2
import glob
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
#%matplotlib qt
%matplotlib inline
it runs without problems.
Then I open the other notebook (which is situated in the same directory as the previous one)
and I do
import numpy as np
import cv2
import glob
import matplotlib.pyplot as plt
%matplotlib qt
and I get
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-b35e53327fbb> in <module>
1 import numpy as np
----> 2 import cv2
3 import glob
4 import matplotlib.pyplot as plt
5 get_ipython().run_line_magic('matplotlib', 'qt')
ModuleNotFoundError: No module named 'cv2'
Why? It was running in the other notebook!
See if both notebooks are running in the same virtual environment.
You can type conda activate <env_name> before running the notebook with jupyter notebook command.
When I am Running code but it is showing error message because it is showing no module name, how to install pb name module in Collaboratory and anaconda?
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-65b14fed549b> in <module>()
6 import seaborn as sns
7
----> 8 from pb import log_progress
ModuleNotFoundError: No module named 'pb'
%matplotlib inline
from matplotlib import pylab as plt
import matplotlib.dates as mdates
plt.rcParams['figure.figsize'] = (15.0, 8.0)
import pandas as pd
import seaborn as sns
from pb import log_progress
A quick google brought me here: https://progressbar-2.readthedocs.io/en/latest/#
logically this would be easily fixed by running the commands pip install progressbar2 or pip3 install progressbar2.
I am learning to work with Tensorflow. I have installed most of the libraries.
# load libs
import torch
import argparse
from torchvision import datasets, transforms
import matplotlib.pyplot as plt
import numpy as np
from data.datasets import MNIST
import torch.utils.data as data_utils
from sklearn.decomposition import PCA
import torch.nn.functional as F
from torch.autograd import Variable
But I am facing an error like this:
ImportError Traceback (most recent call last)
<ipython-input-8-257b7af364e1> in <module>()
5 import matplotlib.pyplot as plt
6 import numpy as np
----> 7 from data.datasets import MNIST
8 import torch.utils.data as data_utils
9 from sklearn.decomposition import PCA
ImportError: No module named data.datasets
I have installed the "dataset" library using the following command:
sudo -H pip install dataset
But I am still seeing this error. I am using python 2.7.
I am pretty new to python. Can anyone help me in identifying the missing thing. Thanks in advance.
The dataset directory is placed next to main.py, so probably when you tried sudo -H pip install dataset you actually installed a irrelevant package.
So uninstall the wrong package and it would work:
sudo -H pip uninstall dataset
I have the following code in a Datalab notebook:
import os
import glob
import numpy as np
import cv2
from sklearn.utils import shuffle
Seems pretty straight forward.
But when I run it, it crashes giving the following error:
ImportErrorTraceback (most recent call last)
<ipython-input-7-22ccccfbcefe> in <module>()
2 import glob
3 import numpy as np
----> 4 import cv2
5 from sklearn.utils import shuffle
6
/usr/local/lib/python2.7/dist-packages/cv2/__init__.py in <module>()
5 os.environ["PATH"] += os.pathsep + os.path.dirname(os.path.realpath(__file__))
6
----> 7 from . import cv2
8 sys.modules['cv2'] = cv2
ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
I have no idea what this means or how to fix it. I have opencv installed via pip but this still happens. Any ideas??
Found the answer. Had to run the following:
!apt-get update
!apt-get -y upgrade
!pip install opencv-python
!apt-get install libgtk2.0-dev -y