Install using pip⚓
Best option for easily getting stable VidGear installed.
Prerequisites⚓
When installing VidGear with pip, you need to manually install following prerequisites:
Upgrade your pip
It strongly advised to upgrade to latest pip
before installing vidgear to avoid any undesired installation error(s).
There are two mechanisms to upgrade pip
:
You can use existing pip
to upgrade itself:
Install pip
if not present
- Download the script, from https://bootstrap.pypa.io/get-pip.py.
- Open a terminal/command prompt,
cd
to the folder containing theget-pip.py
file and run:
More details about this script can be found in pypa/get-pip’s README.
Critical Prerequisites ⚓
-
OpenCV⚓
Must require OpenCV(3.0+) python binaries installed for all core functions. You easily install it directly via pip:
OpenCV installation from source
You can also follow online tutorials for building & installing OpenCV on Windows, Linux, MacOS and Raspberry Pi machines manually from its source.
Make sure not to install both pip and source version together. Otherwise installation will fail to work!
Other OpenCV binaries
OpenCV mainainers also provide additional binaries via pip that contains both main modules and contrib/extra modules
opencv-contrib-python
, and for server (headless) environments likeopencv-python-headless
andopencv-contrib-python-headless
. You can also install any one of them in similar manner. More information can be found here.
API Specific Prerequisites⚓
-
FFmpeg⚓
Require only for the video compression and encoding compatibility within StreamGear API and WriteGear API's Compression Mode.
FFmpeg Installation
- For WriteGear API's Compression Mode: Follow this dedicated FFmpeg Installation doc for its installation.
- For StreamGear API: Follow this dedicated FFmpeg Installation doc for its installation.
-
Picamera⚓
Required only if you're using Raspberry Pi Camera Modules with its PiGear API. You can easily install it via pip:
Make sure to enable Raspberry Pi hardware-specific settings prior to using this library, otherwise it won't work.
-
Uvloop⚓
Required only if you're using the NetGear_Async API on UNIX machines for maximum performance. You can easily install it via pip:
uvloop is NOT yet supported on Windows Machines.
Installation⚓
Installation command with pip
has been changed in v0.2.4
The legacy pip install vidgear
command now installs critical bare-minimum dependencies only. Therefore in order to automatically install all the API specific dependencies as previous versions, use pip install vidgear[core]
command instead.
Similarly in your python project files like setup.py
or requirements.txt
or setup.cfg
, use vidgear dependency as vidgear[core]>=0.2.4
instead.
This change does not affects pip install vidgear[asyncio]
command.
Installation is as simple as:
Installing vidgear with only selective dependencies
Starting with version v0.2.2
, you can now run any VidGear API by installing only just specific dependencies required by the API in use(except for some Core dependencies).
This is useful when you want to manually review, select and install minimal API-specific dependencies on bare-minimum vidgear from scratch on your system:
-
Install bare-minimum vidgear as follows:
-
Then, you must install Critical dependencies(if not already):
-
Finally, manually install your API-specific dependencies as required by your API(in use):
APIs Dependencies CamGear yt_dlp
PiGear picamera
VideoGear Based on CamGear or PiGear backend in use ScreenGear mss
,pyscreenshot
,Pillow
WriteGear FFmpeg: See this doc ➶ StreamGear FFmpeg: See this doc ➶ NetGear pyzmq
,simplejpeg
WebGear starlette
,jinja2
,uvicorn
,simplejpeg
WebGear_RTC aiortc
,starlette
,jinja2
,uvicorn
NetGear_Async pyzmq
,msgpack
,msgpack_numpy
,uvloop
Stabilizer Class - APIs Dependencies CamGear pafy
,yt_dlp
,streamlink
PiGear picamera
VideoGear Based on CamGear or PiGear backend in use ScreenGear mss
,pyscreenshot
,Pillow
WriteGear FFmpeg: See this doc ➶ StreamGear FFmpeg: See this doc ➶ NetGear pyzmq
,simplejpeg
WebGear starlette
,jinja2
,uvicorn
,simplejpeg
WebGear_RTC aiortc
,starlette
,jinja2
,uvicorn
NetGear_Async pyzmq
,msgpack
,msgpack_numpy
,uvloop
Stabilizer Class -
Windows Installation
If you are using Windows, some of the commands given below, may not work out-of-the-box.
A quick solution may be to preface every Python command with python -m
like this:
# Install latest stable release with all Core dependencies
python -m pip install -U vidgear[core]
# Or Install latest stable release with all Core & Asyncio dependencies
python -m pip install -U vidgear[asyncio]
And, If you don't have the privileges to the directory you're installing package. Then use --user
flag, that makes pip install packages in your home directory instead:
# Install latest stable release with all Core dependencies
python -m pip install --upgrade --user vidgear[core]
# Or Install latest stable release with all Core & Asyncio dependencies
python -m pip install --upgrade --user vidgear[asyncio]
Or, If you're using py
as alias for installed python, then:
# Install latest stable release with all Core dependencies
pip install -U vidgear[core]
# Or Install latest stable release with all Core & Asyncio dependencies
pip install -U vidgear[asyncio]
And if you prefer to install VidGear directly from the repository:
# Install latest stable release with all Core dependencies
pip install git+git://github.com/abhiTronix/vidgear@master#egg=vidgear[core]
# Or Install latest stable release with all Core & Asyncio dependencies
pip install git+git://github.com/abhiTronix/vidgear@master#egg=vidgear[asyncio]
Or you can also download its wheel (.whl
) package from our repository's releases section, and thereby can be installed as follows:
# Install latest stable release with all Core dependencies
pip install vidgear-0.2.5-py3-none-any.whl[core]
# Or Install latest stable release with all Core & Asyncio dependencies
pip install vidgear-0.2.5-py3-none-any.whl[asyncio]
-
The
ensurepip
module is missing/disabled on Ubuntu. Usepip
method only. ↩