Project

General

Profile

Numextension » History » Version 4

Jim Pulokas, 11/29/2020 09:12 PM

1 1 Jim Pulokas
h1. Numextension
2
3
Numextension is a Python module containing a set of functions Leginon needs to operate on Numpy arrays.   Since it is implemented in C rather than in pure Python, the module must be compliled before using.  You can avoid compiling yourself by using one of the provided Windows installers for commonly used versions of Python and Numpy.   For non-standard or newer versions of Python/Numpy, use the instructions below for doing your own compile.
4
5
h2. Pre-compiled Windows Installers
6
7 4 Jim Pulokas
* attachment:numextension-git.win-amd64-py3.8.exe
8
* attachment:numextension-git.win-amd64-py3.9.exe
9 1 Jim Pulokas
10
h2. Compiling Numextension on Windows
11
12
h3. Install Build Tools
13
14
Windows versions of Python and Numpy are developed using Microsoft Visual Studio.  Extension modules written in C should also be compiled with VS. Luckily you do not have to install a full version of Visual Studio.  Compiling a Python extension only requires a minimal set of command line build tools.   These tools are documented here:
15
16
https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-160
17
18
and can be downloaded from here:
19
20
https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019
21
22
h3. Install Python and Numpy you want to compile numextension for
23
24 2 Jim Pulokas
* You may install multiple versions of python, then use the "py" launcher to select which one to use
25
* Download and install Python:  https://www.python.org/downloads/windows/
26
** In the optional installation features, it is recommended to select installing "py launcher" so you can easily select which python version to run on the command line
27
* Use pip on the command line to install numpy, use specific pip for version of python you are installing in (eg. pip3.8, pip3.9, etc)
28
** As of 2020-11-29, there is a bug in Win 10 (update 2004) that prevents some versions of numpy to work correctly. The bug and workaround is detailed here:  https://developercommunity.visualstudio.com/content/problem/1207405/fmod-after-an-update-to-windows-2004-is-causing-a.html
29
** Workaround is to install older version 1.19.3 version of numpy instead of 1.19.4:
30
*** pip3.8 uninstall numpy   (if you already have numpy installed)
31
*** pip3.8 install numpy==1.19.3
32 1 Jim Pulokas
33 2 Jim Pulokas
h3. Compile numextension in a VS native tools command prompt:
34
35
* Search and launch this from start menu:    "x64 Native Tools Command Prompt for VS 2019"
36
* cd to the numextension directory
37
* compile and build a windows installer for your specific Python version.
38
** py -3.8 setup.py bdist_wininst
39
* The new windows installer will be found in the numextension/dist folder