# ImportError: cannot import name context

**URL:** <https://forum.ansible.com/t/importerror-cannot-import-name-context/30384>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [May 21, 2019, 3:06pm UTC](https://forum.ansible.com/t/importerror-cannot-import-name-context/30384 "2019-05-21T15:06:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nabil\_Boutayeb](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@Nabil\_Boutayeb](https://forum.ansible.com/u/Nabil_Boutayeb)\
**Post date:** [May 21, 2019, 3:06pm UTC](https://forum.ansible.com/t/importerror-cannot-import-name-context/30384/1 "2019-05-21T15:06:12Z")

</div>

##### hello everyone:weeks ago ansible were working fine,

but today,

trying to execute ansible i got this message:

Traceback (most recent call last):  
File “/usr/bin/ansible”, line 137, in  
from ansible import context  
ImportError: cannot import name context

**i’m using:**

ansible 2.7.8  
python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]

Ubuntu 18.04.2 LTS

I remember doing an update that ask me to accept to change the ansible.cfg and that I refused.

plz help.

cordially

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [May 21, 2019, 3:11pm UTC](https://forum.ansible.com/t/importerror-cannot-import-name-context/30384/2 "2019-05-21T15:11:26Z")

</div>

ansible.context is new in Ansible 2.8

You claim you are using ansible 2.7.8

As such, it sounds like you have a mixed/broken installation of Ansible.

---

<div class="post-metadata">

**Author:** ![Nabil\_Boutayeb](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@Nabil\_Boutayeb](https://forum.ansible.com/u/Nabil_Boutayeb)\
**Post date:** [May 21, 2019, 3:30pm UTC](https://forum.ansible.com/t/importerror-cannot-import-name-context/30384/3 "2019-05-21T15:30:56Z")

</div>

many thanks for your answer,  
i have to do some staff with it and it’s not working,  
i uninstalled ansible and install it again, but i still have the same problem  
another thing is when i uninstall it, it’s removed but i still have the command ??!  
cordially

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [May 21, 2019, 3:32pm UTC](https://forum.ansible.com/t/importerror-cannot-import-name-context/30384/4 "2019-05-21T15:32:39Z")

</div>

It is possible that you have installed Ansible through 2 different means, such as the OS package manager, and pip.

After uninstalling, make sure that you don’t still have the ansible command. If you do, find it and delete it. This may require more work than simply removing whatever you did.

---

<div class="post-metadata">

**Author:** ![Nabil\_Boutayeb](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@Nabil\_Boutayeb](https://forum.ansible.com/u/Nabil_Boutayeb)\
**Post date:** [May 22, 2019, 8:46am UTC](https://forum.ansible.com/t/importerror-cannot-import-name-context/30384/5 "2019-05-22T08:46:58Z")

</div>

many thanks
