I'm trying to install Dlib in anaconda python with this line:
conda install -c menpo dlib
and I'm getting error like this:
UnsatisfiableError: The following specifications were found to be in conflict:
- dlib
- xlwt
Use "conda info <package>" to see the dependencies for each package.
How can I solve this problem?
Path of core-meta: C/users/{xxx}/anaconda3/core-meta
Delete core-meta then run the following commands:
Conda update --all
Conda install dlib
These commands require an internet connection so keep wifi on during the command running process.
Here xxx is the username on your computer.
If you do not need the xlwt-package for your project, just create a new conda environment and install the dlip package locally in that environment.
you can also try following:
brew install cmake
brew install boost
then create a virtual environment using conda command
conda create -n dlib python=3.6 anaconda
Activate the environment
source activate dlib
run the following command
conda install pip
and finally install dlib using below command
pip install dlib
This worked for me.
For anaconda or miniconda3, please see the following installation procedures. It will comply with Python 3.7 in this way.
1.Install cmake with git
$ sudo apt-get install git cmake
2. Enter into the the directory
Please change user to your own username
$ cd /home/user/dlib
3. Compile dlib
$ python setup.py install
If meeting with the issue that you could not put the import statements of setuptools behind the import statement of distutils, please change the placement oder in setup.py in the directory of dlib.
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from distutils import log
from distutils.version import LooseVersion
4. Run the dlib unit test suite in the current working directory
Please note there is a sub-directory of dlib inlcuded in the directory of dlib.
$ cd dlib/test
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build . --config Release
$./dtest --runall
Cheers.
on mac system :
you have to do it via brew
brew install cmake
brew install boost
brew install boost-python --with-python3
After installing above packages if you need you can create your environment and proceed with dlib installation or you can simply run next step.
The dlib library doesn’t have any real Python prerequisites, but if you plan on using dlib for any type of computer vision or image processing, These are few libraries which you can install for dlib :
* NumPy
* SciPy
* scikit-image
pip install numpy
5 pip install Scipy
pip install scikit-image
pip install dlib
you can check for more details on this link:
https://www.pyimagesearch.com/2017/03/27/how-to-install-dlib/
You have to try by putting just:
conda install dlib
Related
I need to install a version of the rdkit library released prior to 2019, when support for Python 2 was removed. This is needed to work with this library: https://github.com/brain-research/deep-molecular-massspec
I have downloaded the library from the git page, eg. https://github.com/rdkit/rdkit/releases/tag/Release_2018_09_1, and tried using pip to install from that.
sudo pip install rdkit-Release_2018_09_1b1.tar.gz
I get the following error:
Processing ./rdkit-Release_2018_09_1b1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
IOError: [Errno 2] No such file or directory: '/tmp/pip-ohIcaj-build/setup.py'
---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-ohIcaj-build
I have tried installing the specific version using pip too:
sudo pip install rdkit==2018.09.01
Which gives:
Collecting rdkit==2018.09.01 Could not find a version that satisfies
the requirement rdkit==2018.09.01 (from versions: ) No matching
distribution found for rdkit==2018.09.01
Can someone tell me how to do this?
#paisanco is correct, attempting to install rdkit with pip will not work. The easiest way to install rdkit is by using Anaconda unless you want to build from source.
If you have Anaconda installed you can create a python 2.7 virtual environment:
conda create --name test-env python=2.7
You can then activate it:
conda activate test-env
And then install the rdkit version you require:
conda install -c rdkit rdkit=2018.09.1
Using Python:
import rdkit
print rdkit.__version__
[Out]: '2018.09.1'
Create a new conda environment with python 2.7.15:
conda create -n py27_rdkit python=2.7.15 ipython
Activate environment (python2.7)
conda activate py27_rdkit
Now in the py27_protac environment, install older version of rdkit that won't gripe about python2.7:
conda install -c conda-forge rdkit rdkit=2018.09.1
The conda install command in answer above: 'conda install -c rdkit rdkit=2018.09.1' failed due numerous conflicts.
The problem is what you downloaded, according to that site, is a tar archive containing the source code for that library, not a pip package.
So attempting to install it using pip will not work.
The RDKit project home page gives other options for installing 1) from within an Anaconda conda virtual environment 2) from the source code (what you downloaded) for Windows, Linux, and Mac.
Those instructions are at RDKit installation instructions
conda create -n my_env python=3.7
conda activate my_env
conda install numpy matplotlib
conda install cmake cairo pillow eigen pkg-config
conda install boost-cpp boost py-boost
and download rdkit package https://anaconda.org/rdkit/rdkit/files
# finally
conda install rdkit-2020.09.1b1.0-py37hd50e099_1.tar.bz2
I am new to PyCharm and trying some face recognition stuff. I need a face_recogniton library for my work which is installed using the following command (I'm using Ubuntu 18.04 as my OS):
pip install face_recognition
I am able to import it in python interpreter but it throws import error in PyCharm
ImportError: No module named 'face_recognition'.
Thanks for your effort in helping me.
For installing face-recognition module for Ubuntu 18.04: (Try for other OS, I used this for 18.04)
Install cmake: pip install cmake
After cmake is successfully installed
Optional: Install git if you don't have git
git clone https://github.com/davisking/dlib.git
build the main dlib library
cd dlib
mkdir build; cd build; cmake ..; cmake --build .
Build and install python essentials
cd ..
python3 setup.py install
After all this run these to verify
python3
>> import dlib
Now install face_recognition
pip3 install face_recognition
Takes some time but that is okay! I hope it worked for you
Refer these materials:
face-recognition original repo: https://github.com/ageitgey/face_recognition#installing-on-mac-or-linux
dlib: https://gist.github.com/ageitgey/629d75c1baac34dfa5ca2a1928a7aeaf
Reading face_recognition installation guide on github, make sure you have dlib installed and then install face_recognition with:
pip3 install face_recognition
Also, check if PyCharm is using environment where you installed face_recognition. Maybe PyCharm created it's own virtual env and you are using it without face_recognition.
For more info about how to install module in PyCharm env, please check this answer, just except pygame check if face_recognition is listed. If not, install it.
Looks like you have installed maybe multiple versions of Python. You seem to have installed face_recognition for python version 2, whereas you are trying to access the module from Python version 3. You should consider using virtual environments and set up Python Interpreter accordingly.
Follow https://www.jetbrains.com/help/idea/configuring-local-python-interpreters.html on how to configure the interpreter.
Download this file cmake-3.17.0-rc3-win64-x64.msi from cmake.org and install it (By default it will be installed in C:\Program Files\CMake\bin).
After the installation copy this path and edit environment variable -> path -> paste that path -> click ok. Open the cmd and now use pip install face_recognition
i hope it should work....
It seems the COCO PythonAPI only support python2. But peoples do use it in python3 environment.
I tried possible methods to install it, like
python3 setup.py build_ext --inplace
python3 setup.py install
But python3 setup.py install will fail due to coco.py and cocoeval.py containning python2 print function.
Update: solved by updating the COCO PythonAPI project. Leave this question for people facing the same issue.
Try the following steps:
Use git clone to clone the folder into your drive. In this case, it should be git clone https://github.com/cocodataset/cocoapi.git
Use terminal to enter the directory, or open a terminal inside the directory
Type in 2to3 . -w. Note that you might have to install a package to get 2to3. It is an elegant tool to convert code from Python2 to Python3; this code converts all .py files from Python2-compatible to Python3-compatible
Use terminal to navigate to the setup folder
Type in python3 setup.py install
This should help you install COCO or any package intended for Python2, and run the package using Python3. Cheers!
I have completed it with a simple step
pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
** before that you need to install Visual C++ 2015 build tools on your path
Install
Instead of the official version (which has issues with python 3) use an alternative one. Install it on your local machine, globally (i.e., outside any virtual environment). You can do this by:
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Check if it is installed globally:
pip freeze | grep "pycocotools"
You should see something like pycocotools==2.0.0 in your output.
Now, inside your virtual-env (conda or whatever), first install numpy and cython (and maybe setuptools if it's not installed) using pip, and then:
pip install pycocotools
Verify
Inside your project, import (for example) from pycocotools import mask as mask and then print(mask.__author__). This should print out the author's name, which is tsungyi.
Where Is It?
The installed package, like any other packages that are locally installed inside a virtual-env using pip, will go to External Libraries of your project, under site-packages. That means it is now part of your virtual-env and not part of your project. So, other users who may want to use your code, must repeat this installation on their virtual-env as well.
Troubleshooting:
The main source of confusion is that either you did not install the required packages before installing cocoapi, or you did install the required packages but for a different python version. And when you want to check if something is installed, you may check with, for instance, python3.6 and see that it exists, but you are actually running all your commands with python3.7. So suppose you are using python3.7. You need to make sure that:
python -V gives you python3.7 and NOT other version, and pip -V gives you pip 19.2.3 from /home/<USER>/.local/lib/python3.7/site-packages/pip (python3.7), that actually matches with your default python version. If this is not the case, you can change your default python using sudo update-alternatives --config python, and following the one-step instruction.
All the required packages are installed using the right python or pip version. You can check this using pip and pip3 to stop any differences that may cause an issue:
pip freeze | grep "<SUBSTRING-NAME-OF-PACKAGE>" or pip show <PACKAGE-NAME> for more recent versions of pip.
To install the required packages, after you made sure about (1), you need to run:
sudo apt install python-setuptools python3.7-dev python3-wheel build-essential and pip install numpy cython matplotlib
Environment:
The above steps were tested on Ubuntu 18.4, python 3.6.8, pip 19.0.3.
If you are struggling building pycocotools on Ubuntu 20.04 and python3.7
try this:
sudo apt-get install -y python3.7-dev
python3.7 -m pip install pycocotools>=2.0.1
There are alternative versions of the cocoapi that you can download and use too (I'm using python 3.5). Here's a solution that you might want to try out: How to download and use object detection datasets (e.g. coco or pascal)
here's how i did successfully! (the reason is the gcc version)
install the dependencies: cython (pip install cython), opencv (pip install opencv-python)
check the gcc version by this command: gcc --version
your output will be like this 'Command 'gcc' not found, but can be installed with:
sudo apt install gcc
'
Type the below commands to install the gcc:
sudo apt update
sudo apt install build-essential
sudo apt-get install manpages-dev
now check again the gcc version(step2)
if you get below output
'gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'
now run the code for pycocotools installations:
pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
finally wait check if the installation is successful :
'Successfully installed pycocotools-2.0'
I am on a mac os X Yosemite. I installed dlib with anaconda with:
conda install -c menpo dlib=19.4
and then removed X11 from anaconda/lib since the X11 distributed by anaconda is presumably broken. Then I installed Xquartz from https://www.xquartz.org/.
But when I go into ipython and import dlib, and type
dlib.image_window()
I am still getting error:
AttributeError: 'module' object has no attribute 'image_window'
What's the issue?
Note I tried installing dlib from scratch when anaconda is not in my system, and I ran into all kinds of other issues. So currently I am committed to making dlib work with anaconda, which it does, except for image_window and presumably other things associated with X11.
I ran into the same issue on my Mac. After doing readings on GitHub, I don't think there exists a workaround for installing dlib with anaconda, since something is not right with X11 headers used by anaconda.
I am able to make dlib.image_window() work after building dlib from source using the latest version available on the repo. The steps are large the same as suggested here on GitHub. The following steps were carried out in a conda environment I use exclusively for computer vision applications:
Clean up dlib installed via conda:
conda uninstall dlib
Install cmake and boost-bython with homebrew:
brew install cmake
brew install boost-python
Build dlib from source:
git clone https://github.com/davisking/dlib.git
cd dlib/
mkdir build
cd build/
cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1; cmake --build .
python setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA
The codes took a while to build, but the library works for me in the end.
I'm trying to install gdal from pip pip install gdal inside a virtual environment (Ubuntu). It fails because it cannot find cpl_port.h
extensions/gdal_wrap.cpp:2853:22: fatal error: cpl_port.h: No such file or directory
compilation terminated
However GDAL is installed correctly and the header file is located at /usr/include/gdal/cpl_port.h. Is there some environment variable for GDAL that needs to be set in order for pip to find the header files?
As suggested in the other thread, exporting some shell variables before running pip worked flawlessly. A path for *_INCLUDE_PATH can be found with gdal-config --cflags.
# GDAL library must have been installed
sudo apt-get install libgdal-dev
# Set up pip and/or virtualenv stuff
...
# Now install Python binding for GDAL
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pip install GDAL
Tomyun's answer worked for me, with the proviso that you have to ensure that the version of GDAL-dev installed via apt-get matches the version being installed by pip.
For Ubuntu 14.04, the commands are:
# GDAL library must have been installed
sudo apt-get install libgdal-dev
# Set up pip and/or virtualenv stuff
...
# Now install Python binding for GDAL
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pip3 install GDAL=1.10.0
Taken from this comment, it solved my issue directly
pip3 install GDAL==$(gdal-config --version)
Explicit version number should match your existing libgdal version. –
Using PIP :
pip install --no-install GDAL
Then cd into ENV/build/GDAL
python setup.py build_ext --include-dirs=/usr/include/gdal
pip install --no-download GDAL
(Source: http://ubuntuforums.org/showthread.php?t=1769445)
Using Buildout :
[gdal-bindings]
recipe = zc.recipe.egg:custom
egg = GDAL==1.9.1
include-dirs = /usr/include/gdal
library-dirs = /usr/lib
I was also getting this error when test installing in a virtual environment a package of mine that depends on GDAL. In this case the solution is to change the dependecy from GDAL to pygdal in the install_requires parameter in setup.py. Like so:
install_requires=['pygdal'],
This is what worked for me:
I had to get the latest hearder versions for installing gdal 2.2.4 through pip:
sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt install libgdal-dev
Before that, I was getting extensions/gdal_wrap.cpp:3172:27: fatal error: cpl_vsi_error.h: No such file or directory, even when including the correct "include" path to pip.
The the pip installation (in a virtualenv):
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal
try to do:
brew install gdal
after that try again.