2. Getting started¶
2.1. Installation¶
Numscrypt is currently tested under Windows, Linux and OSX. To install it, type:
pip install numscrypt
from the command prompt. This will also install Transcrypt if it’s not yet there.
You can test your installation as follows:
- Go to directory ../Numscrypt-<version>/numscrypt/development/automated_tests/ndarray
- From the command prompt run transcrypt -b -c -m autotest.py. This will compile the autotests into file autotest.js and put it into the __javascript__ subdirectory. Do NOT go to that directory (there’s no need, stay where you went at point 4)
- From the command prompt run transcrypt -r autotest.py. This will run the autotests with CPython creating file autotest.html that refers to the generated autotest.js file
- Load the autotest.html into your browser, e.g. by clicking on it (tests were done with Chrome). It will load autotest.js, run it and compare the output with what was generated by CPython. It should report no errors
To experiment with Numscrypt yourself:
- Create a directory for your experiments
- Make your own thing there, e.g. experiment1.py
- Compile with transcrypt -b -c -m experiment1.py (The -c is only needed if you use complex numbers)
- Make an HTML page that will load your code in the browser. Use the HTML file generated by the autotest as an example of how to do that
- Load the HTML and and run the JavaSCript
2.1.1. Troubleshooting checklist¶
Problem installing NumPy. To be able to test back to back with CPython, NumPy has to be installed into Python 3.6. On Linux and OSX the simplest way to achieve this, is to use miniconda.
Problem installing Numscrypt into the right version of Python. Numscrypt and Transcrypt require Python 3.6. To be certain that the right version of Python is picked for installation, on Windows install with:
python36 -m pip install Transcrypt
On Linux install with:
python3.6 -m pip install Transcrypt
Preferably use the miniconda installation of Python 3.6 as described earlier in this checklist. Use the –upgrade switch to upgrade rather than first-time install, as described in pip’s documentation.