Troubleshooting
Troubleshooting pip
Depending on your install of Python you may not have pip installed by default. Once downloaded make sure that the "Scripts" folder within your python directory is added to your environment variable PATH:
Open the Environment Variables on your system (
Control Panel > System > Advanced System Settings > Environment Variables
) and add the path to the Scripts folder (within your Python install directory) to the System Variable calledPATH
.
System.IO.FileLoadException: Mixed mode assembly is built...
This error only affects standalone Python scripts that target a HASP install of MASTA.
This is caused by HASP licensing libraries targetting an older version of the .NET framework. Python needs to be configured to support older versions of .NET.
Solution
Put a python.exe.config file in the python install directory (the directory that contains python.exe)
Troubleshooting Matplotlib
Matplotlib is the de-facto Python package for data presentation. However, using Matplotlib in conjunction with MASTA is known to occasionally spawn errors. This section describes the common errors and how to fix them.
ImportError: DLL load failed: %1 is not a valid Win32 application
This error can occur if Matplotlib was installed using the Miniconda package manager, conda
. For use with MASTA, it is required to use pip
to install Matplotlib. To check whether you installed Matplotlib using conda
, run the following command in command prompt:
conda list
This will list all installed packages in your Miniconda environment. Find matplotlib
and look in the Build column; if it does not say <pip>
then it needs to be reinstalled. Run the following command to uninstall Matplotlib:
conda remove matplotlib
Once uninstalled, reinstall using pip with the following command:
python -m pip install matplotlib
_tkinter.TclError: Can't find a usable init.tcl
Matplotlib uses Tkinter for windowing and rendering graphs. Tkinter is installed as part of Matplotlib's installation. However, when running from MASTA, Matplotlib can fail to find Tkinter. The easiest solution to this is to navigate to your Python/Miniconda installation directory and copy the contents of the tcl
folder into the Lib
folder.
Running a script from inside MASTA
ImportError: No module named mastapy
This error either means that your Python interpreter cannot find the mastapy
module. Run the command pip list
in command prompt and check that the mastapy
module is there. If not, then follow the refer back to installing mastapy.
If it is there, and you are using Miniconda, make sure you installed it in the correct Miniconda environment and that MASTA is pointing towards this environment.
Can't find a usable init.tcl
This is a strange error that can occur when using Miniconda. The easiest fix is to simply go to your Python installation directory (i.e. ~\AppData\Local\Continuum\miniconda3
) and copy the contents of the tcl
folder into the Lib
folder. The error should disappear.
On rare occasions, there may be no errors but your script still does not appear in MASTA. Make sure you have the correct component selected and that any required load cases have been run. Additionally, make sure your script file name does not clash with any Python module names. For instance, calling your python script collections.py
will clash with the collections
module and will not appear in MASTA.
General
Sometimes things just go wrong when it comes to computers, here's some other things you could try if all else fails (in no particular order):
Try installing an Example script from the SMT Store, if it works, check what this script does differently to yours
Update to the latest version of mastapy
python -m pip install mastapy --upgrade
Close/Open Masta
Re-install Python