1.2. Install on macOS 10¶
1.2.1. Install Python 3.9¶
The new M1 chip MacBooks provide super fast and efficient ARM based processors. Older MacBooks utilize Intel x86 processors. The newer processor presents a problem for Python users of scientific applications. This is beacuse python programs typically import many different modules and not all modules have been ported to include arm based versions. The python3 kernels provided with the current operating systems, Monterey, are ARM based. As a consequence, to use the SimCenter applications, you will need to download and install an x86 version of python. These will run on the M1 machines, thanks to Rosetta.
You may also be using other distributions of Python, e.g. anaconda or homebrew. To see if your python kernel is compatable with SimCenter tools, issue the following in a terminal window.
python3 import platform platform.uname() exit()
As shown in screenshot below, you should see machine=’x86_64’ in the output of platform.uname(), if you see machine=’arm64’ [app] will not run on your machine when you press the Run button.
You can use the spotlight app (magnifying glass at the top right corner of the desktop) to start a Terminal window. Start the spotlight app and type in terminal. The Terminal application should appear as the top hit.
1. To obtain an x86 version of Python, we recommend installing Python 3.9, we tested the 3.9.13 version, from Python.org. It is important to select the macOS 64-bit Intel-only installer version of the installer. The intel-only is key to obtaining the x64 version.
We use the python.org installation over others, due to it’s simplicity of installation.
Python 3.10 from python.org, does not provide an x86 version.
Homebrew can also be used to install a Python x86 version, the instructions are convoluted but can be found using Google.. If installed correctly python3 will be in /usr/local/Cellar directory and not in the /usr/local/opt directory. Remember the platform.uname() output above will show you if you have installed a correct version.
2. The Python.org installer leaves two script files in the Python directory at the end of the installation and these appear in a pop up window when installation is complete. You need to execute both script files to get Python set up correctly so that it can be invoked from the terminal application. To execute the files, double click on them with your mouse. The two files, shown in the image below, are:
Update Shell Profile.command.sh and
3. Once Python is installed, you need to extend it by installing a few additional packages. To facilitate this phase of the installation, we created a nheri_simcenter python package that automatically installs all other dependencies. Start a Terminal window and type the following command:
pip3 install nheri_simcenter --upgrade
Make sure you see a message that confirms the successful installation of the nheri-simcenter package before proceeding to the next step.
If you forget to invoke the
UpdateShellProfile.command.sh script at the end of the install, you can always edit the correct shell file later to update the
PATH variable to point to the Python application.
On Linux systems, the shell is the program that takes commands from the keyboard that you enter in the terminal window and passes them to the operating system to perform by invoking applications and passing data between applications. In the good old days, it was the only interface available to the user, i.e., there was no such thing as Finder! There are a number of shell programs that can be installed and made available to you. The most popular is the bash shell, the up and coming one is the Z shell. Power MacOS users will write shell scripts to do many many useful things. By default the applications that the shell program will invoke are limited to applications in a few specific directories that are defined in the users
PATH. Users can modify this path by editing files that the shell program will read from everytime the program is started.
When the frontend application is running the computations it is actually running a backend application using the shell program. As a consequence the shell program must be made aware of the locations of some of the external applications that you have installed as OpenSees and Dakota do not provide installers that automatically do this when they are installed. Other applications, like Tcl provide scripts that you invoke to do it. In short you have to edit the file appropriate to the shell you are using.
To find which shell program you are using when you issue commands inside the terminal window, type the following:
env | grep SHELL
If the result is
/bin/bash you will need to edit the
.bashrc file or the
bash_profile file. If the result is
/bin/zsh you will need to edit the
.zprofile. Typically, the
.bash_profile or the
.zprofile file is the one to edit as by design these will invoke the
.zshrc file. If in doubt, look for these files in your home directory and see which of these other installers have modified.
1.2.2. Install Java¶
Java is needed to use OpenSHA to characterize the regional seismic hazard (see Earthquake Scenario Simulation). If you do not plan to use that feature, you can skip this step of the installation.
If you have not yet installed Java, please download the latest installer from java.com , run it, and follow the on-screen instructions to install Java.
The Java website should automatically detect your operating system and offer the corresponding installer for you to download. Make sure you see “Mac OS X” at the top of the page before downloading the installer.
1.2.3. Download the Application¶
Click on the file with a name ending with Mac_Download.dmg to download the R2D app. In the pop-up window, click on the Download button in the bottom right corner. After the download has completed, open the dmg file and copy the R2D app application to a location in your filesystem.
We suggest copying the application to your Desktop. After copying the application, you can move the dmg file to the trash or eject it.
1.2.4. Test the Installation¶
Once the installation procedure has been completed, it is a good practice to run some basic checks. Navigate to the location where you placed the application and open it by running the R2D.exe executable. You should see the user interface shown in Fig. 126.96.36.199. The installation can be tested by running the example problem r2dt-0006 which is provided with the installation.
SimCenter apps are code-signed and notarized, but because they are not downloaded from the operating system’s app store, they may not be recognized as such. As a consequence, depending on your security settings, when you start a SimCenter app for the first time, your operating system may bring up a dialog box indicating it is unsafe. If this dialog should appear, hit the cancel button. Restart the app by right clicking on it and selecting open.
When the R2D app is running, open the app/preferences or File/Preferences and make sure that python3 appears under External Applications:Python, as shown in the figure below If you used older versions of SimCenter tools this was not the default. The exact location of python3 that you installed can be found by opening the terminal applicationagain and typich which python3. Enter the new path to the executable in the Python: line edit and then press the Save button.
Set Python Preferences.