# How to upgrade the python version with PFC

**URL:** <https://forum.itascainternational.com/t/how-to-upgrade-the-python-version-with-pfc/604>\
**Category:** PFC\
**Tags:** python, suggestions\
**Created:** [June 3, 2022, 5:30pm UTC](https://forum.itascainternational.com/t/how-to-upgrade-the-python-version-with-pfc/604 "2022-06-03T17:30:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed2021](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@Ahmed2021](https://forum.itascainternational.com/u/Ahmed2021)\
**Post date:** [June 3, 2022, 5:30pm UTC](https://forum.itascainternational.com/t/how-to-upgrade-the-python-version-with-pfc/604/1 "2022-06-03T17:30:44Z")

</div>

Hi everyone,

I am asking about how to upgrade the version of python used with PFC. I am using PFC3D v6.0 and most of my simulations done on python. I am confused how to adjust certain version of python to work on PFC. Any help will be highly appreciated. Thank you!

---

<div class="post-metadata">

**Author:** ![dblanksma](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@dblanksma](https://forum.itascainternational.com/u/dblanksma)\
**Post date:** [June 6, 2022, 1:51pm UTC](https://forum.itascainternational.com/t/how-to-upgrade-the-python-version-with-pfc/604/2 "2022-06-06T13:51:02Z")

</div>

Hello,  
PFC 6.0 comes with Python 3.6 pre-installed. To my knowledge you cannot upgrade this Python distribution. If you have other extension modules (other than the 6 provided: `numpy`, `scipy`, `networkx`, `fipy`, `numexpr`, and `pyside`) you can set the `sys.path` variable to include the extension modules in that Python 3.6 installation.

[Here](http://docs.itascacg.com/pfc600/common/docproject/source/manual/scripting/python/doc/faq.html?node4985) is a short desctiption of using 3rd party Python modules in PFC 6.

---

<div class="post-metadata">

**Author:** ![Theophile](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.itascainternational.com/theophile/32/299_2.png) [@Theophile](https://forum.itascainternational.com/u/Theophile)\
**Post date:** [June 7, 2022, 8:55am UTC](https://forum.itascainternational.com/t/how-to-upgrade-the-python-version-with-pfc/604/3 "2022-06-07T08:55:24Z")

</div>

Hi.

As @dblanksma mentioned, you can indeed add the full path to any Python package in the sys.path.

```python
import sys
import pathlib

dir_to_add = pathlib.Path('path/to/the/head/folder/of/my_module')

sys.path.append(str(dir_to_add))

import my_module

```

Alternatively, and provided that the module you want to install is available on the official [pypi](https://pypi.org/) repository, I would recommend using the embarked package manager [pip](https://pip.pypa.io/en/stable/getting-started/) since **pip ensures that the module version matches Python’s**.

To do so, you can open a Windows shell (“Windows key + R” shortcut, then type in `cmd`), and install the desired module through the command `pip install my_module`.

You can also update already installed modules (such as the ones mentioned by @dblanksma): the conventional way is to add the `--upgrade` modificator: `pip install my_module --upgrade`.  
I experienced some troubles when doing so in 3DEC. Instead, I had to first uninstall **twice** then **reinstall the modules** : `pip uninstall my_module` twice then `pip install my_module`.

Be advised that the path to pip folder (_C:/Programs/Itasca/PFC/exe64/python36/Scripts_) must be present in the Windows environment variables. You can also go to this directory first in the Windows shell (typing in `cd C:/Programs/Itasca/PFC/exe64/python36/Scripts`) prior to calling pip.
