Adding NumPy and other extra Python modules to Trelis

To use NumPy in Trelis requires an installation step to make the module available in Trelis. From the Trelis Script tab do:

import pip
pip.main([‘install’, ‘numpy’, ‘–user’])

This is is the same for adding other Python modules to Trelis.

If the Script tab is not available, you can display the Script tab from Tools–Option–Layout and find Show Script Tab under Command Line Workspace.

I wanted to give an update to these instructions, as it appears there may have been some restructuring that’s occurred within the pip module. Below are instructions for Windows machines, easily translatable to Linux or Mac operating systems.

Guide

  1. Open a command prompt (or the new Windows Terminal) and navigate to the Trelis bin directory. This is probably:

    • cd C:\Program Files\Trelis 17.1\bin
  2. Further navigate to either the python2 or python3 directories.

  3. Execute .\python -m pip install <module> --user from the command line, for example to install numpy execute:

    • .\python.exe -m pip install numpy --user

Here are those commands all together in a terminal:

Previously I simply copied numpy/scipy directories from the locally installed Python (with the the same version) to the

C:\Program Files\Trelis XY.Z\bin\Lib\site-packages

One month ago i found discussed method independently, but I opened console as admin and did not use option --user in the pip command line, so packages were installed locally in the lib/site-packages directory:

C:\Program Files\Trelis 17.1\bin\python3\Lib\site-packages

Andrey

I am trying to install scipy.
When I pip with the following command
/opt/Coreform-Cubit-2021.4/bin/python3/python3.8 -m pip install scipy --user

It seems to be successfully installed, however, when I import scipy.
It says “scipy” is broken.

There’s been improvements to Python in later versions of Coreform Cubit, have you tried it in the latest release?

We will use the late verions of Coreform Cubit.