Skip to content

Commit b9c6be4

Browse files
authored
Merge pull request #122 from martinRenou/update_install_versions
Update install versions
2 parents 99fe578 + fd8b869 commit b9c6be4

File tree

5 files changed

+75
-374
lines changed

5 files changed

+75
-374
lines changed

README.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
The code in the tutorial has been written using Python 3; many of the dependencies may not be available for Python 2.7.
1010

11-
We **strongly recommend** using the Anaconda Python distribution. You can install either the full [anaconda distribution](https://www.continuum.io/downloads) (very extensive, but large) or [miniconda](https://conda.io/miniconda.html) (much smaller, only essential packages).
11+
We **strongly recommend** using the conda Python distribution. You can install either [miniconda](https://conda.io/miniconda.html) (much smaller, only essential packages) or the full [anaconda distribution](https://www.continuum.io/downloads) (very extensive, but very, very large).
1212

1313
Almost all of the examples will work in either the regular Jupyter notebook or in JupyterLab. The instructions below assume you will be using JupyterLab.
1414

@@ -22,12 +22,12 @@ You can do this with either `git clone https://github.com/jupyter-widgets/tutori
2222

2323
## conda installation instructions
2424

25-
The steps below will get you a working environment.
25+
The steps below will get you a working environment.
2626

2727
```bash
2828
conda env create -f environment.yml
2929

30-
conda activate widgets-tutorial
30+
conda activate widgets-tutorial-2021
3131

3232
# Create a kernel for this environment
3333
ipython kernel install --name widgets-tutorial --display-name widgets-tutorial --sys-prefix
@@ -47,21 +47,6 @@ pip install -r requirements.txt
4747
ipython kernel install --name widgets-tutorial --display-name widgets-tutorial --sys-prefix
4848
```
4949

50-
## Install JupyterLab extensions
51-
52-
In order to install the JupyterLab extensions, you need `nodejs` to be installed. If you use `conda` it should have been already installed for you when you created your environment.
53-
54-
55-
If you do not use `conda`, see [https://nodejs.org/en/download/](https://nodejs.org/en/download/) or [https://nodejs.org/en/download/package-manager/](https://nodejs.org/en/download/package-manager/) for download and installation instructions.
56-
57-
58-
Now you can install the JupyterLab extensions:
59-
60-
```bash
61-
# This may take several minutes
62-
jupyter labextension install @jupyter-widgets/jupyterlab-manager @jupyter-widgets/jupyterlab-sidecar bqplot jupyter-threejs [email protected] ipysheet ipytree ipycanvas jupyter-matplotlib jupyter-vuetify ipyvolume
63-
```
64-
6550
## Check your installation
6651

6752
To check your installation, please download the script [install_check.py](https://raw.githubusercontent.com/jupyter-widgets/tutorial/master/install_check.py) and run it:

environment.yml

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
1-
name: widgets-tutorial
1+
name: widgets-tutorial-2021
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.8
6-
- pip
7-
- notebook
5+
- bqplot=0.12.29
6+
- ipycanvas=0.9.0
7+
- ipycytoscape=1.2.2
8+
- ipydatagrid=1.0.7
9+
- ipygany=0.5.0
10+
- ipyleaflet=0.14.0
11+
- ipympl=0.7.0
12+
- ipytree=0.2.1
13+
- ipyvolume=0.6.0a8
14+
- ipyvuetify=1.7.0
15+
- ipywidgets=7.6
16+
- jupyterlab=3
817
- numpy
9-
- scikit-image
10-
- scipy
1118
- pandas
19+
- pip
20+
- python=3.8
21+
- pythreejs=2.3.0
1222
- requests
13-
- ipywidgets
14-
- bqplot
15-
- ipyleaflet=0.12.6
16-
- pythreejs
17-
- ipycanvas
18-
- ipyevents
19-
- ipysheet
20-
- ipytree
21-
- ipympl
22-
- pywwt
23-
- sidecar
24-
- voila=0.1
25-
- ipyvuetify
26-
- voila-vuetify
27-
- jupyterlab=2
28-
- ipyvolume=0.6.0a6
29-
- nodejs=13
23+
- scikit-image
24+
- scipy
25+
- sidecar=0.5.1
26+
- voila=0.2.10
27+
- voila-vuetify=0.5.2

install_check.py

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import sys
2+
import logging
13
from subprocess import check_call, CalledProcessError
24

35

4-
FIX_PREFIX = '----->'
6+
SUCCESS_PREFIX = '🎉'
7+
FIX_PREFIX = '⚠️⚠️⚠️ ----->'
58

69
tutorial_name = 'Jupyter widget ecosystem'
710

@@ -12,10 +15,10 @@
1215
'ipyleaflet',
1316
'ipyvolume',
1417
'pythreejs',
15-
'ipyevents',
16-
'ipysheet',
1718
'ipytree',
18-
'pywwt',
19+
'ipydatagrid',
20+
'ipycytoscape',
21+
'ipygany',
1922
'jupyterlab'
2023
]
2124

@@ -35,14 +38,12 @@
3538
success = all(import_result.values())
3639

3740
# List compatible versions for each package
38-
version_check_packages = {'ipywidgets': ['7.5'],
39-
'notebook': ['6'],
40-
'jupyterlab': ['2'],
41-
'ipyvolume': ['0.6.0-alpha.6'],
41+
version_check_packages = {'ipywidgets': ['7.6'],
42+
'jupyterlab': ['3'],
4243
}
4344

4445
if success:
45-
print('\tAll required packages installed')
46+
print(f'\t{SUCCESS_PREFIX} All required packages installed')
4647
else:
4748
print(FIX_PREFIX, 'Please install these missing packages '
4849
'for the tutorial "{}":'.format(tutorial_name))
@@ -53,9 +54,9 @@
5354

5455
try:
5556
check_call(['voila', '--version'])
56-
print('\tVoila is correctly installed')
57+
print(f'\t{SUCCESS_PREFIX} Voila is correctly installed')
5758
except CalledProcessError:
58-
print('\tVoila is not installed! Please install it by running one '
59+
print(f'\t {FIX_PREFIX} Voila is not installed! Please install it by running one '
5960
'of the following:')
6061
print(' conda install -c conda-forge voila')
6162
print(' pip install voila')
@@ -76,7 +77,7 @@ def version_checker(package_name, version, nbextension=None):
7677
print(' conda install {}={} # if you use conda'.format(package_name, newest))
7778
print(' pip install {}=={}'.format(package_name, newest))
7879
else:
79-
print('\t{} version is good!'.format(package_name))
80+
print(f'\t{SUCCESS_PREFIX} {package_name} version is good!')
8081

8182

8283
# Check as many packages as we can...
@@ -90,14 +91,6 @@ def version_checker(package_name, version, nbextension=None):
9091
ipywidgets_version = ipywidgets.__version__
9192
version_checker('ipywidgets', ipywidgets_version)
9293

93-
try:
94-
import notebook
95-
except ImportError:
96-
pass
97-
else:
98-
notebook_version = notebook.__version__
99-
version_checker('notebook', notebook_version)
100-
10194
try:
10295
import jupyterlab
10396
except ImportError:
@@ -106,14 +99,6 @@ def version_checker(package_name, version, nbextension=None):
10699
jupyterlab_version = jupyterlab.__version__
107100
version_checker('jupyterlab', jupyterlab_version)
108101

109-
try:
110-
import ipyvolume
111-
except ImportError:
112-
pass
113-
else:
114-
ipyvolume_version = ipyvolume.__version__
115-
version_checker('ipyvolume', ipyvolume_version)
116-
117102
# Check that the appropriate kernel has been created
118103

119104
required_kernel = 'widgets-tutorial'
@@ -127,7 +112,7 @@ def version_checker(package_name, version, nbextension=None):
127112
print(FIX_PREFIX, 'Please create custom kernel with: ',
128113
'ipython kernel install --name widgets-tutorial --display-name widgets-tutorial --sys-prefix')
129114
else:
130-
print('\tCustom kernel is correctly installed')
115+
print(f'\t{SUCCESS_PREFIX} Custom kernel is correctly installed')
131116

132117
# Check that lab extensions are installed
133118

@@ -140,29 +125,40 @@ def version_checker(package_name, version, nbextension=None):
140125
'jupyter-threejs',
141126
'jupyter-leaflet',
142127
'ipyvolume',
143-
'ipyevents',
144-
'ipysheet',
145128
'ipytree',
146129
'ipycanvas',
130+
'ipydatagrid',
131+
'ipygany',
132+
'jupyter-cytoscape', # for ipycytoscape
147133
'jupyter-matplotlib',
148134
'jupyter-vuetify',
149135
]
150136

137+
151138
try:
152-
from jupyterlab.commands import check_extension
139+
from jupyterlab.commands import check_extension, AppOptions
140+
from jupyterlab_server.config import get_federated_extensions
153141
except ImportError:
154142
print(FIX_PREFIX, 'Please install jupyterlab before checking extensions.')
155143
else:
156144
missing_extensions = []
157145

146+
# Fetch federated extensions
147+
federated_extensions = get_federated_extensions([sys.base_prefix + '/share/jupyter/labextensions']).keys()
148+
149+
# JupyterLab be quiet
150+
logger = logging.Logger('quiet')
151+
logger.setLevel(logging.CRITICAL)
152+
app_options = AppOptions(logger=logger)
153+
158154
for extension in lab_extensions:
159-
if not check_extension(extension):
155+
if not check_extension(extension, app_options=app_options) and extension not in federated_extensions:
160156
missing_extensions.append(extension)
161157

162158
if missing_extensions:
163159
print(FIX_PREFIX, 'These lab extensions are missing: ',
164160
', '.join(missing_extensions))
165-
print(FIX_PREFIX,' Run this to install them: jupyter labextension install ',
166-
' '.join(missing_extensions))
161+
print(FIX_PREFIX,' Please try to install the following packages with conda or pip: ',
162+
', '.join(missing_extensions))
167163
else:
168-
print('\tAll extensions are installed!')
164+
print(f'\t{SUCCESS_PREFIX} All extensions are installed!')

0 commit comments

Comments
 (0)