I'm having problems installing Adam Geitgey's face_recognition library on my Windows PC.
I followed this tutorial for installing dlib with Python bindings on windows and I've successfully installed the requirements listed there.
However, trying to install dlib with pip throws the error
setup.py install for dlib: finished with status 'error'
How can I go about resolving this?
In order for dlib (with its Python bindings) to work well for you on Windows, you need to use a Python installation whose version is 3.6 or lower.
I understand you're using the latest version of Python. If I'm correct in my assumption that you're working with Python 3.8, then you'll have to follow these steps:
Install Python 3.6 on your PC — take note of the installation path as you'll need this for creating the appropriate virtual environment.
Create a Python 3.6 virtual environment — this will serve to isolate the dependencies of your current project.
Assuming your Python 3.6 was installed to C:\Users\Mfonism\AppData\Local\Programs\Python\Python36 (like it was on my PC :)), you'll create your virtual environment thusly (from your project directory):
c:\> C:\Users\Mfonism\AppData\Local\Programs\Python\Python36\python.exe -m venv env36
venv is the Python virtual environment module.
env36 is the name of the virtual environment you're creating.
Activate the so-created virtual environment.
c:\> env36\Scripts\activate
The name of the virtual environment (env36) should now appear in the terminal.
UPDATE: IGNORE THIS BLOCK
Install your project dependencies with pip.
pip install face_recognition
If this fails, use the --no-cache-dir option to circumvent cached versions of the dependencies.
pip install face_recognition --no-cache-dir
UPDATE: DO THIS INSTEAD
You will need to install specific versions of dlib and face_recognition. And you will need to install dlib first, or face_recognition will try to install the latest version of it, and this will fail.
So:
Install dlib 19.8.1
pip install dlib==19.8.1
Then install face_recognition 1.2.2
pip install face_recognition==1.2.2
Related
I have created a new virtual environment with nothing else in it and I try to install
pip install scipy==1.4.1
However this returns the following error
ERROR: Failed building wheel for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly
This has been solved before by running
pip install --upgrade pip
However this does not work for me and I get the same error as before. If however I try and install the latest version of scipy there are no issues. Does anyone know a way around this? Maybe I need a less up to date version of python but I am really not sure.
Probably your python version is too new for this specific scipy version, use a earlier python version to solve the problem.
Install a specific python version (i.e. 3.7.4) from https://www.python.org/downloads/
Create virtual environment with pipenv:
pipenv shell --python 3.7.4
(and activate virtual environment)
Install scipy==1.4.1
I'm new to the MacOS and I have recently downloaded PyCharm on it. I was able to successfully install some packages like numpy, matplotlib, sympy, etc. However, Pytorch won't get installed; not through PyCharm nor through the Terminal. These are the commands I tried in the Terminal (other than attempting to install them directly from PyCharm):
pip install torch
pip install torch torchvision torchaudio
I could post the error messages but some are quite lengthy :(
I'm using Python 3.9 interpreter with pip on the latest version (20.2.4) (everything else is also up to date). Running this on the new Mac Mini (running the M1 chip).
Any ideas on what I should do? Thanks!!!
Try building from the source code, run these commands
git clone https://github.com/pytorch/pytorch.git
cd pytorch
git submodule update --init --recursive
python3 setup.py build
python3 setup.py install
Are you using a venv? If so you could try checking the box "install to user's site packages directory" in the Project Interpreter settings when you add a package.
My environment:
Ubuntu 18.0.4 LTS (also tried on 19.04)
I use/need python3 (3.6.8 installed)
I need cv2, which is a model of opencv.
I tried several receipts I found on the Internet, but nothing worked.
I tried to install as pre-compiled (sudo apt-get install python-opencv) - No error, but when I try the test:
import cv2 as cv
print(cv.__version__)
I get error module not found.
The problem seems that I have installed also anaconda. The above test uses then anaconda, and cannot find the module.
Compiling from source installed for python2, but I do need python3. (The test also uses anaconda)
One of my receipts worked till the end, but with the line:
workon OpenCV-master-py3
It gaves me the error workon not found.
I tried then to install via Conda, but that wants to downgrade Conda.
Is there a way to run it without anaconda and find a replacement for
"workon OpenCV-master-py3"
For python3 you can simply do pip3 install opencv-python and it will work.
using workon
creating virtual environment
mkvirtualenv -p python3 opencv
Inside the virtual environment.
If you are only working with images
pip install opencv-python
opencv-python
If you need support for working videos
pip install opencv-contrib-python
opencv-contrib-python
If you need a non GUI opencv
pip install opencv-python-headless
opencv-python-headless
If you need to install specific version you can use == to check the available version first like
pip install opencv-python== ,then install the version you require
I'm using python 3.7 (environment created by anaconda) and trying to run python code that uses some google libraries but I don't really know how to install them.
From PyCharm IDE (Settings -> Project Interpreter -> Available Packages) I cannot find those packages to install.
And from terminal, running 'pip install --upgrade oauth2client' or 'pip3 install --upgrade oauth2client' doesn't seem to work either.
What I don't understand is: to install packages/libraries on python 3.x, should i only use pip3? But what if there is more than one python environment? On which one pip will install those libraries?
If you're using Anaconda, you should also have an Anaconda Prompt (py37) program that functions like the terminal. Typing pip install --upgrade oauth2client into Anaconda Prompt (py37) will install the upgrade into your current python environment. Alternatively, you can use conda install with more options (including specifying which environment you want).
I am attempting to install a package for python3.4 on Mac OSX 10.9.4. As you know, python ships with OSX, so when I installed python3.4 I was happy to find that it came with its own version of pip, that would install packages to it (installing pip on a mac with multiple versions of python will cause it to install on the system's python2.7.)
I had previously tried installing this package (https://pypi.python.org/pypi/chrome/0.0.1) with my first installation of pip (the one tied to python2.7) and found that it successfully installed on that version, but not on any others.
I ran an install with the new pip keyword for python3.4 (which when called by itself spits out the help page so i know it works) and it told me that the package was already installed and to try updating. The update revealed that I already had the most recent version. so I tried uninstalling it from just the python3.4 and reinstalling to no avail, and got the same results when uninstalling pip from python2.7 and reinstalling only on version 3.4.
I know that's a bit hard to follow but hopefully that makes sense.
I also reviewed the content here with no success.
RESOLVED:
while python did have a directory named the same as a directory it uses with packages, this was not the correct directory, for me it was in a subdirectory of library. while documentation said that referencing pip2 would cause the package to install on python3.4, this was false. however, referencing pip3.4 worked for me.
My suggestion is that you start using virtualenv.
Assuming you have 3.4 installed, then you should also have pyvenv. As for pip and 3.4, it should already be installed.
Using for example version 3.4 create your own virtual environment and activate it:
$ mkdir ~/venv
$ pyvenv-3.4 ~/venv/py34
$ source ~/venv/py34/bin/activate
$ deactive # does what is says...
$ source ~/venv/py34/bin/activate
$ pip install ... # whatever package you need
With version 2.7 first install virtualenv and then create your own virtual environment and activate it. Make sure that setuptools and pip are updated:
$ virtualenv-2.7 ~/venv/venv27
$ . ~/venv/venv27/bin/activate
$ pip install -U setuptools
$ pip install -U pip
$ pip install ... # whatever package you need