Skip to content

Developer's Docs

John Damilola edited this page Feb 2, 2024 · 6 revisions

Table of Content

  1. Installing Writing Observer on Mac
    1. Using Mac (locally)
    2. Using Windows (locally)
    3. Using RedHat Server (remote)
    4. Potential Errors during Installation
  2. Streaming Writing Observer
  3. Setting up Google Auth

Installing Writing Observer

macOS

Using Mac

Step 1: Create a virtual environment

mkvirtualenv learning_observer

If you are unable to get mkvirtualenv to work, you can use any alternative option to create/activate a new virtual environment for the dependencies to be installed

Step 2: Run the following commands

pip install -r requirements.txt
cd learning_observer
python setup.py develop

Step 3: Create creds.yaml configuration file from creds.yaml.example and move it to ArgLab_writing_observer/learning_observer/ python learning_observer

In the creds.yaml, do the following

  • Comment out the auth.google_auth section if you are not using Google Auth
  • Update aio.session_secret to another random key
  • Update kvs config to the below
kvs:
    type: redis_ephemeral
    expiry: 6000

Step 4: Create course_lists and course_rosters folders inside static_data

Mkdir ArgLab_writing_observer/learning_observer/learning_observer/static_data/course_lists/
Mkdir ArgLab_writing_observer/learning_observer/learning_observer/static_data/course_rosters/

Use this script to create a course list or course roster ArgLab_writing_observer/learning_observer/learning_observer/static_data/make_google_classroom_test_courses.py

Or move courses.json.template to course_lists and rename it to courselist-pwd-{username}.json where {username} is your username for Learning Observer

Step 5: Create a password using the passwd.lo file

python util/lo_passwd.py --username johndamilola --password TrwDcFurInKVCkh8VR2csQ --filename passwd.lo

Step 6: Install all the other AWE components using the Github Readme https://github.com/ArgLab/AWE_Components

Step 7: Run the learning observer

python learning_observer

Windows

Using Windows

[TODO]

Red Hat

Using RedHat Server (remote)

Requirements: The existing system depends upon Python 3.9. Because these machines are within the NCSU firewall you can only access them on campus using the ncsu wireless network not ncsu-guest, or inside the vpn. See vpn.ncsu.edu All of the test platforms are RHEL 8 boxes which are managed by Puppet. Because they are managed by puppet your home directory does not exist when you log out. So all of your installation and coding work should be done in a shared directory: /usr/local/share/projects

Step 1: Create a directory in the shared directory

cd /usr/local/share/projects
mkdir your_directory_name
cd your_directory_name

NOTE: There is already a directory called WritingObserver-Lynch for Dr. Lynch’s development alone

Step 2: Create a directory for the Repositories and for VirtualENVs

mkdir Repositories && mkdir VirtualENVs

Step 3: Clone Arglab_Writing_Observer repo along with all of the other workbench repos into your Repositories directory

Step 4: Change ownership to yourself for editing

man chown

Also, you will need to use sudo for the directory creation commands and you have sudo access to your target machines.

Step 5: Install the software via scripts that are located in the Arglab_Writing_Observer/servermanagement directory and the AWE_Workbench/installation directory. In the former you have a script called SetupVENV.sh which we use to create the python virtual environment that WritingObserver lives in. The second AddWOtoVENV.sh will install the WO package into it along with the basic python requirements.

cd Arglab_Writing_Observer
bash servermanagement/SetupVENV.sh <your_env_name> ../../../VirtualENVs/
bash servermanagement/AddWOtoVENV.sh ./../../../VirtualENVs/<your_env_name>/

NOTE: When you run this there is a step where it will install the dash components which come from a shared repo. It may ask you to approve this. Say yes. In the latter there is a script called AddAWEtoVENV.sh which will perform the same installation function for the existing VENV. You should run this next.

Step 6: Create creds.yaml configuration file from creds.yaml.example and move it to ArgLab_writing_observer/learning_observer/ python learning_observer

In the creds.yaml, do the following

  • Comment out the auth.google_auth section if you are not using Google Auth
  • Update aio.session_secret to another random key
  • Update kvs config to the below
kvs:
    type: redis_ephemeral
    expiry: 6000

Step 7: Create course_lists and course_rosters folders inside static_data

Mkdir ArgLab_writing_observer/learning_observer/learning_observer/static_data/course_lists/
Mkdir ArgLab_writing_observer/learning_observer/learning_observer/static_data/course_rosters/

Use this script to create a course list or course roster ArgLab_writing_observer/learning_observer/learning_observer/static_data/make_google_classroom_test_courses.py

Or move courses.json.template to course_lists and rename it to courselist-pwd-{username}.json where {username} is your username for Learning Observer

Step 8: Create a password using the passwd.lo file

python util/lo_passwd.py --username johndamilola --password TrwDcFurInKVCkh8VR2csQ --filename passwd.lo

Step 9: After installing the code, run the server using the script in ArgLab_Writing_Observer/servermanagement/RunLearningObserver.sh

NOTE: that because you are running this on a different system it will not be receiving student writing data. To do that you will need to install a tweaked form of the plugin on your machine that points to your server.

Also, the script: ArgLab_Writing_Observer/servermanagement/RunLearningObserver.sh runs the server process in a fork via the nohup command. on line 34. To get interactive execution you can replace that line with the following:

python learning_observer

This will run and display the progress locally

Step 10: Install all the other AWE components using the Github Readme

🐛 Potential errors:

LookupError: 
**********************************************************************
  Resource wordnet not found.
  Please use the NLTK Downloader to obtain the resource:

  >>> import nltk
  >>> nltk.download('wordnet')
  
  For more information see: https://www.nltk.org/data.html

  Attempted to load corpora/wordnet.zip/wordnet/
**********************************************************************

Fix: Run python and run the python code above

✘ Please load the Coreferee models for language 'en' with the command
'python -m coreferee install en'.

Fix: Run the command above

Traceback (most recent call last):
  File "/Users/johndamilola/Documents/Projects/NCSU/ArgLab/docs_testing/ArgLab_writing_observer/learning_observer/util/lo_passwd.py", line 178, in <module>
    user_data = prompt_for_user_data()
  File "/Users/johndamilola/Documents/Projects/NCSU/ArgLab/docs_testing/ArgLab_writing_observer/learning_observer/util/lo_passwd.py", line 154, in prompt_for_user_data
    ).decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?

Fix: uninstall and reinstall py-bcrypt

ModuleNotFound : No module named "gitserve" Fix: go into the gitserve directory and pip install .

WritingObserver_Pradeep/VirtualEnv/LOVenv/include -I/usr/include/python3.9 -c lib/recordclass/_dataobject.c -o build/temp.linux-x86_64-cpython-39/lib/recordclass/_dataobject.o
      lib/recordclass/_dataobject.c:25:10: fatal error: Python.h: No such file or directory
       #include "Python.h"
                ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for recordclass
  Running setup.py clean for recordclass

Failed to build recordclass
ERROR: Could not build wheels for recordclass, which is required to install pyproject.toml-based projects

Fix: sudo yum install python39-devel # for python3.x installs

Bug: Any 'ModuleNotFoundError'

Fix: pip install module_name

Error: nvm: command not found or npm: command not found

Fix: Run curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash

Streaming Writing Observer

Step 1: Start redis server:

redis-server

Step 2: Run Learning Observer

python learning_observer

Step 3: Stream writing

python3 stream_writing.py --streams=10 --gpt3=argument

Setting up Google Auth

[TODO]

Clone this wiki locally