# Upgrading very old version of Ansible on python 2.7 HELP

**URL:** <https://forum.ansible.com/t/upgrading-very-old-version-of-ansible-on-python-2-7-help/2957>\
**Category:** Get Help\
**Tags:** upgrade, python, ansible-core\
**Created:** [December 18, 2023, 10:16am UTC](https://forum.ansible.com/t/upgrading-very-old-version-of-ansible-on-python-2-7-help/2957 "2023-12-18T10:16:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddpp123](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@ddpp123](https://forum.ansible.com/u/ddpp123)\
**Post date:** [December 18, 2023, 10:16am UTC](https://forum.ansible.com/t/upgrading-very-old-version-of-ansible-on-python-2-7-help/2957/1 "2023-12-18T10:16:32Z")

</div>

This is my current version of python and ansible on production:

- ansible 2.9.3
- python version = 2.7.5

My question is if I can upgrade python to 3.12 and then ansible to 2.16 without fucking myself over, since this is a big jump in versions?

Or should i choose another path like upgrading them incrementally?

Regards,  
Dom

---

<div class="post-metadata">

**Author:** ![ptn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ptn/32/481_2.png) [@ptn](https://forum.ansible.com/u/ptn)\
**Post date:** [December 18, 2023, 10:59am UTC](https://forum.ansible.com/t/upgrading-very-old-version-of-ansible-on-python-2-7-help/2957/2 "2023-12-18T10:59:19Z")

</div>

Hi,

I’m not knowledgeable enough about Python ecosystem to give you an appropriate answer, but I’d suggest to try the upgrade process using venvs (or virtualenvs for Python 2.7). Using python-based image containers would be another viable option.

Start with a venv for your current Python version, install Ansible into it (again, current version), then try upgrading Python in your venv, though I’m not sure you can upgrade a virtualenv (python 2.x) into a venv (python 3.x), so you might have to do it incrementally and rebuild as needed. Using containers might be easier for this purpose.

Please tell if you need assistance on any of these options !

---

<div class="post-metadata">

**Author:** ![jbericat](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jbericat/32/627_2.png) [@jbericat](https://forum.ansible.com/u/jbericat)\
**Post date:** [December 19, 2023, 5:57am UTC](https://forum.ansible.com/t/upgrading-very-old-version-of-ansible-on-python-2-7-help/2957/3 "2023-12-19T05:57:27Z")

</div>

Hello @ddpp123 welcome to the community!

What @ptn told you is correct, but if you need more details about how to use different python versions on your system without messing things-up, this other topic may be of help to you:

> [@Change python to use ansible](http://forum.ansible.com/t/change-python-to-use-ansible/2899/1):
>
> Good afternoon, I got to python versions installed in my server and when I upgrade ansible the version I use it was never upgraded. So I discovered there are two version of python installed. I wonder if its possible to change the version of python is using ansible right now ansible --version ansible [core 2.14.2] config file = /etc/ansible/ansible.cfg configured module search path = [‘/root/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’] ansible python module location = /…

If you need further assistance just let us know ☺

Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [January 18, 2024, 5:58am UTC](https://forum.ansible.com/t/upgrading-very-old-version-of-ansible-on-python-2-7-help/2957/4 "2024-01-18T05:58:25Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
