diff --git a/installer/centos/README.md b/installer/centos/README.md index 7f452d5d0..f08c66cf4 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/centos/hnn-centos6.sh b/installer/centos/hnn-centos6.sh index 16ad5867d..034c5b490 100644 --- a/installer/centos/hnn-centos6.sh +++ b/installer/centos/hnn-centos6.sh @@ -16,7 +16,7 @@ sudo yum -y install python34-setuptools sudo easy_install-3.4 pip pip3 install --upgrade matplotlib --user pip3 install --upgrade nlopt scipy --user -pip3 install hnn-core +pip3 install https://api.github.com/repos/jonescompneurolab/hnn-core/zipball/master sudo yum -y install ncurses-devel sudo yum -y install openmpi openmpi-devel sudo yum -y install libXext libXext-devel diff --git a/installer/docker/Dockerfile b/installer/docker/Dockerfile index f417f381e..a3552ec3d 100644 --- a/installer/docker/Dockerfile +++ b/installer/docker/Dockerfile @@ -84,7 +84,7 @@ LABEL org.label-schema.build-date=$BUILD_DATE \ org.label-schema.schema-version=$VCS_TAG # install hnn-core -RUN sudo pip install hnn-core +RUN sudo pip install https://api.github.com/repos/jonescompneurolab/hnn-core/zipball/master # install HNN RUN sudo apt-get update && \ diff --git a/installer/mac/README.md b/installer/mac/README.md index 49f56553f..6e73c8aac 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 @@ -14,7 +14,7 @@ ## 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: @@ -25,9 +25,7 @@ The Xcode Command Line Tools package includes utilities for compiling code from - If you get the following error, you can skip this step. `xcode-select: error: command line tools are already installed, use "Software Update" to install updates` -2. Then press `Install` in the pop-up dialog - - +2. Then press `Install` in the pop-up dialog. ## Prerequisite 2: Miniconda (Python 3) @@ -46,79 +44,64 @@ 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 - - ```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 +2. Activate the HNN conda environment and python prerequisite packages ```bash - source activate hnn + conda activate hnn + pip install https://api.github.com/repos/jonescompneurolab/hnn-core/zipball/master + 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/jonescompneurolab/hnn/master/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 ``` 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. When you run simulations for the first time, the following dialog boxes may pop-up and ask you for permission to allow connections through the firewall. Saying 'Deny' is fine since simulations will just run locally on your Mac. +3. When you run simulations for the first time, two dialog boxes may pop-up and ask you for permission to allow connections through the firewall. Saying 'Deny' is fine since simulations will just run locally on your Mac. - +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: - - -4. You can now proceed to running the tutorials at 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 df71702d3..3ac2d09d2 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 1658122a3..fae39557d 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 82c4ae3bc..d3a38ce61 100644 --- a/installer/ubuntu/README.md +++ b/installer/ubuntu/README.md @@ -1,45 +1,76 @@ -# 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 https://api.github.com/repos/jonescompneurolab/hnn-core/zipball/master + 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. Another option for users that are running into problems with the above methods, we provide a VirtualBox VM pre-installed with HNN. -* [Virtualbox install instructions](../virtualbox/README.md) +- [Virtualbox install instructions](../virtualbox/README.md) diff --git a/installer/ubuntu/hnn-ubuntu.sh b/installer/ubuntu/hnn-ubuntu.sh index 4af9990d8..151f23a87 100755 --- a/installer/ubuntu/hnn-ubuntu.sh +++ b/installer/ubuntu/hnn-ubuntu.sh @@ -3,6 +3,7 @@ set -e [[ "$LOGFILE" ]] || LOGFILE="ubuntu_install.log" +[[ "$USE_CONDA" ]] || USE_CONDA=0 function start_download { echo "Downloading $2" @@ -61,17 +62,17 @@ echo "Using python version $PYTHON_VERSION" | tee -a "$LOGFILE" export DEBIAN_FRONTEND=noninteractive echo "Updating package repository..." | tee -a "$LOGFILE" -sudo -E apt-get update &>> "$LOGFILE" +sudo -E apt-get update &> "$LOGFILE" echo "Updating OS python packages..." | tee -a "$LOGFILE" if [[ "${PYTHON_VERSION}" =~ "3.7" ]] && [[ "$DISTRIB" =~ "bionic" ]]; then - sudo -E apt-get install --no-install-recommends -y python3.7 python3-pip python3.7-tk python3.7-dev &>> "$LOGFILE" && \ - sudo python3.7 -m pip install --upgrade pip setuptools &>> "$LOGFILE" + sudo -E apt-get install --no-install-recommends -y python3.7 python3-pip python3-tk python3.7-dev &> "$LOGFILE" && \ + sudo python3.7 -m pip install --upgrade pip setuptools &> "$LOGFILE" sudo ln -s /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so \ /usr/lib/python3/dist-packages/apt_pkg.so else - sudo -E apt-get install --no-install-recommends -y python3 python3-pip python3-tk python3-setuptools &>> "$LOGFILE" && \ - sudo pip3 install --upgrade pip &>> "$LOGFILE" + sudo -E apt-get install --no-install-recommends -y python3 python3-pip python3-tk python3-setuptools &> "$LOGFILE" && \ + sudo pip3 install --upgrade pip &> "$LOGFILE" fi if which python3 &> /dev/null; then @@ -87,22 +88,65 @@ elif which python &> /dev/null; then fi echo "Using python: $PYTHON with pip: $PIP" | tee -a "$LOGFILE" +if [[ "$USE_CONDA" -eq 0 ]]; then + echo "Downloading python packages for HNN with pip..." | tee -a "$LOGFILE" + $PIP download pyqt5 nlopt psutil hnn-core &> "$LOGFILE" & + PIP_PID=$! +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..." + NAME="downloading python packages for HNN " + wait_for_pid "${PIP_PID}" "$NAME" + + # install hnn-core and prerequisites (e.g. NEURON) + echo "Installing python prequisites for HNN with pip..." | tee -a "$LOGFILE" + $PIP install --no-cache-dir pyqt5 nlopt psutil https://api.github.com/repos/jonescompneurolab/hnn-core/zipball/master &> "$LOGFILE" + + # WSL may not have nrnivmodl in PATH + if ! which nrnivmodl &> /dev/null; then + export PATH="$PATH:$HOME/.local/bin" + echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc + fi +else + URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" + FILENAME="$HOME/miniconda.sh" + start_download "$FILENAME" "$URL" -$PIP install --no-cache-dir NEURON + echo "Installing miniconda..." + chmod +x "$HOME/miniconda.sh" + "$HOME/miniconda.sh" -b -p "${HOME}/Miniconda3" + export PATH=${HOME}/Miniconda3/bin:$PATH -# WSL may not have nrnivmodl in PATH -if ! which nrnivmodl &> /dev/null; then - export PATH="$PATH:$HOME/.local/bin" - echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc + # create conda environment + conda env create -f environment.yml + + source activate hnn && echo "activated conda HNN environment" + + echo "Installing MPI compilation toolchain..." | tee -a "$LOGFILE" + # get prerequisites to build mpi4py + sudo -E apt-get install --no-install-recommends -y \ + libopenmpi-dev &> "$LOGFILE" + + # install hnn-core and prerequisites (e.g. NEURON) + pip install https://api.github.com/repos/jonescompneurolab/hnn-core/zipball/master mpi4py nlopt fi -echo "Installing python packages for HNN with pip..." | tee -a "$LOGFILE" -$PIP install --no-cache-dir --user matplotlib PyOpenGL \ - pyqt5 pyqtgraph scipy numpy nlopt psutil &>> "$LOGFILE" +echo "Downloading runtime prerequisite packages..." | tee -a "$LOGFILE" +apt-get download \ + openmpi-bin lsof libfontconfig1 libxext6 libx11-xcb1 libxcb-glx0 \ + libxkbcommon-x11-0 libgl1-mesa-glx \ + libc6-dev libtinfo-dev libncurses5-dev \ + libx11-dev libreadline-dev \ + libxcb-icccm4 libxcb-util1 libxcb-image0 libxcb-keysyms1 \ + libxcb-render0 libxcb-shape0 libxcb-randr0 libxcb-render-util0 \ + libxcb-xinerama0 &> "$LOGFILE" & +APT_DOWNLOAD=$! # save dir installing hnn to startdir=$(pwd) @@ -115,11 +159,11 @@ if [[ $TRAVIS_TESTING -ne 1 ]]; then cd hnn_source_code if [ -d "$source_code_dir/.git" ]; then - git pull origin master &>> "$LOGFILE" + git pull origin master &> "$LOGFILE" fi else echo "Downloading and extracting HNN..." | tee -a "$LOGFILE" - wget --no-hsts --no-check-certificate -O hnn.tar.gz https://github.com/jonescompneurolab/hnn/releases/latest/download/hnn.tar.gz | tee -a "$LOGFILE" + wget -O hnn.tar.gz https://github.com/jonescompneurolab/hnn/releases/latest/download/hnn.tar.gz | tee -a "$LOGFILE" mkdir hnn_source_code tar -x --strip-components 1 -f hnn.tar.gz -C hnn_source_code &>> "$LOGFILE" && \ cd hnn_source_code &>> "$LOGFILE" @@ -132,10 +176,6 @@ else fi fi -echo "Building HNN..." | tee -a "$LOGFILE" -make -j4 &>> "$LOGFILE" -MAKE_PID=$! - # create the global session variables echo '# these lines define global session variables for HNN' >> ~/.bashrc echo "export PATH=\$PATH:\"$source_code_dir\"" >> ~/.bashrc @@ -147,7 +187,7 @@ if [[ -d "$HOME/Desktop" ]]; then cp -f hnn.desktop "$HOME/Desktop" && \ sed -i "s~/home/hnn_user\(.*\)$~\"$startdir\"\1~g" "$HOME/Desktop/hnn.desktop" && \ chmod +x "$HOME/Desktop/hnn.desktop" - } &>> "$LOGFILE" + } &> "$LOGFILE" fi echo "Installing prerequisites..." | tee -a "$LOGFILE" @@ -160,17 +200,11 @@ sudo -E apt-get install --no-install-recommends -y \ libx11-dev libreadline-dev \ libxcb-icccm4 libxcb-util1 libxcb-image0 libxcb-keysyms1 \ libxcb-render0 libxcb-shape0 libxcb-randr0 libxcb-render-util0 \ - libxcb-xinerama0 libxcb-xfixes0 &>> "$LOGFILE" + libxcb-xinerama0 libxcb-xfixes0 &> "$LOGFILE" # Clean up a little echo "Cleaning up..." | tee -a "$LOGFILE" -sudo -E apt-get clean &>> "$LOGFILE" - -if [[ $TRAVIS_TESTING -ne 1 ]]; then - echo "Waiting for HNN module build to finish..." - NAME="building HNN modules" - wait_for_pid "${MAKE_PID}" "$NAME" -fi +sudo -E apt-get clean &> "$LOGFILE" echo "HNN installation successful" | tee -a "$LOGFILE" echo "Source code is at $source_code_dir" | tee -a "$LOGFILE" diff --git a/installer/windows/hnn-windows.ps1 b/installer/windows/hnn-windows.ps1 index ccb092abf..c8759ffe8 100644 --- a/installer/windows/hnn-windows.ps1 +++ b/installer/windows/hnn-windows.ps1 @@ -6,7 +6,7 @@ install Miniconda: - Miniconda3-latest-Windows-x86_64.exe Additionally the following will be installed if they are not found: - - nrn-7.7.w64-mingwsetup.exe + - nrn-7.8.w64-mingwsetup.exe Other requirements: - Only 64-bit installs are supported due to NEURON compatibility @@ -310,8 +310,8 @@ if ($script:installMiniconda) { $program = "NEURON" if (!(Test-Installed($program))) { - $file = "nrn-7.7.w64-mingwsetup.exe" - $url = "https://neuron.yale.edu/ftp/neuron/versions/v7.7/$file" + $file = "nrn-7.8.w64-mingwsetup.exe" + $url = "https://neuron.yale.edu/ftp/neuron/versions/v7.8/$file" Download-Program $program $file $url $dirpath = $script:NEURON_PATH Write-Host "Installing $program to $dirpath..." @@ -379,6 +379,13 @@ if ($proc1) { Write-Host "Miniconda is finished" } +if ($proc2) { + Write-Host "Waiting for NEURON install to finish..." + $proc2.WaitForExit() 2>$null + Update-User-Paths("$script:NEURON_PATH\bin") + Write-Host "NEURON is finished" +} + # setup python with virtualenv or 'conda if ($null -ne $script:VIRTUALENV) { Write-Host "Creating Python virtualenv at $HOME\venv\hnn..." @@ -390,7 +397,9 @@ if ($null -ne $script:VIRTUALENV) { $script:PYTHON = "$HOME\venv\hnn\Scripts\python.exe" if (Test-Python-3($script:PYTHON)) { # use pip3 for good measure - Start-Process "$HOME\venv\hnn\Scripts\pip3" "install PyOpenGL pyqtgraph matplotlib scipy PyQt5 psutil nlopt" -Wait + Start-Process "$HOME\venv\hnn\Scripts\pip3" "install matplotlib scipy PyQt5 psutil nlopt" -Wait + # get hnn-core, but skip NEURON dependency + Start-Process "$HOME\venv\hnn\Scripts\pip3" "install --no-deps mpi4py hnn-core" -Wait } else { Write-Warning "Virtualenv failed to create a valid python3 environment" @@ -415,14 +424,21 @@ elseif ($null -ne $script:CONDA_PATH) { if (!$script:env_exists) { Write-Host "Setting up anaconda hnn environment..." - conda create -y -n hnn python=3.7 PyOpenGL pyqtgraph matplotlib scipy conda psutil + conda env create -f environment.yml conda install -y -n hnn -c conda-forge nlopt + + # need to call the right pip to install in miniconda environment + # get hnn-core, but skip NEURON dependency + Set-Location $HOME + Miniconda3\envs\hnn\Scripts\pip install --no-deps mpi4py hnn-core + Set-Location $CONDA_ENV mkdir .\etc\conda\activate.d 2>&1>$null mkdir .\etc\conda\deactivate.d 2>&1>$null - #"set NRN_PYLIB=$script:PYTHON_DLL" | Set-Content "$CONDA_ENV\etc\conda\activate.d\env_vars.bat" - "set PYTHONHOME=$CONDA_ENV" | Add-Content "$CONDA_ENV\etc\conda\activate.d\env_vars.bat" + # "set NRN_PYLIB=$script:PYTHON_DLL" | Set-Content "$CONDA_ENV\etc\conda\activate.d\env_vars.bat" + "set PYTHONPATH=$script:NEURON_PATH\lib\python" | Add-Content "$CONDA_ENV\etc\conda\activate.d\env_vars.bat" + "export PYTHONPATH=/c/nrn/lib/python" | Add-Content "$CONDA_ENV\etc\conda\activate.d\env_vars.sh" } else { Write-Host "Miniconda hnn environment already exists" @@ -433,27 +449,6 @@ else { } - -if ($proc2) { - Write-Host "Waiting for NEURON install to finish..." - $proc2.WaitForExit() 2>$null - Update-User-Paths("$script:NEURON_PATH\bin") - Write-Host "NEURON is finished" -} - -if (!(Test-Path "$HNN_PATH\nrnmech.dll" -PathType Leaf)) { - Write-Host "Creating nrnmech.dll" - Set-Location $HNN_PATH\mod - Start-Process "$script:NEURON_PATH\mingw\usr\bin\sh.exe" "$script:NEURON_ESC_PATH/lib/mknrndll.sh C:\nrn\" - $obj = New-Object -com Wscript.Shell - sleep -s 10 - $obj.SendKeys("{ENTER}") - Copy-Item $HNN_PATH\mod\nrnmech.dll -Destination $HNN_PATH -} -else { - Write-Host "nrnmech.dll already exists $HNN_PATH\nrnmech.dll" -} - Write-Host "" Write-Host "Finished installing HNN and prerequisites." Write-Host "Activate the environment from cmd.exe (not Powershell):" diff --git a/installer/windows/wsl.md b/installer/windows/wsl.md index c0edb4825..02ce88d37 100644 --- a/installer/windows/wsl.md +++ b/installer/windows/wsl.md @@ -4,7 +4,7 @@ Below is Microsoft's guide for installing WSL. Note that both WSL 1 and WSL 2 will work with, but **WSL1 is recommended** because the DISPLAY variable will need to be adjusted with WSL 2. -https://docs.microsoft.com/en-us/windows/wsl/install-win10 +[https://docs.microsoft.com/en-us/windows/wsl/install-win10](https://docs.microsoft.com/en-us/windows/wsl/install-win10) Some notes: @@ -35,7 +35,7 @@ bash hnn-ubuntu.sh Some notes: * You'll be asked for the password you created in WSL (above) -* While it gets tested frequently as part of our automated builds, please let us know if you run into a failure by creating a GitHub issue](https://github.com/jonescompneurolab/hnn/issues). +* While it gets tested frequently as part of our automated builds, please let us know if you run into a failure by [creating a GitHub issue](https://github.com/jonescompneurolab/hnn/issues). You will need to **restart Ubuntu** after this. Until you do so, simulations will fail to run from HNN. @@ -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 ``` @@ -85,28 +85,4 @@ If you still want to use WSL, you can just remove the hnn source code directory ## Troubleshooting -### VcXsrv - -Make sure VcXsrv has been updated to at least 1.20.60. Earlier versions can cause the errors below: - -`hnn_docker.sh` would fail: - -```bash -Starting VcXsrv... done -Checking for xauth... found -Checking for X11 authentication keys... *failed* -``` - -`hnn_docker.log` contains: - -```bash -Retrieving host xauth keys... - - ** Command: /c/Program Files/VcXsrv/xauth.exe -f /c/Users/user/.Xauthority -ni nlist localhost:0 - ** Stderr: C:\Program Files\VcXsrv\xauth.exe: (argv):1: bad display name "localhost:0" in "nlist" command -*failed* -``` - -### Other - 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 be able to suggest possible fixes. diff --git a/scripts/setup-travis-osx.sh b/scripts/setup-travis-osx.sh index fc3b123b5..92b1b3226 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 https://api.github.com/repos/jonescompneurolab/hnn-core/zipball/master nlopt \ No newline at end of file