# How can I add python dependency to my python addon?

**URL:** <https://forums.ankiweb.net/t/how-can-i-add-python-dependency-to-my-python-addon/28654>\
**Category:** Add-ons\
**Created:** [March 22, 2023, 12:09pm UTC](https://forums.ankiweb.net/t/how-can-i-add-python-dependency-to-my-python-addon/28654 "2023-03-22T12:09:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [March 22, 2023, 12:52pm UTC](https://forums.ankiweb.net/t/how-can-i-add-python-dependency-to-my-python-addon/28654/2 "2023-03-22T12:52:46Z")

</div>

> [@Whiteha](#):
>
> maybe I just need to pack the package and its dependencies in the addon folder.

That’s it. My post here might be useful:

> [@Add support for dependencies in addons](https://forums.ankiweb.net/t/add-support-for-dependencies-in-addons/24302/3):
>
> Vendoring is usually as simple as doing the following for me: pip install -r requirements.txt -t src/vendor. Adding src/vendor to sys.path, or maybe using a modified version of the [snippet here](https://forums.ankiweb.net/t/best-practice-for-add-ons-using-third-party-packages/1585/3) where you don’t mess around with sys.modules/sys.path, and instead just use the object you get from importlib.util.module\_from\_spec to avoid conflicts. (I usually just append/insert to sys.path, and have not tested my suggestion yet) It becomes a real pain when [C extensions are involved](https://addon-docs.ankiweb.net/python-modules.html). For this case…

---

_[View the full topic](https://forums.ankiweb.net/t/how-can-i-add-python-dependency-to-my-python-addon/28654)._
