Not able to use installed libraries - python

I have installed face_recognition model using command
pip3 install face_recognition
and it is installed in my AWS instance. But while importing face_recognition in my jupyter notebook it is giving me import error.
Thanks

Are you using a python environment? you have to make sure that the python interpreter that is running your code is the same one that has the face_recognition requirement installed.

Related

ModuleNotFoundError: No module named 'tensorflow_data_validation' in Google Colab

I tried to import Tensorflow Data Validation library via the below command in Google Colab.
import tensorflow_data_validation as tfdv
It gave me this error:
ModuleNotFoundError: No module named 'tensorflow_data_validation'
I tried to install the library using pip via below commands. But couldn't install the package successfully.
pip install tensorflow-data-validation
pip install tensorflow-data-validation==1.3.0
pip install --upgrade --force-reinstall tensorflow-data-validation[all]
How to resolve this issue?
To install the library properly, follow these steps:
Install the library using pip:
!pip install tensorflow-data-validation
Reload the environment. A button will show up at the end of the previous cell to Restart, but you can also do it with Ctrl+M or using the menu: "Runtime" > "Restart Runtime".
Import the library as usual:
import tensorflow_data_validation as tfdv
Why do I need to reload the environment? It's because installing tensorflow-data-validation upgrades one of the libraries already present in your Colab environment. So, to "activate" the new environment and use the newly installed libraries and their installed versions you need to reload the environment
I was able to resolve this error by installing tensorflow_data_validation library via the below command. Now I'm able to use this library in my Colab file.
!pip install -U tensorflow \
tensorflow-data-validation \
apache-beam[gcp]

How to fix 'DLL load failed while importing win32api' in Jupyter notebook after connecting VS code to Jupyter notebook?

When I try using Jupyter notebook, kernel error appears like this
import win32api
ImportError: DLL load failed while importing win32api:
After connecting vs code to jupyter notebook, error appears.
I've already tried
conda install pywin32
and copied the two files from [installation directory of Anaconda]\Lib\site-packages\pywin32_system32 to C:\Windows\System32
but it didn't work.
how to fix?
Try installing it using pip, it can solve your problem here
pip install --upgrade pywin32==225
Or this, if you don't have the package already
pip install pywin32==225
After activating the env where the above is causing issue uninstall win32api (if it is installed):
pip uninstall pywin32
Then use pip to install pywin32:
pip install pywin32
Jupyter should work afterward. The solution is proposed here by ValentinVerschinin
Are you using Python 3.8? It seems to be a Python 3.8 specific problem.
Can you try to install the pywin32==225?
You can refer to this page.
Installing the relevant binary from github worked for me

unable to correctly complete conda install face_recognition

I have been working on some facial detection code with OpenCV, however recently I needed a fetcher from a module, face_recognition. I first tried installing it with pip install face_recognition and then with conda install...
What I eventually ended up doing is creating a separate virtual environment for Anaconda in PyCharm and I installed all the face_recognition dependencies successfully with conda install, then did pip install --no-dependencies face_recognition.
The terminal reported that it had successfully installed face_recognition, however when I try running the code, I still get the error:
ModuleNotFoundError: No module named 'face_recognition'
I have been doing research and trying so many different things for about three days now; I have no idea what else I could do.
How can I create a Conda environment with the face_recognition package?

No module named 'cv2.cv2'

I am a beginner at computers. I use Anaconda python 3.6 in windows 10. I have already installed OpenCV using this command:
pip install opencv-python
But when I try to import cv2 using this:
import cv2
this error shows up:
How can I install openCV for python?
Based on python opencv link: https://pypi.org/project/opencv-python/
Step 1:
Uninstall the opencv first if you have previous/other manually installed (= not installed via pip) version of OpenCV installed (e.g. cv2 module in the root of Python's site-packages)):
pip uninstall opencv-python
Step 2:
Install the package afresh
pip install opencv-python
Hope that works!
try this:
Create Virtual Environment
conda create --name opencv-env python=3.6
Activate the environment
activate opencv-env
Install OpenCV and other important packages
pip install numpy scipy matplotlib scikit-learn jupyter
pip install opencv-contrib-python
pip install dlib
Test your installation
import cv2
cv2.__version__
In my case, using Python 3.8 on Windows 10 and Pycharm (or VS Code as well), I have this same issue.
Finally I noticed that the Antivirus (Nod32) deletes the cv2.cp38-win32.pyd file that should be in the cv2 folder. I simply paused the protection, installed opencv with pip install opencv-python command and it worked just fine.
I hope it helps someone.
This happened to me because I setup a virtual environment with python 32-bit and my modules required the 64-bit version so it seemed there was a version conflict of CV. Changing the python version in my environment fixed the issue.
I was facing a similar issue. In my case, the issue occured because of previous dependencies.
!pip install easyocr
!pip install imutils
if you are running these commands first and then importing
import cv2
from matplotlib import pyplot as plt
import numpy as np
import imutils
import easyocr
then you will get this error. So you first import CV2 and then pip install easyocr or other libraries. This worked in my case.
I used the answer provided here and it worked.
By running pip install opencv_python-3.4.5-cp36-cp36m-win_amd64.whl
I had this exact same problem on Windows 10. Uninstalling via pip and then reinstalling in my virtual environment fixed everything up for me.
Here's a link that helped https://pypi.org/project/opencv-python/
Try reinstalling openCV — it worked for me.
To uninstall:
pip uninstall opencv-python
To reinstall:
pip install opencv-python

importing opencv version 3.4.2.17 in python 3.7

I have already installed opencv in anaconda prompt by entering the command:
pip install opencv-python
it installed properly, but I'm unable to import the module in jupyter notebook.I entered the following command in jupyter:
import opencv
but it's showing ModuleNotFoundError
Also, to resolve anaconda environment issues, I entered the following command in anaconda prompt:
conda install -c conda-forge opencv
this further downloaded and extracted packages:
libopencv-3.4.1,opencv-3.4.1,py-opencv3.4.1
but still I'm unable to import opencv or libopencv module in my Jupyter notebook.
What should I do to use opencv3.4.2.17 in my python version3.7?
The correct syntax for importing opencv is as follows:
import cv2
If opencv was correctly installed, it should work.
For installation of OpenCV, use:
pip install opencv
To import OpenCV, use:
import cv2

Categories