# TRANSFORMER\_CACHE issue inside jupyter notebook

**URL:** <https://discuss.huggingface.co/t/transformer-cache-issue-inside-jupyter-notebook/20579>\
**Category:** 🤗Transformers\
**Created:** [July 19, 2022, 3:53pm UTC](https://discuss.huggingface.co/t/transformer-cache-issue-inside-jupyter-notebook/20579 "2022-07-19T15:53:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hgfacetl](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@hgfacetl](https://discuss.huggingface.co/u/hgfacetl)\
**Post date:** [July 19, 2022, 3:53pm UTC](https://discuss.huggingface.co/t/transformer-cache-issue-inside-jupyter-notebook/20579/1 "2022-07-19T15:53:32Z")

</div>

Hi, I’m excited to start trying out the huggingface Transformers. I followed the installation instructions with a virtual environment installation in a directory A. The system wise default cache directory is in my home directory, B. There is a strict disk space limit on B. So I changed the TRANSFORMERS\_CACHE to somewhere under A where there is no disk limit.

This works fine under command line. I then installed a ipykernel with my virtual env into jupyter notebook. Here things get werid. I checked and made sure the TRANSFORMERS\_CACHE is indeed still pointing to A. However, every time I start to use some pretrained model, it will still look for cache in B, not A.

Anyone knows how to solve this basic issue?

---

<div class="post-metadata">

**Author:** ![dbuos](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/dbuos/32/17903_2.png) [@dbuos](https://discuss.huggingface.co/u/dbuos)\
**Post date:** [July 25, 2023, 12:31am UTC](https://discuss.huggingface.co/t/transformer-cache-issue-inside-jupyter-notebook/20579/2 "2023-07-25T00:31:43Z")

</div>

Same issue here, I manage to solve it making sure that I load the env variables before any import to transformers. For example using  
`from dotenv import load_dotenv load_dotenv()`

and a .env file to configure HUGGINGFACE\_HUB\_CACHE var, that’s because jupyter maybe not load the same env variables that are declared in a …rc file.
