module win_installer.win_setup_main

Short summary

module pymyinstall.win_installer.win_setup_main

Functions to prepare a setup on Windows

source on GitHub

Functions

function truncated documentation
architecture  
win_python_setup Prepares a Windows distribution of Python based on InnoSetup, inspired from WinPython but more easier to tweak I hope. …

Documentation

Functions to prepare a setup on Windows

source on GitHub

pymyinstall.win_installer.win_setup_main.architecture()[source]
Returns:either 32bit or 64bit

source on GitHub

pymyinstall.win_installer.win_setup_main.win_python_setup(folder='dist/win_python_setup_64bit', download_folder='build/win_python_setup_64bit', module_list=None, verbose=False, fLOG=<built-in function print>, download_only=False, no_setup=False, notebooks=None, selection={'R', 'mingw', 'tdm'}, documentation=True, last_function=None, r_packages=True, julia_packages=True, tutorial=None, source=None)[source]

Prepares a Windows distribution of Python based on InnoSetup, inspired from WinPython but more easier to tweak I hope.

Parameters:
  • folder – where to prepare the python version
  • module_list – list of module to install (see small_installation() = default options)
  • fLOG – logging function
  • download_only – only downloads
  • no_setup – skip the building of the setup
  • verbose – print more information
  • notebooks – notebooks to copy to the workspace, list of (“subfolders”, url)
  • selection – selection of tools to install
  • last_function – function to execute just before running InnoSetup, see win_setup_helper.py for an example
  • r_packages – install R packages
  • julia_packages – install Julia packages
  • documentation – add documentation
  • tutorial – list of folders to copy in workspace/tutorial, it can refer to internal tutorials (see folder win_installer/tutorial)
  • source – source of python packages (see ModuleInstall)
Returns:

list of completed operations

The available tools to install must be chose among:

By default, only R is included. Julia requires too much work. The command line does not always end. The building of the package is sometimes reluctant to work. And the Julia kernel is exclusive: it cannot be setup with others kernel. Maybe the version 0.5 will fix those issues.

The signature of function last_function should be the following:

def last_function(inno_script, folders, verbose=False, fLOG=print):
    # something specific to do
    # before compiling the setup
    # such adding new tools
    # or replacing icons
    # the inno setup script is located in folders["logs"]

The parameters folders is a dictionary which gives access to the main folders of the distribution.

The setup will also contains pandoc, 7z, SQLiteSpy, Scite, MinGW, Graphviz.

The function first downloads everything. It does not do it twice, so you can run the function again and directly go to where it was interrupted. If there is no notebooks, the setup will add some anyway.

It uses InnoSetup to build the setup.

The distribution will contain the following subfolders:

  • tools: subfolders for R, Julia, MinGW, Scite, pandoc, 7z, Putty…
  • python: subfolder for python interpreter
  • workspace: current folder for the notebooks
  • build: location of downloaded modules and tools

Comments and remarks:

  • 7z setup needs a last click to complete

  • pandoc needs a last click to complete

  • R must be manually installed in the right folder

  • TDM-GCC is manually installed in the right folder

  • Julia produces a file exe, for the time being it must be done manually

  • MinGW is also installed manually, the command line is different from others tools, once it is installed, you should run the command line:

    mingw-get install binutils gcc g++ mingw32 fortran gdb mingw32 mingw w32api g77
    
  • Python setups needs a last click to complete

  • Julia command line sometimes gets stuck, the setup needs to be stopped and restarted. It happens while installing the packages and also while building IJulia (the package to use Julia in a notebook). The Julia should be stopped instead of stopping the python script. That trick shows the standard output of Julia.

  • Julia kernel cannot be used with the others: it requires a different configuration which prevents others kernel to be available at the same time. We will skip for the time being.

  • If the R kernel fails to start, you should manually run the script R_install.r.

With Julia, initialisation, installation or building takes time. The function writes a file log.step.<julia_step>.txt to tell the step has completed once. You can remove this file to do it again.

Prepare a standalone distribution

The function downloads everything. The installation of tools is still manual. Package installation is automated.

from pymyinstall import win_python_setup
from pymyinstall.packaged import ensae_fullset
list_modules = ensae_fullset()
win_python_setup(module_list=list_modules,
                verbose=False,
                download_only=False)

This works only for Windows.

Warning

The Julia installation might be stuck after the installation or the build. In that case, the script python should be stopped by stopping the Julia process from the Task Manager and started again. If it has completed, it will go to the next step.

Known issues while preparing the setup:

  • Some modules generates utf-8 encoding errors while being installed. The python scripts stops. It should be started again, it will detect the module was insalled and will go to the next one in the list.
  • The setup are started by the Python script but the user needs to manually click on the final ok button to proceed.

Known issues after the setup is installed:

  • The first run of Spyder after the installation usually fails (failure of python.exe). The second one succeeds. You should run Spyder from the installation setup before compiling the setup.

Known extra steps needed by some modules

Todo

Use chocolatey to process installation.

Todo

Fix Julia installation.

source on GitHub