The dlib library does not import in anaconda - python

I added the dlib library and it is shown in the environments in anaconda, but every time I run the code
an error is showing up:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-04aff462cee7> in <module>
1 import cv2
----> 2 import dlib
3
4 from scipy.spatial import distance
5
ModuleNotFoundError: No module named 'dlib'

first remove installed dlib and deactivate from env and return to your env again.
you have to first install Cython:
pip install cython
and then install dlib:
pip install dlib

Related

ModuleNotFoundError: No module named 'mglearn'

This is a commmon question, but nothing worked for me so far.
I have seen this answer too Python 3 on Mac : ModuleNotFoundError: No module named 'mglearn'
!pip install mglearn
!pip install sklearn
!pip install -U scikit-learn
import mglearn
import sklearn
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-fe22f30497b9> in <module>
----> 1 import mglearn
2 import sklearn
ModuleNotFoundError: No module named 'mglearn'
I checked other questions but failed to solve it. I have macOS Catalina 10.15.7
import sys
!{sys.executable} -m pip install mglearn
Try using this. This assures that you are using the pip version associated with the environment.

cannot import sklearn even though it is installed successfully

I have installed sklearn through pip successfully using this command:
$pip install -U scikit-learn
But I cannot import it.
import sklearn
Result:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-b7c74cbf5af0> in <module>
----> 1 import sklearn
ModuleNotFoundError: No module named 'sklearn'
Please help
You might want to try installing scikit-learn: pip install scikit-learn
Try pip3 install sklearn.
This will install the libraries you need for python 3.

ModuleNotFoundError: No module named 'pymc3'

I'm trying to import PyMC3 library in Jupyter Notebook's Python 3 kernel. I've already installed pymc3 initials in Anaconda Prompt (Miniconda3) using:
conda install theano
conda install pygpu
pip install pymc3
And when I try to import it in Jupyter Notebook:
import pymc3 as pm
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-1f817cf6472a> in <module>
1 # PyMC3 for Bayesian Inference
----> 2 import pymc3 as pm
ModuleNotFoundError: No module named 'pymc3'
Any solutions to this problem guys...
You have installed the pymc3 to other python environment that you are using to import it.
Check your python executable location
Inside your script, use
import sys
print(sys.executable)
To get the path to the python executable you are using. Lets say it is C:\python\python.exe.
Install the package
Then, install the package using
<path_to_python.exe> -m pip install pymc3
This is the bulletproof way installing packages with pip, when you have multiple python installations or virtual environments on your system.

face_recognition and dlib trying to use cuda while no nvidia card is installed

im trying to load the face_recognition on my intel w/ igpu, after isntalling and reinstalig dlib i havent be able to make it run, here is my code
import face_recognition
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-1-ca17cc6b8bdb> in <module>
----> 1 import face_recognition
~/anaconda3/envs/tfs_cpu/lib/python3.7/site-packages/face_recognition/__init__.py in <module>
5 __version__ = '1.2.3'
6
----> 7 from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
~/anaconda3/envs/tfs_cpu/lib/python3.7/site-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-install-x2i2y7s0/dlib/dlib/cuda/gpu_data.cpp:201. code: 100, reason: no CUDA-capable device is detected
i have uninstalled the two libraries like this
pip3 uninstall dlib
pip3 uninstall face_recognition
pip uninstall dlib
pip uninstall face_recognition
then i install them like this
pip3 install -v --install-option="--no" --install-option="DLIB_USE_CUDA" dlib
pip3 install face_recognition
but the librarie just pop ups the same error, any advice in order to solve this would be great!
thanks for reading

ModuleNotFoundError: No module named 'syft' (PySyft)

i install Pysyft using this :
conda create -n pysyft python=3
conda activate pysyft
activate pysyft" instead "
pip install syft
and yet when i try to import the library
from syft.frameworks.torch.differential_privacy import pate
it's show me this error :
ModuleNotFoundError Traceback (most recent call last)
in
1 import numpy as np
----> 2 from syft.frameworks.torch.differential_privacy import pate
ModuleNotFoundError: No module named 'syft'
According to the repository import changed to:
from syft.frameworks.torch.dp import pate

Categories