diff --git a/installer/centos/README.md b/installer/centos/README.md index 7f452d5d..f08c66cf 100644 --- a/installer/centos/README.md +++ b/installer/centos/README.md @@ -1,4 +1,4 @@ -# HNN "Python" install (CentOS) +# HNN install (CentOS) The script below assumes that it can update OS packages for python and prerequisites for HNN. @@ -33,18 +33,20 @@ The script below assumes that it can update OS packages for python and prerequis ## Upgrading to a new version of HNN -HNN Releases can be seen on the [GitHub releases page](https://github.com/jonescompneurolab/hnn/releases/). You can also be notified of new releases by watching the hnn [repository on GitHub](https://github.com/jonescompneurolab/hnn/). +HNN Releases can be found on the [GitHub releases page](https://github.com/jonescompneurolab/hnn/releases/). You can also be notified of new releases by watching the hnn [repository on GitHub](https://github.com/jonescompneurolab/hnn/). -To download the latest release, use the following commands within an Ubuntu terminal: +To download the latest HNN release: ```bash curl --remote-name https://github.com/jonescompneurolab/hnn/releases/latest/download/hnn.tar.gz +mkdir hnn_source_code tar -x --strip-components 1 -f hnn.tar.gz -C hnn_source_code cd hnn_source_code -make python3 hnn.py ``` +If you are using `git`, then run `git pull origin master` from the source code directory. + ## Troubleshooting If you run into other issues with the installation, please [open an issue on our GitHub](https://github.com/jonescompneurolab/hnn/issues). Our team monitors these issues and will investigate possible fixes. diff --git a/installer/mac/README.md b/installer/mac/README.md index 49f56553..653aa623 100644 --- a/installer/mac/README.md +++ b/installer/mac/README.md @@ -1,4 +1,4 @@ -# HNN "Python" install (Mac OS) +# HNN install (Mac OS) ## Opening a terminal window @@ -9,12 +9,12 @@ - The command below will run a script to check for existing installations of prerequisites. If a compatible version is installed, it will say which steps can be skipped below. ```bash - curl -s "https://raw.githubusercontent.com/jonescompneurolab/hnn/master/installer/mac/check-pre.sh" | bash + curl -s "https://raw.githubusercontent.com/blakecaldwell/hnn/integration_docs/installer/mac/check-pre.sh" | bash ``` ## Prerequisite 1: Xcode Command Line Tools -The Xcode Command Line Tools package includes utilities for compiling code from the terminal (gcc, make, etc.). This is needed for compiling mod files in NEURON. +The Xcode Command Line Tools package includes utilities for compiling code from the terminal. This is needed for compiling NEURON mod files during the hnn-core installation. 1. To install the package, type the following from a terminal.app window: @@ -46,58 +46,37 @@ The Xcode Command Line Tools package includes utilities for compiling code from ```bash conda env create -f environment.yml + conda install -y -n hnn openmpi mpi4py ``` -2. Activate the HNN conda environment and install nlopt and NEURON +2. Activate the HNN conda environment and python prerequisite packages ```bash - source activate hnn - pip install nlopt NEURON - ``` - -3. Set the LD_LIBRARY_PATH for openmpi on conda activation. This environnement variable must be set before HNN can run simulations with openmpi. The variable is only useful inside the 'hnn' conda environment, so we will set the variable when conda is activated with `source activate hnn`. Run the following commands to make this automatic. - - ```bash - cd ${CONDA_PREFIX} - mkdir -p etc/conda/activate.d etc/conda/deactivate.d - echo "export OLD_LD_LIBRARY_PATH=\$LD_LIBRARY_PATH" >> etc/conda/activate.d/env_vars.sh - echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\${CONDA_PREFIX}/lib" >> etc/conda/activate.d/env_vars.sh - echo "export LD_LIBRARY_PATH=\$OLD_LD_LIBRARY_PATH" >> etc/conda/deactivate.d/env_vars.sh - echo "unset OLD_LD_LIBRARY_PATH" >> etc/conda/deactivate.d/env_vars.sh - ``` - -4. Open a new terminal window for the settings in the previous step to take effect and activate the HNN conda environment - - ```bash - source activate hnn + conda activate hnn + pip install hnn-core + pip install nlopt + pip install mpi4py ``` ## Run post-install checks -- Run the command below to check that all of the steps were successful and are ready to run HNN. - - ```bash - curl -s "https://raw.githubusercontent.com/jonescompneurolab/hnn/master/installer/mac/check-post.sh" | bash - ``` +```bash +curl -s "https://raw.githubusercontent.com/blakecaldwell/hnn/integration_docs/installer/mac/check-post.sh" | bash +``` ## Download HNN source code -- The following commands will download the hnn source code and compile HNN's mod files for NEURON. We use the directory `hnn_source_code` for consistency with all of our instructions, but any directory can be used. You can use `git` if you prefer. - - ```bash - curl -OL https://github.com/jonescompneurolab/hnn/releases/latest/download/hnn.tar.gz - mkdir hnn_source_code - tar -x --strip-components 1 -f hnn.tar.gz -C hnn_source_code - cd hnn_source_code - make - ``` +```bash +git clone https://github.com/jonescompneurolab/hnn.git +cd hnn +``` ## Run the HNN model -1. Start the HNN GUI from a terminal window: +1. Start the HNN GUI from a terminal window. Make sure the hnn environment has been activated each time a terminal window is opened: ```bash - source activate hnn + conda activate hnn python hnn.py ``` @@ -109,16 +88,26 @@ The Xcode Command Line Tools package includes utilities for compiling code from -4. You can now proceed to running the tutorials at https://hnn.brown.edu/index.php/tutorials/ . Some things to note: +4. You can now proceed to running the tutorials at [https://hnn.brown.edu/index.php/tutorials/](https://hnn.brown.edu/index.php/tutorials/) . Some things to note: + - A directory called "hnn_out" exists in your home directory where the results from your simulations (data and param files) will be stored. ## Upgrading to a new version of HNN -HNN Releases can be seen on the [GitHub releases page](https://github.com/jonescompneurolab/hnn/releases/). You can also be notified of new releases by watching the hnn [repository on GitHub](https://github.com/jonescompneurolab/hnn/). +HNN Releases can be found on the [GitHub releases page](https://github.com/jonescompneurolab/hnn/releases/). You can also be notified of new releases by watching the hnn [repository on GitHub](https://github.com/jonescompneurolab/hnn/). + +To download the latest HNN release: -If you downloaded the `tar.gz` file, simply re-run the steps above, but replace `hnn_source_code` with a new directory name. +```bash +curl -OL https://github.com/jonescompneurolab/hnn/releases/latest/download/hnn.tar.gz +mkdir hnn_source_code +tar -x --strip-components 1 -f hnn.tar.gz -C hnn_source_code +cd hnn_source_code +conda activate hnn +python3 hnn.py +``` -Otherwise, if you are using `git`, then run `git pull origin master` from the source code directory. +If you are using `git`, then run `git pull origin master` from the source code directory. ## Troubleshooting diff --git a/installer/mac/check-post.sh b/installer/mac/check-post.sh index df71702d..3ac2d09d 100755 --- a/installer/mac/check-post.sh +++ b/installer/mac/check-post.sh @@ -28,34 +28,6 @@ echo "--------------------------------------" CUR_DIR=$(pwd) -echo -n "Checking if HNN is compiled..." -if [[ -f ${CUR_DIR}/hnn.py ]]; then - if [[ -f "${CUR_DIR}/x86_64/hh2.mod" ]]; then - echo "ok" - if [[ "$VERBOSE" -eq "1" ]]; then - echo "HNN source code compiled and ready to use at ${CUR_DIR}" - echo - fi - else - echo "failed" - echo "Found a source code directory at ${CUR_DIR}, but it needs to be compiled (run make)." - echo - return=2 - fi -else - if [[ -f "$HOME/hnn/x86_64/hh2.mod" ]]; then - echo "warning" - echo "Did you mean to run this from $HOME/hnn instead?" - echo - return=1 - else - echo "failed" - echo "Didn't find HNN source code in this directory" - echo - return=2 - fi -fi - echo -n "Checking for miniconda..." MINICONDA_FOUND= which conda > /dev/null 2>&1 @@ -161,24 +133,6 @@ else echo "ok" fi -MPI_WORKS= -if [[ "$MPI_FOUND" -eq "1" ]]; then - echo -n "Checking MPI functionality..." - COMMAND="mpiexec -n 1 echo \"hello\" 2>&1" - OUTPUT=$(mpiexec -n 1 echo "hello" 2>&1) - if [[ "$?" -eq "0" ]] && [[ "$OUTPUT" =~ "hello" ]]; then - echo "ok" - MPI_WORKS=1 - else - echo "failed" - echo "the command that failed was:" - echo "$COMMAND" - echo $OUTPUT - echo - return=2 - fi -fi - # NEURON functionality checks from https://github.com/jonescompneurolab/hnn/issues/11 NRNIV_WORKS= if [[ "$NRN_FOUND" -eq "1" ]]; then @@ -202,7 +156,7 @@ else fi PREREQS_INSTALLED=1 -for prereq in "matplotlib" "scipy" "psutil" "numpy" "nlopt" "neuron"; do +for prereq in "matplotlib" "scipy" "psutil" "numpy" "nlopt" "neuron" "hnn_core"; do echo -n "Checking Python can import $prereq module..." $PYTHON -c "import $prereq" > /dev/null 2>&1 if [[ "$?" -eq "0" ]]; then @@ -237,47 +191,24 @@ else echo "Skipping NEURON funtionality tests with Python." fi -echo -n "Checking for setting LD_LIBRARY_PATH..." -source ${CONDA_PREFIX}/etc/conda/activate.d/env_vars.sh > /dev/null 2>&1 -if [[ "$?" -eq "0" ]] && [[ -n "${LD_LIBRARY_PATH}" ]]; then - echo "ok" -else - echo "warning" - echo "The LD_LIBRARY_PATH variable is not set correctly. Make sure you follow the installation" - echo "instructions to add the correct lines to ${CONDA_PREFIX}/etc/conda/activate.d/env_vars.sh" - return=1 -fi - - MPI_AND_NRNIV_WORKS= -if [[ "$NRN_FOUND" -eq "1" ]] && [[ "$NRNIV_WORKS" -eq "1" ]] && [[ "$MPI_WORKS" -eq "1" ]]; then +if [[ "$NRN_FOUND" -eq "1" ]] && [[ "$NRNIV_WORKS" -eq "1" ]]; then echo -n "Checking NEURON nrniv funtionality with MPI..." - mpiexec -n 2 nrniv -nobanner -nopython -mpi -c 'quit()' > /dev/null 2>&1 + COMMAND="mpiexec -n 2 nrniv -nobanner -nopython -mpi -c 'quit()'" + OUTPUT=$(export LD_LIBRARY_PATH=${CONDA_PREFIX}/lib; mpiexec -n 2 nrniv -nobanner -nopython -mpi -c 'quit()') if [[ "$?" -eq "0" ]]; then echo "ok" MPI_AND_NRNIV_WORKS=1 else - # try with LD_LIBRARY_PATH - COMMAND="mpiexec -n 2 nrniv -nobanner -nopython -mpi -c 'quit()'" - OUTPUT=$(export LD_LIBRARY_PATH=${CONDA_PREFIX}/lib; mpiexec -n 2 nrniv -nobanner -nopython -mpi -c 'quit()') - if [[ "$?" -eq "0" ]]; then - echo "warning" - echo "The LD_LIBRARY_PATH variable is not set correctly. Make sure you follow the installation" - echo "instructions to add the correct lines to ${CONDA_PREFIX}/etc/conda/activate.d/env_vars.sh" - echo - return=1 - MPI_AND_NRNIV_WORKS=1 - else - echo "failed" - echo "Could not run nrniv with MPI" - echo "The command that failed was:" - echo "$COMMAND" - echo "Tried environment variable LD_LIBRARY_PATH=${CONDA_PREFIX}/lib" - echo "Command output (on a single line):" - echo $OUTPUT - echo - return=2 - fi + echo "failed" + echo "Could not run nrniv with MPI" + echo "The command that failed was:" + echo "$COMMAND" + echo "Tried environment variable LD_LIBRARY_PATH=${CONDA_PREFIX}/lib" + echo "Command output (on a single line):" + echo $OUTPUT + echo + return=2 fi else echo "Skipping NEURON funtionality tests with MPI." @@ -285,24 +216,27 @@ fi NRNIV_AND_PYTHON_AND_MPI_WORKS= if [[ "$NRN_FOUND" -eq "1" ]] && [[ "$NRNIV_WORKS" -eq "1" ]] && - [[ "$PREREQS_INSTALLED" -eq "1" ]] && [[ "$MPI_WORKS" -eq "1" ]] && + [[ "$PREREQS_INSTALLED" -eq "1" ]] && [[ "$MPI_AND_NRNIV_WORKS" -eq "1" ]]; then - echo -n "Checking NEURON nrniv funtionality with Python and MPI..." - COMMAND="mpiexec -n 2 nrniv -nobanner -mpi -python -c 'from neuron import h; pc = h.ParallelContext(); h.quit()' 2>&1" - OUTPUT=$(mpiexec -n 2 nrniv -nobanner -mpi -python -c 'from neuron import h; pc = h.ParallelContext(); h.quit()' 2>&1) - if [[ "$?" -eq "0" ]]; then - echo "ok" - NRNIV_AND_PYTHON_AND_MPI_WORKS=1 - else - echo "failed" - echo "Could not run nrniv with Python and MPI" - echo "the command that failed was:" - echo "$COMMAND" - echo $OUTPUT - return=2 - fi + echo -n "Checking NEURON nrniv funtionality with Python and MPI..." + COMMAND="mpiexec -n 2 nrniv -nobanner -mpi -python -c 'from neuron import h; pc = h.ParallelContext(); h.quit()' 2>&1" + OUTPUT=$(export LD_LIBRARY_PATH=${CONDA_PREFIX}/lib; mpiexec -n 2 nrniv -nobanner -mpi -python -c 'from neuron import h; pc = h.ParallelContext(); h.quit()' 2>&1) + if [[ "$?" -eq "0" ]]; then + echo "ok" + NRNIV_AND_PYTHON_AND_MPI_WORKS=1 + else + echo "failed" + echo "Could not run nrniv with Python and MPI" + echo "the command that failed was:" + echo "$COMMAND" + echo "Tried environment variable LD_LIBRARY_PATH=${CONDA_PREFIX}/lib" + echo "Command output (on a single line):" + echo $OUTPUT + echo + return=2 + fi else - echo "Skipping NEURON funtionality tests with Python and MPI." + echo "Skipping NEURON funtionality tests with Python and MPI." fi diff --git a/installer/mac/check-pre.sh b/installer/mac/check-pre.sh index 1658122a..fae39557 100755 --- a/installer/mac/check-pre.sh +++ b/installer/mac/check-pre.sh @@ -91,8 +91,7 @@ if [ -n "$PYTHONPATH" ]; then if [[ "$PYTHONPATH" =~ "NEURON" ]] || [[ "$PYTHONPATH" =~ "NRN" ]]; then echo "warning" echo "NEURON libraries found in PYTHONPATH variable. This was used before " - echo "the 'pip install' method. Make sure this matches the version used to " - echo "compile HNN modules with 'make'" + echo "the 'pip install' method." echo "PYTHONPATH=$PYTHONPATH" echo return=1 diff --git a/installer/ubuntu/README.md b/installer/ubuntu/README.md index 82c4ae3b..faa83f92 100644 --- a/installer/ubuntu/README.md +++ b/installer/ubuntu/README.md @@ -1,41 +1,72 @@ -# HNN "Python" install (Ubuntu) +# HNN install (Ubuntu) -The script below assumes that it can update OS packages for python and prerequisites for NHNN. +## Prerequisite: Miniconda + +- Run the commands below from a terminal window (as a regular user). This will create a python environment isolated from other installations on the system. + + ```bash + cd /tmp/ + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh + sh ./Miniconda3-latest-Linux-x86_64.sh -b + rm /tmp/Miniconda3-latest-Linux-x86_64.sh + ``` + +## Prepare the Python environment + +1. Create a conda environment with the Python prerequisites for HNN. + + ```bash + conda env create -f environment.yml + ``` + +2. Activate the HNN conda environment and python prerequisite packages + + ```bash + conda activate hnn + pip install hnn-core + pip install nlopt + pip install mpi4py + ``` + +## Download HNN source code ```bash -curl --remote-name https://raw.githubusercontent.com/jonescompneurolab/hnn/master/installer/ubuntu/hnn-ubuntu.sh -bash hnn-ubuntu.sh +git clone https://github.com/jonescompneurolab/hnn.git +cd hnn ``` -## Start HNN +## Run the HNN model -1. From the command-line, type following commands +1. Start the HNN GUI from a terminal window. Make sure the hnn environment has been activated each time a terminal window is opened: ```bash - cd hnn_source_code - python3 hnn.py + conda activate hnn + python hnn.py ``` 2. The HNN GUI should show up. Make sure that you can run simulations by clicking the 'Run Simulation' button. This will run a simulation with the default configuration. After it completes, graphs should be displayed in the main window. 3. You can now proceed to running the tutorials at [https://hnn.brown.edu/index.php/tutorials/](https://hnn.brown.edu/index.php/tutorials/) . Some things to note: - * A directory called "hnn_out" exists in your home directory in Ubuntu where the results from your simulations (data and param files) will be stored. + - A directory called "hnn_out" exists in your home directory where the results from your simulations (data and param files) will be stored. ## Upgrading to a new version of HNN -HNN Releases can be seen on the [GitHub releases page](https://github.com/jonescompneurolab/hnn/releases/). You can also be notified of new releases by watching the hnn [repository on GitHub](https://github.com/jonescompneurolab/hnn/). +HNN Releases can be found on the [GitHub releases page](https://github.com/jonescompneurolab/hnn/releases/). You can also be notified of new releases by watching the hnn [repository on GitHub](https://github.com/jonescompneurolab/hnn/). -To download the latest release, use the following commands within an Ubuntu terminal: +To download the latest HNN release: ```bash curl --remote-name https://github.com/jonescompneurolab/hnn/releases/latest/download/hnn.tar.gz +mkdir hnn_source_code tar -x --strip-components 1 -f hnn.tar.gz -C hnn_source_code cd hnn_source_code -make +conda activate hnn python3 hnn.py ``` +If you are using `git`, then run `git pull origin master` from the source code directory. + ## Troubleshooting If you run into other issues with the installation, please [open an issue on our GitHub](https://github.com/jonescompneurolab/hnn/issues). Our team monitors these issues and will investigate possible fixes. diff --git a/installer/ubuntu/hnn-ubuntu.sh b/installer/ubuntu/hnn-ubuntu.sh index 46b1bb88..21875eb7 100755 --- a/installer/ubuntu/hnn-ubuntu.sh +++ b/installer/ubuntu/hnn-ubuntu.sh @@ -97,7 +97,7 @@ fi echo "Installing OS compilation toolchain..." | tee -a "$LOGFILE" # get prerequisites from pip. requires gcc to build psutil sudo -E apt-get install --no-install-recommends -y \ - make gcc g++ python3-dev &> "$LOGFILE" + gcc g++ python3-dev &> "$LOGFILE" if [[ "$USE_CONDA" -eq 0 ]]; then echo "Waiting for python packages for HNN downloads to finish..." @@ -126,9 +126,6 @@ else # create conda environment conda env create -f environment.yml - # conda is faster to install nlopt - conda install -y -n hnn -c conda-forge nlopt - source activate hnn && echo "activated conda HNN environment" echo "Installing MPI compilation toolchain..." | tee -a "$LOGFILE" @@ -137,7 +134,7 @@ else libopenmpi-dev &> "$LOGFILE" # install hnn-core and prerequisites (e.g. NEURON) - pip install mpi4py pyqt5 hnn-core + pip install hnn-core mpi4py nlopt fi echo "Downloading runtime prerequisite packages..." | tee -a "$LOGFILE" diff --git a/installer/windows/native_install.md b/installer/windows/native_install.md index 609a8b16..a6213c75 100644 --- a/installer/windows/native_install.md +++ b/installer/windows/native_install.md @@ -24,13 +24,13 @@ The PowerShell script used below will create a new directory called "hnn" in the OR to download and run the script from a url: ```powershell - @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/jonescompneurolab/hnn/master/installer/windows/hnn-windows.ps1'))" + @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/blakecaldwell/hnn/integration_docs/installer/windows/hnn-windows.ps1'))" ``` OR from a powershell prompt: ```powershell - Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/jonescompneurolab/hnn/master/installer/windows/hnn-windows.ps1')) + Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/blakecaldwell/hnn/integration_docs/installer/windows/hnn-windows.ps1')) ``` - There will be a permission prompt to install Microsoft MPI and a couple of terminal windows will diff --git a/installer/windows/wsl.md b/installer/windows/wsl.md index c0edb482..81a598dd 100644 --- a/installer/windows/wsl.md +++ b/installer/windows/wsl.md @@ -28,7 +28,7 @@ Some notes: Launch the Ubuntu application to open a command line and run the commands below to download and run a script that will install HNN and its prerequisites. ```bash -curl --remote-name https://raw.githubusercontent.com/jonescompneurolab/hnn/master/installer/ubuntu/hnn-ubuntu.sh +curl --remote-name https://raw.githubusercontent.com/blakecaldwell/hnn/integration_docs/installer/ubuntu/hnn-ubuntu.sh bash hnn-ubuntu.sh ``` @@ -67,15 +67,15 @@ You will need to **restart Ubuntu** after this. Until you do so, simulations wil ## Upgrading to a new version of HNN -HNN Releases can be seen on the [GitHub releases page](https://github.com/jonescompneurolab/hnn/releases/). You can also be notified of new releases by watching the hnn [repository on GitHub](https://github.com/jonescompneurolab/hnn/). +HNN Releases can be found on the [GitHub releases page](https://github.com/jonescompneurolab/hnn/releases/). You can also be notified of new releases by watching the hnn [repository on GitHub](https://github.com/jonescompneurolab/hnn/). -To download the latest release, use the following commands within an Ubuntu terminal: +To download the latest HNN release, use the following commands within an Ubuntu terminal: ```bash wget -O hnn.tar.gz https://github.com/jonescompneurolab/hnn/releases/latest/download/hnn.tar.gz +mkdir hnn_source_code tar -x --strip-components 1 -f hnn.tar.gz -C hnn_source_code cd hnn_source_code -make python3 hnn.py ``` diff --git a/scripts/setup-travis-osx.sh b/scripts/setup-travis-osx.sh index fc3b123b..b4cd4bb1 100755 --- a/scripts/setup-travis-osx.sh +++ b/scripts/setup-travis-osx.sh @@ -17,8 +17,6 @@ source "$HOME/Miniconda3/etc/profile.d/conda.sh" # create conda environment conda env create -f environment.yml conda install -y -n hnn openmpi mpi4py -# conda is faster to install nlopt -conda install -y -n hnn -c conda-forge nlopt conda activate hnn -pip install hnn-core pyqt5 \ No newline at end of file +pip install hnn-core nlopt \ No newline at end of file