No module name 'face_recognition' windows - python

I am using a windows computer. When I run the command(which is below) it does not work and says something about dlib. I looked at this stack overflow post but no answers worked:
Stackoverflow post
My install:
>>> pip install face-recognition
My code:
import face_recognition
image = face_recognition.load_image_file("your_file.jpg")
face_landmarks_list = face_recognition.face_landmarks(image)
error:
Traceback (most recent call last):
File "main.py", line 1, in <module>
import face_recognition
ModuleNotFoundError: No module named 'face_recognition'

Face_recognition package is not officially supported on Windows but it might be work,
Here is the two way, You can install face_recognition package,
For Windows 10, You can follow these steps,
https://github.com/ageitgey/face_recognition/issues/175#issue-257710508
They are also providing ready-made virtual environment for this, So you can install it on your Windows system from here by using virualbox.
https://medium.com/#ageitgey/try-deep-learning-in-python-now-with-a-fully-pre-configured-vm-1d97d4c3e9b
I know Windows is not supporting face_recognition package but I guess this will little bit help you.

It seems the package doesn't seem installed. You may be running in a different environment.

Related

How can I import in Python simple coding error

I have started any coding for example: from PIL import Image, I encountered such an error:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
I will be pleased that guide me.
In shell, run:
pip install Pillow
PIL is deprecated - Pillow is its replacement
This means that the package is not installed. To install it, you will need pip, a package installer for python.
Here is the Pillow package official website, which you can use to understand how to install the package: https://pillow.readthedocs.io/en/stable/installation.html. All the commands on the site are typed into Terminal on MacOS and Linux and the cmd on Windows.

importing openbabel wrapper pybel for macos without conda

Previously I asked how to install openbabel for macos here. Now I also need to install the openbabel python wrapper pybel. I tried pip install pybel and it was installed. Then, while I was following the tutorial,
import openbabel
import pybel
mymol = pybel.readstring("smi", "CCCC")
I got the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'pybel' has no attribute 'readstring'
It turns out other people had similar issues and in fact I found in the mailing list that, I quote
'I guess you installed pybel via pip install pybel, which is the
"wrong" pybel'
Then they give a solution which is pip install openbabel, which is not possible for macos.
A solution is to use conda to install openbabel but I am not using conda and I would like to keep it that way so I am looking for a solution which does not require conda.
I found the solution, you can brew install open-babel and then give the path to homebrewed library of python site-packages. For me the following works:
import sys
sys.path.append('/usr/local/lib/python3.8/site-packages')
Then you can
import openbabel
from openbabel import pybel
and so on.
I have exactly the same problem. It works with the following code:
from openbabel import pybel
mymol = pybel.readstring("smi","CCN(CC)CC")
mymol

ModuleNotFoundError: No module named 'simpleaudio'

Basically, I recently started Python. I'm working on a project where I need audio to play. I searched up some libraries that can play audio and tried simpleaudio. I'm using Windows and sucessfull installed simpleaudio using: pip3 install simpleaudio.
However, when I tried to use simpleaudio in my project with import simpleaudio as sa, it gives me this error:
Traceback (most recent call last):
File "d:\coding\python\python projects\random tests\soundtest.py", line 1, in
import simpleaudio as sa
ModuleNotFoundError: No module named 'simpleaudio'
Any idea what is wrong?
After I installed simpleaudio, import simpleaudio as sa worked with no errors. I've run into similar errors before, and it was always because the version of pip I was using and the Python interpreter I was using didn't match. You probably need to either switch to using the same interpreter as pip3 or install the package for whatever interpreter you're using
The most probable issue is the use of differing version of python. For instance if you use pip3 it is for python3 only
Since the module was not found try
pip install simpleaudio
and then importing again
It's possible you installed the library for python2 instead of python3. In ubuntu pip is python2 and pip3 is python3- I'm not sure if that's the case on windows or not.

Broken python after Mac OS X update

After an update of OS X Yosemite 10.10.5 my Python install has blown up. I am not using brew, macports, conda or EPD, here, but a native Python build. While it was perfectly functional before, now it seems to have lost track of the installed packages. I try to start an ipython session and it returns
$ ipython
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/ipython", line 7, in <module>
from IPython import start_ipython
ImportError: No module named IPython
Then I resort to checking whether I can re-install ipython but my pip also went missing:
$ sudo pip install ipython
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/pip", line 7, in <module>
from pip import main
ImportError: No module named pip
So may it be that pip disappeared?
$ sudo easy_install install pip
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
I have tried solutions to this last problem reported before but they do not seem to work.
So it seems that Python has lost track of itself. Anyone, clues of what may have gone wrong and how can I fix this? Thanks!
It is not quite clear what you mean by saying that you installed "a native Python build". But in any case, it seems you wrote files of your installation into the system directory" /System/..., which is not a good thing to do, since these are controlled by OSX and e.g. may be overwritten by a system update.
Apparently, that is then what happened. You updated OSX, it clobbered your changes to /System/... and thereby messed up your Python installation.
Note that AFAIK, with OSX 10.11 it will no longer even be possible to write into system directories, so you will need a different setup anyway.
A suggestion to avoid/fix this is simple: Use one of the standard ways to install your Python stack -- my personal recommendation is either macports or anaconda.

scikits.audiolab doen't import into python (numpy.dtype)

I have installed (with lots of troubles) scikits.audiolab for making sounds out of data. Now when I type:
import scikits.audiolab I get the following error
>>> import scikits.audiolab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/scikits.audiolab-0.11.0-py2.7-macosx-10.7-intel.egg/scikits/audiolab/__init__.py", line 25, in <module>
from pysndfile import formatinfo, sndfile
File "/Library/Python/2.7/site-packages/scikits.audiolab-0.11.0-py2.7-macosx-10.7-intel.egg/scikits/audiolab/pysndfile/__init__.py", line 1, in <module>
from _sndfile import Sndfile, Format, available_file_formats, \
File "numpy.pxd", line 30, in scikits.audiolab.pysndfile._sndfile (/private/tmp/easy_install-gKE3i5/scikits.audiolab-0.11.0/scikits/audiolab/pysndfile/_sndfile.c:9632)
ValueError: numpy.dtype does not appear to be the correct type object
How do I fix this?
Any alternative package that can do the job?
I had the same issue and for me it was caused by installing another (more recent) version of NumPy.
Check if you have different versions of NumPy installed and try switching back to an older one. For my part: I had a system-wide installation of Python and common modules like NumPy, which I couldn't touch because I'm not admin on that system. So when I installed some other library locally (in ~/.local/lib/python2.7/) it would also install more recent versions of SciPy and NumPy and put them into that local folder. And when importing the module it would draw from the local directory first before looking at the system-wide libraries which were working fine before with scikits.audiolab. So for me it was solved by
pip uninstall numy && pip uninstall scipy because that only deleted the newer local versions of numpy.
But more specific to your case, here is a tutorial how (on a Mac) to switch to a certain version of NumPy:
multiple numpy version on Mac OS X
The NumPy version I found working for my scikits.audiolab is 1.6.1
>>> import numpy
>>> numpy.version.version
'1.6.1'
Hope that helps. :)
Maybe you installed/upgraded numpy after installing talkbox. Try running this command:
pip install --upgrade --force-reinstall scikits.talkbox
As suggested here:
https://github.com/ppwwyyxx/speaker-recognition/issues/13

Categories

Resources