{"id":23,"date":"2022-11-11T04:13:58","date_gmt":"2022-11-11T04:13:58","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/swartsm\/?p=23"},"modified":"2022-11-11T04:13:58","modified_gmt":"2022-11-11T04:13:58","slug":"installation-of-the-face_recognition-python-library","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/swartsm\/2022\/11\/11\/installation-of-the-face_recognition-python-library\/","title":{"rendered":"Installation of the face_recognition python library"},"content":{"rendered":"\n<p>The python <code>face_recognition<\/code> library has a ton of features. In our chat app, we are using it as the basis of our login system. Instead of a password, users will enter a username and consent that a photo will be taken of them with their computer\u2019s webcam. The photo and their username will be stored in a database and that photo will be used to compare against new photos taken at future logins. We are really only scratching the surface of what the <code>face_recognition<\/code> library can do.\u00a0<\/p>\n\n\n\n<p><code>Face_recognition<\/code> depends on a large machine learning library called <code>dlib<\/code>. And <code>dlib<\/code> requires another library called <code>CMake<\/code> that controls the software compilation process, among other things.\u00a0<\/p>\n\n\n\n<p>I installed these three packages, along with some other libraries, and everything was working. I was pretty sure I had downloaded some things I didn\u2019t need, so I wasn\u2019t sure what to put in the <code>requirements.txt<\/code> file.\u00a0<\/p>\n\n\n\n<p>It turned out that in my selectiveness, I missed something important. When I made a new virtual environment and ran <code>pip3 install -r requirements.txt<\/code>, everything seemed great until I ran my code and got an error message: <code>ModuleNotFoundError: No module named \u2018face_recognition\u2019<\/code>. I googled the error and <a href=\"https:\/\/github.com\/ageitgey\/face_recognition\/issues\/1016\">found that I was not alone<\/a>. The consensus on the solution was to install <code>cmake<\/code>, then <code>dlib<\/code>, then <code>face_recogntion<\/code>. In that order. Then <code>face_recognition<\/code> should work. But it wasn\u2019t working for me, and others online had the same problem! I was getting worried.<\/p>\n\n\n\n<p>Thankfully, cooler heads prevailed and I walked through it with my partner. We downloaded packages one by one in a new virtual environment. When we were waiting for <code>dlib<\/code> to install, we noticed something:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"616\" height=\"304\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5954\/files\/2022\/11\/Screen-Shot-2022-11-03-at-9.08.13-PM.png\" alt=\"\" class=\"wp-image-24\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5954\/files\/2022\/11\/Screen-Shot-2022-11-03-at-9.08.13-PM.png 616w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5954\/files\/2022\/11\/Screen-Shot-2022-11-03-at-9.08.13-PM-300x148.png 300w\" sizes=\"auto, (max-width: 616px) 100vw, 616px\" \/><\/figure>\n\n\n\n<p>It was installing a legacy version of <code>setup.py<\/code> for <code>dlib<\/code> because <code>wheel<\/code> is not installed. Wheel? Yes, I had downloaded <code>wheel<\/code> originally, because I had read about it somewhere random, but it doesn\u2019t show up in <code>pip freeze<\/code>, so I wasn\u2019t sure it needed to be in <code>requirements.txt<\/code>. The only thing I know about <code>wheel<\/code> is that it makes dependency installation easier, and that turned out to be true. Afterinstalling <code>wheel<\/code> and reinstalling <code>dlib<\/code>, the ModuleNotFound error went away.\u00a0<\/p>\n\n\n\n<p>I did not see installing <code>wheel<\/code> as an answer to my problem anywhere on stackoverflow or github, so perhaps I should go spread the gospel.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The python face_recognition library has a ton of features. In our chat app, we are using it as the basis of our login system. Instead of a password, users will enter a username and consent that a photo will be taken of them with their computer\u2019s webcam. The photo and their username will be stored [&hellip;]<\/p>\n","protected":false},"author":12708,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/swartsm\/wp-json\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/swartsm\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/swartsm\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/swartsm\/wp-json\/wp\/v2\/users\/12708"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/swartsm\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":1,"href":"https:\/\/blogs.oregonstate.edu\/swartsm\/wp-json\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":25,"href":"https:\/\/blogs.oregonstate.edu\/swartsm\/wp-json\/wp\/v2\/posts\/23\/revisions\/25"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/swartsm\/wp-json\/wp\/v2\/media?parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/swartsm\/wp-json\/wp\/v2\/categories?post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/swartsm\/wp-json\/wp\/v2\/tags?post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}