Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created development install script #67

Merged
merged 2 commits into from Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 2 additions & 22 deletions README.md
Expand Up @@ -2,10 +2,9 @@

Learning to make extensions for JupyterLab and incorporating React.


## Prerequisites

* JupyterLab
- JupyterLab

## Installation

Expand All @@ -14,27 +13,8 @@ For a development install:
```bash

#Create the environment
conda create -n jupyter-vcdat -c cdat/label/v81 -c conda-forge nodejs "python>3" vcs jupyterlab pip nb_conda nb_conda_kernels plumbum
source activate jupyter-vcdat

# Install lazy_import
python -m pip install lazy_import
# Install sidecar
python -m pip install sidecar
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install @jupyter-widgets/jupyterlab-sidecar

# Install the extension
cd ..
git clone https://github.com/CDAT/jupyter-vcdat.git
./install_script.sh
cd jupyter-vcdat
python setup.py install

# To run, got to jupyter-vcdat repo
npm install
npm run build
jupyter lab build
jupyter-labextension install .
jupyter lab

```
Expand Down
49 changes: 49 additions & 0 deletions install_script.sh
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

# References
# http://kvz.io/blog/2013/11/21/bash-best-practices/
# http://jvns.ca/blog/2017/03/26/bash-quirks/

# exit when a command fails
set -o errexit

# exit if any pipe commands fail
set -o pipefail

set -E
set -o functrace
function handle_error {
local retval=$?
local line=${last_lineno:-$1}
echo "Failed at $line: $BASH_COMMAND"
echo "Trace: " "$@"
echo "return code: " "$?"
exit $retval
}
trap 'handle_error $LINENO ${BASH_LINENO[@]}' ERR

CONDA_EXE="$(which conda)"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@William-Hill does this work if conda is a function rather than a actual executable (remember issue you had where cdat_info couldn't find your conda executable for provenance?

$CONDA_EXE create -y -n jupyter-vcdat3 -c cdat/label/v81 -c conda-forge nodejs "python>3" vcs jupyterlab pip nb_conda nb_conda_kernels plumbum
CONDA_BASE=$(conda info --base)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what these line do since conda is assumed to be in your path from path, sourcing conda.sh wont help much.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to source the conda.sh as a workaround because the conda executable was not being found in the child process that the script was running in.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@William-Hill that's my point, how can CONDA_EXE="$(which conda)" or CONDA_BASE=$(conda info --base) work then if it doesn't find the executable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it can find the executable, but not the activate function as mentioned here: conda/conda#7980 (comment)

That's what I used as a reference for my workaround. Sourcing conda.sh makes the activate function available to the process that the script is running in

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the explanation, let's merge.

source $CONDA_BASE/etc/profile.d/conda.sh
conda activate jupyter-vcdat3

# Install lazy_import
python -m pip install lazy_import
# Install sidecar
python -m pip install sidecar
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install @jupyter-widgets/jupyterlab-sidecar


if [[ ! -d "jupyter-vcdat" ]]; then
git clone https://github.com/CDAT/jupyter-vcdat.git
cd jupyter-vcdat
fi

python setup.py install

npm install
npm run build
jupyter lab build
jupyter-labextension install .