How to upgrade the python version with PFC

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!

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 is a short desctiption of using 3rd party Python modules in PFC 6.


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

import sys
import pathlib

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


import my_module

Alternatively, and provided that the module you want to install is available on the official pypi repository, I would recommend using the embarked package manager pip 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.