ffmpeg says "this file requires zlib suport compiled in" - python

I've created a new conda environment and installed zlib and opencv. However, sometimes this error raises (but doesn't interrupt script execution):
[mov,mp4,m4a,3gp,3g2,mj2 # 000001d18e775800] this file requires zlib support compiled in
[mov,mp4,m4a,3gp,3g2,mj2 # 000001d18e775800] error reading header
Is there a chance to fix this issue under windows? When using WSL this error doesn't show up, but then the program randomly terminates printing "Killed" (without any error). I already tried to uninstall opencv using conda and install opencv-python using pip, but I got the same error.

As Christoph Rackwitz suggested, the error wasn't related to OpenCV but to FFmpeg. So what I did to resolve the issue:
conda create --name myenv
conda activate myenv
conda install zlib
conda install -c conda-forge ffmpeg
conda install opencv
This process installs an FFmpeg version compiled with zlib support and the error is gone.

Related

Install hazm on anaconda 3

i want to install hazm on anaconda3 .I use this command to install this package with downloaded package :
conda install hazm-0.4.tar.gz
or this command in pycharm :
conda install hazm
in both manner it gives me this error:
Solving environment: failed
PackagesNotFoundError: The following packages are not available from
current channels:
hazm
Current channels:
https://repo.continuum.io/pkgs/main/linux-64
https://repo.continuum.io/pkgs/main/noarch
https://repo.continuum.io/pkgs/free/linux-64
https://repo.continuum.io/pkgs/free/noarch
https://repo.continuum.io/pkgs/r/linux-64
https://repo.continuum.io/pkgs/r/noarch
https://repo.continuum.io/pkgs/pro/linux-64
https://repo.continuum.io/pkgs/pro/noarch
what is the problem ?
The instruction on the hazm documentation page is to install the package using pip:
pip install hazm
pip can be used to install non-conda packages in a conda environment, if there isn't a conda package available.
Reading this question and its answers it sounds as if the latest version of hazm may not install under Windows because of a dependency issue. If you're on Windows you need to specify the 0.4 version, either with hazm==0.4 or simply by pointing to the archive you downloaded. I was able to install hazm 0.4 from the gz archive on Anaconda under Windows without errors as follows:
conda create -n testhazm python=3.4 nltk=3.0.0
activate testhazm
pip install hazm-0.4.tar.gz
(If I allowed conda to use the latest version of nltk, the installation went OK but I got an error when I actually started Python and tried to import hazm. You may be able to get it working with a more recent version of nltk and/or Python by experimenting.)
Background:
When you do conda install hazm the error message The following packages are not available from current channels: hazm means exactly what it says: the channels specified in your current conda configuration do not contain this package.
Often, packages that are not available on the default conda channels can be found on conda-forge, but I checked this with conda search hazm -c conda-forge and it looks like it's not there either.
To use the command conda install hazm-0.4.tar.gz, the downloaded file would need to be a conda package, not just a Python module.

Install tensorflow windows - python conflict

I'm trying to install tensorflow on a windows 7 machine running anaconda python 2.7.13.
C:\>python -V
Python 2.7.13 :: Anaconda 4.3.1 (64-bit)
I start by :
conda create -n tensorflow python=2.7
This prompts me to proceed, I say yes and it installs several packages without issue (all seem to point to a 2.7 version of python).
Next I use :
conda install -c conda-forge tensorflow
Which gives me this error:
UnsatisfiableError: The following specifications were found to be in conflict:
- python 2.7*
- tensorflow -> python 3.5*
Use "conda info <package>" to see the dependencies for each package.
Any suggestions how to fix this?
EDIT: I also tried this:
C:\>pip3 install --upgrade tensorflow
'pip3' is not recognized as an internal or external command,
operable program or batch file.
Next:
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl
and got this error message:
tensorflow-1.1.0-cp35-cp35m-win_amd64.whl is not a supported wheel on this platf
orm.
Is there a reason you want to use Python 2.7? If you start with:
$ conda create -n tensorflow python=3.6
you should be able to install it how you are trying to, and run the latest release to boot! Otherwise, you might try installing TensorFlow r0.12.1 with pip:
$ source activate tensorflow
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl
$ pip install --ignore-installed --upgrade $TF_BINARY_URL
If you need GPU support, replace the export line in the above with:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.1-cp27-none-linux_x86_64.whl
I think since TF 1.0.1 came out, pip is the preferred installation method. If I had to guess, they changed the packages available through conda-forge and the newest version does not work with Python 2.7 (or at least that version is not available on conda-forge). I could be wrong, but this should get you there either way.

how to get opencv_contrib module in anaconda

Can anyone tell me commands to get contrib module for anaconda
I need that module for
matches = flann.knnMatch(des1,des2,k=2)
to run correctly
error thrown is
cv2.error: ......\modules\python\src2\cv2.cpp:163: error: (-215) The data should normally be NULL! in function NumpyAllocator::allocate
Also I am using Anaconda openCV version 3, and strictly dont want to switch to lower versions
P.S. as suggested at many places to edit file cv2.cpp option is not available with anaconda.
I would recommend installing pip in your anaconda environment then just doing: pip install opencv-contrib-python. This comes will opencv and opencv-contrib.
Anaconda supports pip install to install package into conda environment. You can download OpenCV 3.2.0 with opencv_contrib from this well known Unofficial Windows Binaries for Python Extension Packages website. See the filename below for the right version. Then type the command in Anaconda Prompt window to install the package:
For Python 3.5 and 64-bit Windows:
pip install opencv_python‑3.2.0+contrib‑cp35‑cp35m‑win_amd64.whl
For Python 3.6 and 64-bit Windows:
pip install opencv_python‑3.2.0+contrib‑cp36‑cp36m‑win_amd64.whl
Most of the OpenCV 3.2.0 packages in Anaconda repository didn't specific if they come with opencv_contrib. The pip install approach is easier and proven, see one of the SO post. The only drawback is that conda list will not show pip installed package there but actually it's.
However, if you want to have trial on conda install, below is the command for installing OpenCV 3.2.0 for Python 3.5 or 3.6 but likely without opencv_contrib.
conda install -c conda-forge opencv=3.2.0
Hope this help.
You can try this: https://anaconda.org/michael_wild/opencv-contrib
To install this package with conda run:
conda install -c michael_wild opencv-contrib
These anaconda packages include the contrib modules with base OpenCV3. Though the file list says it's currently for Windows only!
The question is old but I thought to update the answer with the latest information. My Anaconda version is 2019.10 and build channel is py_37_0 . I used pip install opencv-python==3.4.2.17 and pip install opencv-contrib-python==3.4.2.17. Now they are also visible as installed packages in Anaconda navigator and I am able to use patented methods like SIFT etc.
Method 1: in Anaconda Prompt write this, will install opencv-contrib v4.6
pip install opencv-contrib-python
Method 2: Install previous version of opencv-contrib v3.3.1
According to https://anaconda.org/michael_wild/opencv-contrib it says it support win64bit only and python 3.6.x.
So, first you need to create new enviroment support python 3.6
conda create --opencv_contrib36 python=3.6.13
then, install the packages
conda install -c michael_wild opencv-contrib
There is repo in conda-forge which includes opencv-contrib: https://github.com/conda-forge/opencv-feedstock
To use it:
conda install --channel=conda-forge libopencv opencv py-opencv
if you run into Numpy error, try pinning more recent version (of Numpy).
This worked for me in Windows 10 on Anaconda 5.3 with python 3.6
conda install -c conda-forge opencv

How to build/install OpenCV in Anaconda 3 on Max OS-X?

I've tried installing directly through conda.
conda install opencv
But through this
The following specifications were found to be in conflict:
- alabaster (target=alabaster-0.7.7-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- anaconda (target=anaconda-4.0.0-np110py35_0.tar.bz2) -> anaconda-client
...
This error goes over a hundred lines.
I've also tried making it from cmake, but I can't seem to set the Python interpreter and related fields to the ones in Anaconda 3.
I've referred quite a few related posts, but it still didn't solve my problem.
Installing openCV in anaconda3 - Python.h: No such file or directory
How to install python opencv through Conda?
Note: conda install opencv worked fine in Anaconda 2, but I don't know why so many package conflicts arise in Anaconda 3.
conda install -c https://conda.binstar.org/menpo opencv
Its useful.
https://stackoverflow.com/a/27650299
It's the solution:
conda install -c menpo opencv3=3.1.0

How to install PyTables 2.3.1 with Anaconda, missing HDF5 library

I need to run an older verion of PyTables, that is 2.3.1, in and Anaconda environment on Linux. But I cannot install it.
conda install -n myenv pytables=2.3.1
fails finding the appropriate version.
conda install -n myenv pytables=2
installs PyTables 2.4.0 successfully. But I need 2.3.1.
Also activating the environment and installing via pip does not work.
pip install tables==2.3.1
fails with the following error:
.. ERROR:: Could not find a local HDF5 installation.
You may need to explicitly state where your local HDF5 headers and
library can be found by setting the HDF5_DIR environment
variable or by using the --hdf5 command-line option.
Where can I find the HDF5 installation of Anaconda? And how do I pass the --hdf5 option to pip? I already tried
pip install tables==2.3.1 --install-option="--hdf5=/home/me/Programme/anaconda"
But it also fails with the same error as above.
You can try
env HDF5_DIR="/home/me/Programme/anaconda" pip install tables==2.3.1
It worked for me.
I was trying to install a completely different package with pip on a new conda environment when I got the same error.
conda install -c conda-forge pytables
This helped me to get rid of the error and successfully install the package.

Categories