AppDirs
raw JSON → 1.4.4 verified Tue May 12 auth: no python install: verified quickstart: stale deprecated
AppDirs is a small Python module (version 1.4.4) designed to determine appropriate platform-specific directories for storing user data, configuration, cache, and log files across Linux, macOS, and Windows. This project has been officially deprecated, and `platformdirs` is recommended as a more actively maintained alternative.
pip install appdirs Common errors
error ImportError: No module named 'appdirs' ↓
cause The 'appdirs' module is not installed in the Python environment.
fix
Install the 'appdirs' module using pip: 'pip install appdirs'.
error ImportError: cannot import name 'appdirs' from 'pkg_resources.extern' ↓
cause The 'appdirs' module is not available within 'pkg_resources.extern', possibly due to an outdated or incompatible version of setuptools.
fix
Update setuptools to the latest version: 'pip install --upgrade setuptools'.
error ModuleNotFoundError: No module named 'appdirs' ↓
cause The 'appdirs' module is not installed in the Python environment.
fix
Install the 'appdirs' module using pip: 'pip install appdirs'.
error TypeError: unexpected keyword argument 'appversion' ↓
cause When calling `appdirs` functions like `user_data_dir`, the argument for specifying the application version is `version`, not `appversion`.
fix
Change the keyword argument from
appversion to version. For example, appdirs.user_data_dir(appname, appauthor, version=appversion). error IOError: [Errno 2] No such file or directory: '.../appdirs-1.4.x.dist-info/METADATA' ↓
cause This error often occurs during an upgrade or downgrade of `appdirs` via `pip`, suggesting a corrupted installation or a conflict during the uninstall/reinstall process.
fix
Try to force reinstall
appdirs: pip install appdirs --ignore-installed. If the problem persists, uninstall it first pip uninstall appdirs and then reinstall pip install appdirs. Warnings
deprecated This project has been officially deprecated. It is recommended to use `platformdirs` (https://pypi.org/project/platformdirs/) which is an actively maintained fork with similar functionality. ↓
fix Migrate your application to use the `platformdirs` library. The API is largely compatible, making migration straightforward.
gotcha AppDirs is 'slightly opinionated' on directory names. The exact paths generated can sometimes differ from strict system conventions or other tools' interpretations, potentially leading to unexpected locations. For instance, specific suffixes might be added to directory names. ↓
fix Always verify the generated paths on your target operating systems. If `appdirs`'s default naming is problematic, consider examining the `platformdirs` documentation for more flexible options or implementing custom logic.
gotcha While version 1.4.4 is generally compatible with Python 3, earlier 1.x releases (e.g., 1.4.1) had specific issues with Python 3, particularly concerning Windows registry access (`winreg`) and string handling, which were addressed in subsequent minor releases. If working with older Python 3 environments or `appdirs` versions, verify generated paths carefully. ↓
fix Ensure you are using at least `appdirs==1.4.4` for Python 3 environments. For the best compatibility and ongoing support, migrate to `platformdirs`.
breaking The functions `user_data_dir`, `user_config_dir`, `user_cache_dir`, `user_state_dir`, `user_log_dir`, and `site_data_dir` in `appdirs` expect the version argument to be named `version`, not `appversion`. Passing `appversion` will result in a `TypeError: unexpected keyword argument`. ↓
fix Correct the keyword argument from `appversion` to `version` when calling `appdirs` functions. For example, change `user_data_dir(appname, appauthor, appversion=appversion)` to `user_data_dir(appname, appauthor, version=appversion)`.
breaking When calling `user_data_dir` (and similar functions like `user_config_dir`, `user_cache_dir`, etc.), the keyword argument for specifying the application version is `version`, not `appversion`. Using `appversion` will result in a `TypeError`. ↓
fix Correct the keyword argument from `appversion` to `version` in your function calls. For example, use `user_data_dir(appname, appauthor, version=my_app_version)` instead of `user_data_dir(appname, appauthor, appversion=my_app_version)`.
Install compatibility verified last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) wheel - 0.00s 17.8M
3.10 alpine (musl) - - 0.00s 17.8M
3.10 slim (glibc) wheel 1.5s 0.00s 18M
3.10 slim (glibc) - - 0.00s 18M
3.11 alpine (musl) wheel - 0.00s 19.7M
3.11 alpine (musl) - - 0.00s 19.7M
3.11 slim (glibc) wheel 1.7s 0.00s 20M
3.11 slim (glibc) - - 0.00s 20M
3.12 alpine (musl) wheel - 0.00s 11.6M
3.12 alpine (musl) - - 0.00s 11.6M
3.12 slim (glibc) wheel 1.5s 0.00s 12M
3.12 slim (glibc) - - 0.00s 12M
3.13 alpine (musl) wheel - 0.00s 11.3M
3.13 alpine (musl) - - 0.00s 11.2M
3.13 slim (glibc) wheel 1.4s 0.00s 12M
3.13 slim (glibc) - - 0.00s 12M
3.9 alpine (musl) wheel - 0.00s 17.3M
3.9 alpine (musl) - - 0.00s 17.3M
3.9 slim (glibc) wheel 1.8s 0.00s 18M
3.9 slim (glibc) - - 0.00s 18M
Imports
- user_data_dir
from appdirs import user_data_dir
Quickstart stale last tested: 2026-04-24
from appdirs import user_data_dir, user_cache_dir, user_log_dir
import os
appname = "MyApplication"
appauthor = "MyCompany"
appversion = "1.0.0"
# Get platform-specific directories
data_dir = user_data_dir(appname, appauthor, appversion=appversion)
cache_dir = user_cache_dir(appname, appauthor)
log_dir = user_log_dir(appname, appauthor)
print(f"Data directory: {data_dir}")
print(f"Cache directory: {cache_dir}")
print(f"Log directory: {log_dir}")
# Example: Ensure the data directory exists
os.makedirs(data_dir, exist_ok=True)
print(f"Ensured data directory exists: {os.path.exists(data_dir)}")