Installing dlib in Python - python-3.x

I want to install face_recognition for a project that I am about to start. However, face_recognition has a dependency on dlib and I don't know how to install that.
I entered pip install dlib, however, an error was thrown since it said that I needed to install CMake. Here is the error:
Using cached dlib-19.24.0.tar.gz (3.2 MB)
Preparing metadata (setup.py) ... done
Installing collected packages: dlib
DEPRECATION: dlib is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for dlib ... error
error: subprocess-exited-with-error
× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
running install
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
running build_ext
ERROR: CMake must be installed to build dlib
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> dlib
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Thus, I tried to install CMake:
Collecting CMake
Using cached cmake-3.25.0-py2.py3-none-win_amd64.whl (32.6 MB)
Installing collected packages: CMake
WARNING: The scripts cmake.exe, cpack.exe and ctest.exe are installed in 'C:\Users\Emma\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed CMake-3.25.0
However, when I tried to install dlib again, I got the same error even though I installed CMake successfully.
How could I install dlib now? For reference, I am using a Windows 10 or 11 system, and Python 3.11 64-bit.

Update/Install Visual C++
Maybe try installing/updating Visual C++. Because this is necessary for CMake to run. You can install it from here, https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=15#
Installation with Wheel File
Run this:
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
Installation from Internet
Install CMake from https://cmake.org/download/
Run this,
set PATH="%PATH%;C:\Program Files\CMake\bin
to add CMake to your path. You can also do this manually by Editing The Environment Variables.
3)Download the following,
https://pypi.org/project/dlib/#files.
In the specified folder in which you extracted the install files run the following,
python setup.py install.

Related

I'm encountering an error while installing turicreate module on wsl, is there any requirements I'm missing?

whenever I try to install turicreate module on wsl it's showing an error like this
`Collecting turicreate
Using cached turicreate-6.4.tar.gz (1.9 kB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for turicreate, since package 'wheel' is not installed.
Installing collected packages: turicreate
Running setup.py install for turicreate ... error
error: subprocess-exited-with-error
× Running setup.py install for turicreate did not run successfully.
│ exit code: 1
╰─> [30 lines of output]
running install
/root/turitest/venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
==================================================================================
TURICREATE ERROR
If you see this message, pip install did not find an available binary package
for your system.
Supported Platforms:
* macOS 10.12+ x86_64.
* Linux x86_64 (including WSL on Windows 10).
Support Python Versions:
* 2.7
* 3.5
* 3.6
* 3.7
* 3.8
Another possible cause of this error is an outdated pip version. Try:
`pip install -U pip`
==================================================================================
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> turicreate
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
`
pip version - 22.0.2
python3.10 (I guess this maybe the problem, but I'm not sure)
windows10 OS
can someone help me to install turicreate...
I tried updating and upgrading pip versions, tried in python 2.7 and python3.10 but still got the same error.
I also tried this command,
python3 -m pip3 install -U pip
this returned
No module named pip3

Error trying to install python pywinpty>=1.1.0 package

I try to install the python for aws glue connectivity,
so I installed pip install --upgrade jupyter boto3 aws-glue-sessions.
I'm getting errors in this particular package.
Collecting pywinpty>=1.1.0 Using cached pywinpty-2.0.5.tar.gz (23 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [6 lines of output]
Cargo, the Rust package manager, is not installed or is not on PATH.
This package requires Rust and Cargo to compile extensions. Install it through
the system's package manager or via https://rustup.rs/
Checking for Rust toolchain....
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
Found a solution online. Installing 64 bit Python resolved my issue. Check your installation with python -V -V, it should say 64 bit.

Can not install psycopg2 on Mac 12.3, I keep getting this error

Ive recently bought a MacBook Pro and was setting it up for some python and Django programming but I ended up having problems installing psycopg2, I've tried several things already and none of those worked for me, here left the error,
Collecting psycopg2
Using cached psycopg2-2.9.3.tar.gz (380 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
running egg_info
creating /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info
writing /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/PKG-INFO
writing dependency_links to /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/dependency_links.txt
writing top-level names to /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/top_level.txt
writing manifest file '/private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/SOURCES.txt'
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
It shows it is not a problem with pip but with setup.py but can not find anything,
any help would be welcomed
Thanks
As Alex mentioned, it is PostGreSQL being not installed on your system that throws up the error
Install PostGreSQL and it will all work fine
Try this
❯ brew install postgresql
# If you open a new terminal tab you will see that pg_config is available
❯ export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
❯ export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib -L${HOME}/.pyenv/versions/3.8.10/lib"
❯ python -V
Python 3.9.13
❯ pip install psycopg2-binary==2.8.6```
Try using the following command:
pip3 install psycopg2-binary
Late, but I just had this problem and nothing I was finding was fixing it. I was trying to install the requirements.txt for an ongoing project on a new Mac. Eventually I remembered it's a postgresql package and I hadn't installed postgresql yet. As soon as I installed postgresql and tried installing psycopg2 again, it worked fine with no errors.

I am building a Python project. But their is a error while installing one package

while installing pip install ecapture some of the package installed easily but their is a error showing "ERROR: Could not build wheels for scikit-image which use PEP 517 and cannot be installed directly". Can someone explain it.

Unable to build opencv-python with python 3.8

OS:ubuntu
I am able to install opencv-python from the command line. However,when I tried to install my self-built package with opencv-python dependencies, it failed to biuld:
Building wheels for collected packages: opencv-python
Building wheel for opencv-python (PEP 517): started
Building wheel for opencv-python (PEP 517): finished with status 'error'
ERROR: Complete output from command /usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp7jntqv2r:
ERROR: Not searching for unused variables given on the command line.
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-utbicth7/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
Not searching for unused variables given on the command line.
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-utbicth7/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
-- Trying "Unix Makefiles" generator - failure
--------------------------------------------------------------------------------
********************************************************************************
scikit-build could not get a working generator for your system. Aborting build.
Building Linux wheels for Python 3.6 requires a compiler (e.g gcc).
It can be installed using debian package manager:
sudo apt-get install build-essential
To build compliant wheels, consider using the manylinux system described in PEP-513.
Get it with "dockcross/manylinux-x64" docker image:
https://github.com/dockcross/dockcross#readme
For more details, please refer to scikit-build documentation:
http://scikit-build.readthedocs.io/en/latest/generators.html#linux
********************************************************************************
----------------------------------------
ERROR: Failed building wheel for opencv-python
I suspect issue is with scikit-build. I checked I have ninja, make/gcc all available. I set manually CMAKE_MAKE_PROGRAM=/usr/bin/make.
But still failed with same error. I
You are missing dependencies. Please see this part of the error message you have provided above:
Building Linux wheels for Python 3.6 requires a compiler (e.g gcc).
It can be installed using debian package manager:
sudo apt-get install build-essential
Therefore, please use apt-get to install the build tools required to build your package.
Run pip3 install -U pip before install opencv-python.
Finally figured out, when I installed locally I had a requirements with version 4.1.x and no issues. When I install with the dependencies, it fetches the latest version 4.4 and the issue is that 1) pip version is 19.1 and2) since 4.3 opencv, the wheels has been replaced.

Resources