Getting Started: Difference between revisions

From Sidiprojects Wiki
Jump to navigation Jump to search
 
(18 intermediate revisions by the same user not shown)
Line 7: Line 7:
* TODO
* TODO
==Windows==
==Windows==
Do all of the following in cmd (that is what is meant by terminal)
===Install Reach-Examples===
===Install Reach-Examples===
* download the JDK for Java 8 (or choose the latest Java version) from [http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html the java website]
* download the JDK for Java 8 (or choose the latest Java version) from [http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html the java website]
* install the JDK with default options
* install the JDK with default options
* set JAVA_OPTS
  > set JAVA_OPTS=-server -Xms3g -Xmx6g
* download SBT from [https://www.scala-sbt.org/download.html the scala website]
* download SBT from [https://www.scala-sbt.org/download.html the scala website]
* run the installer with default options
* run the installer with default options
Line 23: Line 26:
   > cd Src
   > cd Src
   > mkdir BIDS
   > mkdir BIDS
  > cd BIDS


* clone the reach-examples repository
* clone the reach-examples repository
Line 28: Line 32:
* change to the reach-examples directory
* change to the reach-examples directory
   > cd reach-examples
   > cd reach-examples
* edit your PATH variable.
* edit your PATH variable. (NOTE: this may be replaced with setx at the command line in the future. I need to look into it. -David)
** In a terminal, do (you may need to replace jdk1.8.0_91 with something similar but different)
** In a terminal, do (you may need to replace jdk1.8.0_91 with something similar but different) <source lang=winbatch>
   > cd c:\Program Files\Java\jdk1.8.0_91\bin
   > cd c:\Program Files\Java\jdk1.8.0_91\bin
</source>
** now highlight the path to the left of the ">" (not including the ">") and do <ctrl><c> to copy it
** now highlight the path to the left of the ">" (not including the ">") and do <ctrl><c> to copy it
** Click Start, then Settings. Type "environment" into the search box in the corner of the settings window
** right click the cmd icon on the task bar, and click "run as administrator"
*** Click "edit the system environment variables"
*** set the path <source lang=winbatch>
*** Click the "Environment Variables..." button
  > setx path "%path%;<ctrl><v> /M"  
*** Select "Path" from the "System variables" box, and click "Edit..."
</source> where <ctrl><v> is you pressing those keys to paste in the path you just copied.
*** Click at the end of the Variable value field to edit the text.
*** Add a semicolon ";", then right click and select paste.
*** Click OK in all windows, close the settings window, and close all open terminals
* In a new terminal, change to the reach-examples directory. For my case, this is  
* In a new terminal, change to the reach-examples directory. For my case, this is  


Line 49: Line 51:


===Install BIDS===
===Install BIDS===
====Install miniconda====
====Install Scikit-learn====
* download miniconda from [http://conda.pydata.org/miniconda.html the conda website] (choose the version for Python 2.7, and your architecture
* install numpy from pre-built binaries [http://www.lfd.uci.edu/~gohlke/pythonlibs/ here] (choose the filename with both '27' in it [for Python 2.7.x] and either 'amd64' (if you're 64 bit architecture) or 'win32' (otherwise)
* install miniconda (install for the whole system, not just the current user, if possible) with default options
* install scipy from pre-built binaries [http://www.lfd.uci.edu/~gohlke/pythonlibs/ here] (choose the filename with both '27' in it [for Python 2.7.x] and either 'amd64' (if you're 64 bit architecture) or 'win32' (otherwise)
* install scikit-learn package
* install scikit-learn from pre-built binaries [http://www.lfd.uci.edu/~gohlke/pythonlibs/#Scikit-learn here] (choose the filename with both '27' in it [for Python 2.7.x] and either 'amd64' (if you're 64 bit architecture) or 'win32' (otherwise)
  > conda install scikit-learn
* If you already had Python installed before installing Miniconda, then you need to now go to your system environment variables (exactly as above) and remove the reference to Python27 at the beginning of the path variable, so that your system uses the conda interpreter
* close all terminals (including the one with SBT running in it, if you left it open)
* close all terminals (including the one with SBT running in it, if you left it open)


Line 64: Line 64:
* in a new terminal, install virtual env from pip:
* in a new terminal, install virtual env from pip:
   > pip install virtualenvwrapper-win
   > pip install virtualenvwrapper-win
* make a bids environment
* make a bids environment. If you do not use Python 2.7.x as your python interpreter (calling <source lang=winbatch>python --version</source> on the command line will tell you), you'll need to do
  > mkvirtualenv --python=C:\Python27\python.exe bids
possibly substituting a different path to the python.exe for Python2.7.x if it's not in the default location. If you do use python 2.7.x, you can just do
   > mkvirtualenv bids
   > mkvirtualenv bids
** you should now see (bids) in your command prompt
** you should now see (bids) in your command prompt
* install the Visual C++ compiler for Python 2.7 (try not to cry)
* install the Visual C++ compiler for Python 2.7 (try not to cry)
** download from [http://aka.ms/vcpython27 the microsoft website], run the installer with default options
** download from [http://aka.ms/vcpython27 the microsoft website], run the installer with default options
* install the requirements for the BIDS project using pip and the requirements.txt file
* install the requirements for the BIDS project using pip and the modified requirements.txt file
   > pip install -r requirements.txt
   > pip install -r requirements.txt
* THIS MAY BREAK. Windows should tell you that the .NET 3.5 framework is needed, and offer to install it automatically. Do it, and once it finishes run the above "pip install" command again
** If Windows doesn't do this for you, please let David know
* now change to the BIDS directory. In my case
* now change to the BIDS directory. In my case
   > cd Src\BIDS\bigmech
   > cd Src\BIDS\bigmech
Line 79: Line 79:
* we need to add the path to bioCausalRelationLearner to your path (similar to what we did before to add javac to the path)
* we need to add the path to bioCausalRelationLearner to your path (similar to what we did before to add javac to the path)
** first get the path to the bioCausalRelationLearner
** first get the path to the bioCausalRelationLearner
*** in a new terminal, go to the directory containing the file bioCausalRelationLearner.py. This file is in the directory for BIDS that you cloned earlier. For me it is in
*** in a new terminal, go to the directory containing the file bioCausalRelationLearner.py. This file is in the directory for BIDS that you cloned earlier. For me it is in <source lang=winbatch>  > cd Src\BIDS\bigmech\bioIncrementalDistantSupervision </source>
  > cd Src\BIDS\bioIncrementalDistantSupervision
*** highlight the path to the left of the ">" (not including the ">"), and copy with <ctrl><c>
*** highlight the path to the left of the ">" (not including the ">"), and copy with <ctrl><c>
*** close the terminal
*** close the terminal
Line 88: Line 87:
** Try to find "PYTHONPATH" in the "System variables" box. If it is there, click "Edit..." and add a semicolon, then paste from the clipboard. If it is not, click New... and name the variable PYTHONPATH, and paste  from the clipboard into the Variable value field.
** Try to find "PYTHONPATH" in the "System variables" box. If it is there, click "Edit..." and add a semicolon, then paste from the clipboard. If it is not, click New... and name the variable PYTHONPATH, and paste  from the clipboard into the Variable value field.
** Click OK to save the settings, then OK again in the next window
** Click OK to save the settings, then OK again in the next window
====Run the unit tests====
====Run the unit tests====
* now we'll run the unit test for training the classifier. First we run the reach server.  
* now we'll run the unit test for training the classifier. First we run the reach server.  
Line 95: Line 95:
* In a second new terminal, go to the BIDS source directory and run the python unittest test_train:
* In a second new terminal, go to the BIDS source directory and run the python unittest test_train:
   > cd Src\BIDS\bigmech
   > cd Src\BIDS\bigmech
   > python -m unittest
   > python -m unittest test.test_IncrementalDistantSupervision.IncrementalDistantSupervisionTests.test_train
* If you see "Training classifier..." followed by an error about a .pkl file missing, you are good (this will be fixed very shortly)


==Mac==
==Mac==

Latest revision as of 00:23, 19 May 2016

Setting up BIDS

Linux

Debian, Ubuntu, Mint

  • TODO

Arch

  • TODO

Windows

Do all of the following in cmd (that is what is meant by terminal)

Install Reach-Examples

  • download the JDK for Java 8 (or choose the latest Java version) from the java website
  • install the JDK with default options
  • set JAVA_OPTS
 > set JAVA_OPTS=-server -Xms3g -Xmx6g
  • download SBT from the scala website
  • run the installer with default options
  • close and reopen any terminals you have open
  • In a terminal run SBT (ensure your network remains connected, as things will be downloaded from maven repos.)
 > sbt
  • download git from the git website
  • install git with default options
  • close and reopen any terminals you have open
  • In a terminal make a directory to store the BIDS project. We will create a directory 'Src' (intended to store all source code we work on, including BIDS) with a directory 'BIDS' inside
 > mkdir Src
 > cd Src
 > mkdir BIDS
 > cd BIDS
  • clone the reach-examples repository
 > git clone https://github.com/dsidi/reach-examples
  • change to the reach-examples directory
 > cd reach-examples
  • edit your PATH variable. (NOTE: this may be replaced with setx at the command line in the future. I need to look into it. -David)
    • In a terminal, do (you may need to replace jdk1.8.0_91 with something similar but different) <source lang=winbatch>
 > cd c:\Program Files\Java\jdk1.8.0_91\bin

</source>

    • now highlight the path to the left of the ">" (not including the ">") and do <ctrl><c> to copy it
    • right click the cmd icon on the task bar, and click "run as administrator"
      • set the path <source lang=winbatch>
 > setx path "%path%;<ctrl><v> /M" 

</source> where <ctrl><v> is you pressing those keys to paste in the path you just copied.

  • In a new terminal, change to the reach-examples directory. For my case, this is
 > cd Src\BIDS\reach-examples
  • run reach-examples with sbt (again sbt will download several things, so ensure your connection to the internet is up)
 > sbt run
  • when prompted, type the number of the selection for com.yourorg.GroundStringsEntryPoint
  • If no errors are shown, move to the next section

Install BIDS

Install Scikit-learn

  • install numpy from pre-built binaries here (choose the filename with both '27' in it [for Python 2.7.x] and either 'amd64' (if you're 64 bit architecture) or 'win32' (otherwise)
  • install scipy from pre-built binaries here (choose the filename with both '27' in it [for Python 2.7.x] and either 'amd64' (if you're 64 bit architecture) or 'win32' (otherwise)
  • install scikit-learn from pre-built binaries here (choose the filename with both '27' in it [for Python 2.7.x] and either 'amd64' (if you're 64 bit architecture) or 'win32' (otherwise)
  • close all terminals (including the one with SBT running in it, if you left it open)

Get the BIDS code

  • in a new terminal change to the directory containing reach-examples, then clone the BIDS repository (so that the BIDS directory and the reach-examples directory are siblings:
 > cd Src\BIDS
 > git clone https://github.com/ua-sista/bigmech.git

Install BIDS dependencies

  • in a new terminal, install virtual env from pip:
 > pip install virtualenvwrapper-win
  • make a bids environment. If you do not use Python 2.7.x as your python interpreter (calling <source lang=winbatch>python --version</source> on the command line will tell you), you'll need to do
 > mkvirtualenv --python=C:\Python27\python.exe bids

possibly substituting a different path to the python.exe for Python2.7.x if it's not in the default location. If you do use python 2.7.x, you can just do

 > mkvirtualenv bids
    • you should now see (bids) in your command prompt
  • install the Visual C++ compiler for Python 2.7 (try not to cry)
  • install the requirements for the BIDS project using pip and the modified requirements.txt file
 > pip install -r requirements.txt
  • now change to the BIDS directory. In my case
 > cd Src\BIDS\bigmech

Add BIDS paths to PYTHONPATH

  • we need to add the path to bioCausalRelationLearner to your path (similar to what we did before to add javac to the path)
    • first get the path to the bioCausalRelationLearner
      • in a new terminal, go to the directory containing the file bioCausalRelationLearner.py. This file is in the directory for BIDS that you cloned earlier. For me it is in <source lang=winbatch> > cd Src\BIDS\bigmech\bioIncrementalDistantSupervision </source>
      • highlight the path to the left of the ">" (not including the ">"), and copy with <ctrl><c>
      • close the terminal
    • Click Start, then Settings. Type "environment" into the search box in the corner of the settings window
    • Click "edit the system environment variables"
    • Click the "Environment Variables..." button
    • Try to find "PYTHONPATH" in the "System variables" box. If it is there, click "Edit..." and add a semicolon, then paste from the clipboard. If it is not, click New... and name the variable PYTHONPATH, and paste from the clipboard into the Variable value field.
    • Click OK to save the settings, then OK again in the next window

Run the unit tests

  • now we'll run the unit test for training the classifier. First we run the reach server.
  • In a new terminal, go to the reach-examples directory and do
 > run sbt 

selecting the entry point exactly as above

  • In a second new terminal, go to the BIDS source directory and run the python unittest test_train:
 > cd Src\BIDS\bigmech
 > python -m unittest test.test_IncrementalDistantSupervision.IncrementalDistantSupervisionTests.test_train
  • If you see "Training classifier..." followed by an error about a .pkl file missing, you are good (this will be fixed very shortly)

Mac