|
| 1 | +# Install and use locally |
| 2 | + |
| 3 | +**Dyalog version 15.0 or later** and **Python version 3.8+**, and the **jupyterlab** Python package must be installed in order to use the Dyalog Jupyter kernel. |
| 4 | + |
| 5 | +Installing, operating and maintaining a Python installation can be a bit of a chore, especially if you're not a Python developer. If you're coming to this wanting only to use Jupyter for Dyalog APL, here are some step by step instructions for how to set up the whole tool chain from scratch. |
| 6 | + |
| 7 | +If you're a Python developer, or if you're already using a "canned" Python distribution, like [conda](https://docs.conda.io/en/latest/), you probably know what you're doing and can skip this document. |
| 8 | + |
| 9 | +The below instructions show how to install Jupyter and the Dyalog kernel inside a Python "virtual environment". This means that you can keep your Jupyter work separate from any other Python work, current or future. This is usually a good idea when working with Python. |
| 10 | + |
| 11 | +1. Download and install the [Dyalog interpreter](https://www.dyalog.com/download-zone.htm). |
| 12 | +2. Download, and run the official [Python installer](https://www.python.org/downloads/). Ensure you select `Use admin privileges to install Python`, `Add python.exe to PATH`, and `Disable PATH limit`. |
| 13 | +3. Open a terminal (e.g. PowerShell if you're on Windows). Type the following steps into the terminal window. |
| 14 | +4. Create a virtual Python environment with a name of your choosing, e.g. |
| 15 | + ``` |
| 16 | + python -m venv jupy312 |
| 17 | + ``` |
| 18 | +5. Activate the virtual environment -- this is important: |
| 19 | + ``` |
| 20 | + jupy312\Scripts\activate # Windows |
| 21 | + . jupy312/bin/activate # linux, macOS. Note leading dot. |
| 22 | + ``` |
| 23 | + Your terminal prompt should change to have a `(jupy312)` prefix. |
| 24 | +6. [Optional, but recommended] Upgrade `pip` to the latest version: |
| 25 | + ``` |
| 26 | + python.exe -m pip installl --upgrade pip # Windows |
| 27 | + python -m pip installl --upgrade pip # linux, macOS |
| 28 | + ``` |
| 29 | +7. Install `jupyterlab`: |
| 30 | + ``` |
| 31 | + pip install jupyterlab |
| 32 | + ``` |
| 33 | +8. Install the Dyalog kernel Python module: |
| 34 | + ``` |
| 35 | + pip install dyalog-jupyter-kernel |
| 36 | + ``` |
| 37 | +9. Register the kernel with Jupyter: |
| 38 | + ``` |
| 39 | + python -m 'dyalog_kernel' install |
| 40 | + ``` |
| 41 | +10. Start jupyterlab (or notebook): |
| 42 | + ``` |
| 43 | + cd path/to/my/notebooks/ |
| 44 | + jupyter lab # or jupyter notebook |
| 45 | + ``` |
| 46 | +
|
| 47 | +Jupyter lab (and notebook) uses a web interface. It has a drop-down button labeled *New▾* where you can choose to create a new Dyalog APL notebook. You can also navigate to and click on any existing notebook (a file with the `.ipynb` extension) to open it. |
| 48 | +
|
| 49 | +## Troubleshooting |
| 50 | +
|
| 51 | +### Python is not found |
| 52 | +> If you get the message |
| 53 | +> ``` |
| 54 | +> python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. |
| 55 | +> ``` |
| 56 | +> Run the installer again. Make sure to tick **Add Python to environment variables** |
| 57 | +
|
| 58 | +### Cannot assign requsted address |
| 59 | +> If you get the message |
| 60 | +> `OSError: [Errno 99] Cannot assign requested address` |
| 61 | +> try: |
| 62 | +> `jupyter-notebook --ip=0.0.0.0 --port=8080` |
| 63 | +> or some other port number. |
| 64 | +
|
| 65 | +## Entering APL characters |
| 66 | +
|
| 67 | +You can get an APL language bar and enable key-bindings and character compositions using just a [a bookmarklet](https://abrudz.github.io/lb/apl) (a browser bookmark that contains commands which add new features to the browser). After adding the bookmarklet to your language bar, and opening a Jupyter notebook document in your browser, click on the bookmarklet. You can now insert APL characters in three ways: |
| 68 | +
|
| 69 | +1. Click a symbol on the language bar. |
| 70 | +1. Type *Backtick* (`` ` ``) and then the associated symbol (hover over symbols on the language bar to see associations), e.g. *Backtick*+*r* makes `⍴` and *Backtick*+*Shift*+*e* makes `⍷`. |
| 71 | +1. Type two symbols which roughly make up the APL symbol, then press the *Tab* key to combine them. The two symbols are chosen to be easy to guess according to one of the following systems: |
| 72 | + 1. The symbols roughly make up the APL symbol when overlaid. For example, `O-` *Tab* makes `⊖` and `A|`*Tab* makes `⍋`. |
| 73 | + 1. The symbols roughly make up the APL symbol when juxtaposed. For example, `<>` *Tab* makes `⋄` and `[]` *Tab* makes `⎕` |
| 74 | + 1. The symbols are identical, and are visually similar to the APL symbol. For example, `ee` makes `∊` and `xx` makes `×`. |
0 commit comments