8

I am getting this error while importing "face_recognition" in Pycharm but it runs perfectly fine from "anaconda command prompt". I don't understand why i am getting error in Pycharm but not in Anaconda cmd. I can successfully import cv2 in Pycharm. Can someone tell me how can i run it in pycharm? Below is complete error :-

Traceback (most recent call last):
File "C:/Users/r/PycharmProjects/Practise AI/check.py", line 1, in <module>
import face_recognition
File "C:\ProgramData\Anaconda3\lib\site- 
packages\face_recognition\__init__.py", line 7, in <module>
from .api import load_image_file, face_locations, batch_face_locations, 
face_landmarks, face_encodings, compare_faces, face_distance
File "C:\ProgramData\Anaconda3\lib\site-packages\face_recognition\api.py", line 3, in <module>
import PIL.Image
File "C:\ProgramData\Anaconda3\lib\site-packages\PIL\Image.py", line 64, in <module>
from . import _imaging as core
ImportError: DLL load failed: The specified module could not be found.
Games Lover
  • 127
  • 1
  • 1
  • 9
  • Which PyCharm version do you use? Try to start Anaconda Prompt and launch PyCharm from it with `\bin\pycharm.bat`, this way IDE will inherit the environment. – Pavel Karateev Mar 29 '19 at 15:12
  • I am using PyCharm 2019.1 (Community Edition) – Games Lover Mar 30 '19 at 03:45
  • It throws an error in anaconda prompt - " ERROR: cannot find VM options file. The system cannot find the file C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.5\bin\\win\pycharm.exe.vmoptions. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.intellij.ide.ClassUtilCore to field sun.net.www.protocol.jar.JarFileFactory.fileCache – Games Lover Mar 30 '19 at 03:46
  • WARNING: Please consider reporting this to the maintainers of com.intellij.ide.ClassUtilCore WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Already running " – Games Lover Mar 30 '19 at 03:49

1 Answers1

2

OK it finally worked after adding the anaconda interpreter in pycharm setting.

enter image description here

Games Lover
  • 127
  • 1
  • 1
  • 9
  • 1
    Thank you so much! This solved my problem. I encountered it after installing Anaconda (before I was only using PyCharm). – Ana-Maria Feb 11 '21 at 21:28