# Module 'platformdirs' has no attribute 'site\_cache\_dir'

**URL:** <https://discuss.dvc.org/t/module-platformdirs-has-no-attribute-site-cache-dir/1636>\
**Category:** Questions\
**Created:** [May 1, 2023, 1:55am UTC](https://discuss.dvc.org/t/module-platformdirs-has-no-attribute-site-cache-dir/1636 "2023-05-01T01:55:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_K](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@Tom\_K](https://discuss.dvc.org/u/Tom_K)\
**Post date:** [May 1, 2023, 1:55am UTC](https://discuss.dvc.org/t/module-platformdirs-has-no-attribute-site-cache-dir/1636/1 "2023-05-01T01:55:15Z")

</div>

Hello, I am trying to get my dvc.yaml file set up but am having trouble making the initial stage. For whatever reason I am getting this error. This error persists if I create a new project folder and virtual environment.

`$ dvc run` …

`ERROR: unexpected error - module 'platformdirs' has no attribute 'site_cache_dir'`

I installed dvc with pip in a virtual environment on a newly created Linux machine running Python 3.10. I’ve listed the packages and their versions below. If anyone knows a resolution to the error, or a workaround, let me know.

aiohttp==3.8.4  
aiohttp-retry==2.8.3  
aiosignal==1.3.1  
amqp==5.1.1  
antlr4-python3-runtime==4.9.3  
appdirs==1.4.4  
async-timeout==4.0.2  
asyncssh==2.13.1  
atpublic==3.1.1  
attrs==22.1.0  
billiard==3.6.4.0  
build==0.10.0  
CacheControl==0.12.11  
celery==5.2.7  
certifi==2022.9.24  
cffi==1.15.1  
charset-normalizer==2.1.1  
cleo==2.0.1  
click==8.1.3  
click-didyoumean==0.3.0  
click-plugins==1.1.1  
click-repl==0.2.0  
colorama==0.4.6  
configobj==5.0.8  
crashtest==0.4.1  
cryptography==37.0.4  
dictdiffer==0.9.0  
diskcache==5.6.1  
distlib==0.3.6  
distro==1.8.0  
dpath==2.1.5  
dulwich==0.21.3  
dvc==2.55.0  
dvc-data==0.47.2  
dvc-http==2.30.2  
dvc-objects==0.21.2  
dvc-render==0.3.1  
dvc-studio-client==0.8.0  
dvc-task==0.2.1  
filelock==3.8.0  
flatten-dict==0.4.2  
flufl.lock==7.1.1  
frozenlist==1.3.3  
fsspec==2023.4.0  
funcy==2.0  
gitdb==4.0.10  
GitPython==3.1.31  
grandalf==0.8  
html5lib==1.1  
hydra-core==1.3.2  
idna==3.4  
installer==0.7.0  
iterative-telemetry==0.0.8  
jaraco.classes==3.2.3  
jeepney==0.8.0  
joblib==1.2.0  
jsonschema==4.16.0  
keyring==23.9.3  
kombu==5.2.4  
lockfile==0.12.2  
markdown-it-py==2.2.0  
mdurl==0.1.2  
more-itertools==8.14.0  
msgpack==1.0.4  
multidict==6.0.4  
nanotime==0.5.2  
networkx==3.1  
numpy==1.24.3  
omegaconf==2.3.0  
orjson==3.8.11  
packaging==22.0  
pandas==2.0.1  
pathspec==0.11.1  
pexpect==4.8.0  
pipenv==2023.3.20  
pkginfo==1.9.6  
platformdirs==2.5.2  
poetry==1.4.2  
poetry-core==1.5.2  
poetry-plugin-export==1.3.0  
prompt-toolkit==3.0.38  
psutil==5.9.5  
ptyprocess==0.7.0  
pycparser==2.21  
pydot==1.4.2  
pygit2==1.12.0  
Pygments==2.15.1  
pygtrie==2.5.0  
pyparsing==3.0.9  
pyproject\_hooks==1.0.0  
pyrsistent==0.18.1  
python-dateutil==2.8.2  
pytz==2023.3  
PyYAML==6.0  
rapidfuzz==2.13.7  
requests==2.28.1  
requests-toolbelt==0.9.1  
rich==13.3.5  
ruamel.yaml==0.17.21  
ruamel.yaml.clib==0.2.7  
scikit-learn==1.2.2  
scipy==1.10.1  
scmrepo==1.0.2  
SecretStorage==3.3.3  
shellingham==1.5.0  
shortuuid==1.0.11  
shtab==1.6.1  
six==1.16.0  
smmap==5.0.0  
sqltrie==0.3.1  
tabulate==0.9.0  
threadpoolctl==3.1.0  
tomli==2.0.1  
tomlkit==0.11.5  
tqdm==4.65.0  
trove-classifiers==2022.12.22  
typing\_extensions==4.5.0  
tzdata==2023.3  
urllib3==1.26.12  
vine==5.0.0  
virtualenv==20.21.0  
virtualenv-clone==0.5.7  
voluptuous==0.13.1  
wcwidth==0.2.6  
webencodings==0.5.1  
yarl==1.9.2  
zc.lockfile==3.0.post1

---

<div class="post-metadata">

**Author:** ![skshetry](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@skshetry](https://discuss.dvc.org/u/skshetry)\
**Post date:** [May 1, 2023, 2:04am UTC](https://discuss.dvc.org/t/module-platformdirs-has-no-attribute-site-cache-dir/1636/2 "2023-05-01T02:04:30Z")

</div>

Hi. DVC requires `platformdirs>=3.1.1`. There may be something that’s making pip install older version.  
Please try updating `platformdirs` with:

```console
python -m pip install "platformdirs>=3.1.1"

```

---

<div class="post-metadata">

**Author:** ![jhennessy](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@jhennessy](https://discuss.dvc.org/u/jhennessy)\
**Post date:** [May 16, 2023, 6:43pm UTC](https://discuss.dvc.org/t/module-platformdirs-has-no-attribute-site-cache-dir/1636/3 "2023-05-16T18:43:55Z")

</div>

I have platformdirs version 3.2.0 and I am still getting this error with `dvc pull`.

```auto
$ dvc pull
ERROR: unexpected error - module 'platformdirs' has no attribute 'site_cache_dir'

Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!

$ pip list | grep platformdirs
platformdirs 3.2.0

```

When I switch to platformdirs verion 3.1.1. it solves the issue.

---

<div class="post-metadata">

**Author:** ![kupruser](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@kupruser](https://discuss.dvc.org/u/kupruser)\
**Post date:** [May 16, 2023, 8:28pm UTC](https://discuss.dvc.org/t/module-platformdirs-has-no-attribute-site-cache-dir/1636/4 "2023-05-16T20:28:00Z")

</div>

Could you show `dvc doctor`, please? My guess is that `pip list` is showing a different environment than the one dvc is installed in. Just want to make sure.

---

<div class="post-metadata">

**Author:** ![jhennessy](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@jhennessy](https://discuss.dvc.org/u/jhennessy)\
**Post date:** [May 16, 2023, 8:42pm UTC](https://discuss.dvc.org/t/module-platformdirs-has-no-attribute-site-cache-dir/1636/5 "2023-05-16T20:42:22Z")

</div>

## $ dvc doctor DVC version: 2.54.0 (pip)

Platform: Python 3.8.16 on Windows-10-10.0.19045-SP0  
Subprojects:  
dvc\_data = 0.47.1  
dvc\_objects = 0.21.1  
dvc\_render = 0.3.1  
dvc\_task = 0.2.0  
scmrepo = 1.0.1  
Supports:  
http (aiohttp = 3.8.4, aiohttp-retry = 2.8.3),  
https (aiohttp = 3.8.4, aiohttp-retry = 2.8.3)  
Cache types:  
Cache directory: NTFS on M:  
Caches: local  
Remotes: local  
Workspace directory: NTFS on M:  
Repo: dvc, git  
Repo.site\_cache\_dir: C:\ProgramData\iterative\dvc\Cache\repo\120a5116ac3914e12e2015892f40c3e5
