Skip to content

Latest commit

 

History

History
169 lines (122 loc) · 6.36 KB

installation.rst

File metadata and controls

169 lines (122 loc) · 6.36 KB

Installation

requires 3.6+ to work. See a list of installation-dependencies.

Installing from PyPI using pip

$ python -m pip install -U

# or to install the watchmedo utility: $ python -m pip install -U [watchmedo]

Installing from source tarballs

$ wget -c https://pypi.python.org/packages/source/w/watchdog/watchdog-|project_versionproject_nameproject_versionproject_nameproject_version| $ python -m pip install -e .

# or to install the watchmedo utility: $ python -m pip install -e ".[watchmedo]"

Installing from the code repository

$ git clone --recursive git://github.com/gorakhargosh/watchdog.git
$ cd watchdog
$ python -m pip install -e .

# or to install the watchmedo utility:
$ python -m pip install -e ".[watchmedo]"

Dependencies

depends on many libraries to do its job. The following is a list of dependencies you need based on the operating system you are using.

Operating system Dependency (row) Windows Linux 2.6 Mac OS X/ Darwin BSD
XCode

Yes

The following is a list of dependencies you need based on the operating system you are using the watchmedo utility.

Operating system Dependency (row) Windows Linux 2.6 Mac OS X/ Darwin BSD
PyYAML

Yes

Yes

Yes

Yes

Installing Dependencies

The watchmedo script depends on PyYAML which links with LibYAML. On Mac OS X, you can use homebrew to install LibYAML:

brew install libyaml

On Linux, use your favorite package manager to install LibYAML. Here's how you do it on Ubuntu:

sudo apt install libyaml-dev

On Windows, please install PyYAML using the binaries they provide.

Supported Platforms (and Caveats)

uses native APIs as much as possible falling back to polling the disk periodically to compare directory snapshots only when it cannot use an API natively-provided by the underlying operating system. The following operating systems are currently supported:

Warning

Differences between behaviors of these native API are noted below.

Linux 2.6+

Linux kernel version 2.6 and later come with an API called inotify that programs can use to monitor file system events.

Note

On most systems the maximum number of watches that can be created per user is limited to 8192. needs one per directory to monitor. To change this limit, edit /etc/sysctl.conf and add:

fs.inotify.max_user_watches=16384

Mac OS X

The Darwin kernel/OS X API maintains two ways to monitor directories for file system events:

can use whichever one is available, preferring FSEvents over kqueue(2). kqueue(2) uses open file descriptors for monitoring and the current implementation uses Mac OS X File System Monitoring Performance Guidelines to open these file descriptors only to monitor events, thus allowing OS X to unmount volumes that are being watched without locking them.

Note

More information about how uses kqueue(2) is noted in BSD Unix variants. Much of this information applies to Mac OS X as well.

_BSD Unix variants

BSD variants come with kqueue which programs can use to monitor changes to open file descriptors. Because of the way kqueue(2) works, needs to open these files and directories in read-only non-blocking mode and keep books about them.

will automatically open file descriptors for all new files/directories created and close those for which are deleted.

Note

The maximum number of open file descriptor per process limit on your operating system can hinder 's ability to monitor files.

You should ensure this limit is set to at least 1024 (or a value suitable to your usage). The following command appended to your ~/.profile configuration file does this for you:

ulimit -n 1024
Windows Vista and later

The Windows API provides the ReadDirectoryChangesW. currently contains implementation for a synchronous approach requiring additional API functionality only available in Windows Vista and later.

Note

Since renaming is not the same operation as movement on Windows, tries hard to convert renames to movement events. Also, because the ReadDirectoryChangesW API function returns rename/movement events for directories even before the underlying I/O is complete, may not be able to completely scan the moved directory in order to successfully queue movement events for files and directories within it.

Note

Since the Windows API does not provide information about whether an object is a file or a directory, delete events for directories may be reported as a file deleted event.

OS Independent Polling

also includes a fallback-implementation that polls watched directories for changes by periodically comparing snapshots of the directory tree.