How to Install filelock in Python
A platform independent file lock.
pip install filelock
What is filelock?
A platform independent file lock.
For more information checkout the official documentation.
Quick Start
Minimal example to get started with filelock:
import filelock
print(filelock.__version__)
Installation
pip (standard)
pip install filelock
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install filelock
pip3
pip3 install filelock
conda
conda install -c conda-forge filelock
Poetry
poetry add filelock
Verify the Installation
After installing, confirm the package is available:
python -c "import filelock; print(filelock.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing filelock with pip.
ModuleNotFoundError: No module named 'filelock'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install filelock. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'filelock' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install filelock to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'filelock'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show filelock and upgrade with pip install --upgrade filelock.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install filelock. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user filelock
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org filelock
Recent Releases
| Version | Released |
|---|---|
3.25.2 latest |
2026-03-11 |
3.25.1 |
2026-03-09 |
3.25.0 |
2026-03-01 |
3.24.3 |
2026-02-19 |
3.24.2 |
2026-02-16 |
Manage filelock
Upgrade to latest version
pip install --upgrade filelock
Install a specific version
pip install filelock==3.25.2
Uninstall
pip uninstall filelock
Check what is installed
pip show filelock