Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Installing Python ACT-R (Carleton Version)

Use this guide to help with installing python ACT-R for the course. Pay attention to errors, warnings, etc. that pop-up in your terminal during the process! One thing not installing correctly can lead to python act-r not working.

Setting up your environment

For this python act-r, you will need Python 3
As always, I recommend that you use a virtual environment - for example, https://docs.python.org/3.11/tutorial/venv.html
As a reminder, to setup a virtual environment (venv), follow these steps below, otherwise you can skip to Getting Python ACT-R

1. On any platform (Mac/Linux/Windows)

First navigate to the directory where you want your venvs to be located. I typically have a PyEnvs directory in a home directory/drive that contains all of my python virtual environments.

Create a virtual environment called actrEnv

username$ python3 -m venv actrEnv

2a. On a Mac/Linux machine, in the terminal

Activate environment called actrEnv

username$ source actrEnv/bin/activate

2b. On a Windows machine, in cmd

Activate environment called actEnv

actrEnv\Scripts\activate.bat

(Do not do this until you want to not use your)

To deactivate any virtual environment you are in

username$ deactivate

You should see the name of your env next to your command line in the terminal/shell now, this is how you know that your virtual environment is activated

  • For example it may look like this - (actrEnv) computer:project user1234$

This will hopefully help keep you from having to diagnose odd issues that come from quickly installing and uninstalling different python libraries over the years.

 

Getting Python ACT-R

For this we will use a custom version of Python ACT-R that acts more nicely with Python3 than the versions listed on the office python act-r site/repo

  • Make sure you have your virtual environment activated
  • Go to - https://git.psu.edu/thicc-lab/python_actr to download the code (you can use git or just download the code directly)
  • Once you have the code downloaded, navigate into the top directory of downloaded files via terminal and activate whatever virtual environment that you are using

Because of a certain file in python_actr (that diverges from the typical python ACT-R dist), we’ll need to install numpy pip install numpy

Great! now we’ll also want setuptools pip install setuptools

Now let’s install Python ACT-R by running the following command python setup.py install

Ensure everything is working by navigating to tutorials/Grid World and running python 3_many_agents.py

If all works out, you should see a grid environment with agents moving around (similar to the figure below)