module installhelper.install_cmd_helper

Short summary

module pymyinstall.installhelper.install_cmd_helper

Various function to install various python module from various location.

source on GitHub

Functions

function

truncated documentation

add_shortcut_to_desktop_for_module

Adds a shortcut on a module which includes a script.

get_conda_program

Gets conda executable and fixes an issue with Pandoc.

get_file_modification_date

Gets the date modification for a filename.

get_pip_program

Gets pip executable and fixes an issue with Pandoc.

get_python_program

Returns the executable for python.

has_pip

Tells if pip is installed.

is_conda_distribution

Tells if it is a conda distribution or not, check the presence of Continuum Analytics or |Anaconda

python_version

Retrieves the platform and version of this python.

run_cmd

Runs a command line and waits for the results, run_cmd_private().

unzip_files

Unzip files from a zip archive.

update_pip

Updates pip for a specific distribution.

Documentation

Various function to install various python module from various location.

source on GitHub

pymyinstall.installhelper.install_cmd_helper.add_shortcut_to_desktop_for_module(name)

Adds a shortcut on a module which includes a script.

Parameters:

name – name of the module

Returns:

shortcut was added or not

source on GitHub

pymyinstall.installhelper.install_cmd_helper.get_conda_program(exe=None)

Gets conda executable and fixes an issue with Pandoc.

Parameters:

exe – path to python executable

Returns:

conda executable

source on GitHub

pymyinstall.installhelper.install_cmd_helper.get_file_modification_date(filename)

Gets the date modification for a filename.

Parameters:

filename – filename

Returns:

datetime

source on GitHub

pymyinstall.installhelper.install_cmd_helper.get_pip_program(exe=None)

Gets pip executable and fixes an issue with Pandoc.

Parameters:

exe – path to python executable

Returns:

pip executable

How can I check the dependencies?

The module pipdeptree gives you something like:

d3py==0.2.3
- ipython [installed: 3.1.0]
- networkx [installed: 1.9.1]
    - decorator [required: >=3.4.0, installed: 3.4.2]
- numpy [installed: 1.9.2]
- pandas [installed: 0.16.0]
    - pytz [required: >=2011k, installed: 2015.4]
    - python-dateutil [required: >=2, installed: 2.4.2]
    - six [required: >=1.5, installed: 1.9.0]
    - numpy [required: >=1.7.0, installed: 1.9.2]
autopep8==1.1.1
- pep8 [required: >=1.5.7, installed: 1.5.7]
sphinxjp.themes.basicstrap==0.4.2
- setuptools
- Sphinx [installed: 1.3.1]
    - alabaster [required: >=0.7, installed: 0.7.4]
    - six [required: >=1.4, installed: 1.9.0]
    - colorama [installed: 0.3.3]
    - Pygments [required: >=2.0, installed: 2.0.2]
    - Babel [required: >=1.3, installed: 1.3]
    - pytz [required: >=0a, installed: 2015.4]
    - snowballstemmer [required: >=1.1, installed: 1.2.0]
    - docutils [required: >=0.11, installed: 0.12]
    - sphinx-rtd-theme [required: >=0.1, installed: 0.1.8]
    - Sphinx [required: >=1.3, installed: 1.3.1]
        - alabaster [required: >=0.7, installed: 0.7.4]
        - six [required: >=1.4, installed: 1.9.0]
        - colorama [installed: 0.3.3]
        - Pygments [required: >=2.0, installed: 2.0.2]
        - Babel [required: >=1.3, installed: 1.3]
        - pytz [required: >=0a, installed: 2015.4]
        - snowballstemmer [required: >=1.1, installed: 1.2.0]
        - docutils [required: >=0.11, installed: 0.12]
        - Jinja2 [required: >=2.3, installed: 2.7.3]
        - MarkupSafe [installed: 0.23]
    - Jinja2 [required: >=2.3, installed: 2.7.3]
    - MarkupSafe [installed: 0.23]

...

source on GitHub

pymyinstall.installhelper.install_cmd_helper.get_python_program()

Returns the executable for python.

New in version 1.1.

source on GitHub

pymyinstall.installhelper.install_cmd_helper.has_pip()

Tells if pip is installed.

Returns:

boolean

source on GitHub

pymyinstall.installhelper.install_cmd_helper.is_conda_distribution()

Tells if it is a conda distribution or not, check the presence of Continuum Analytics or |Anaconda in sys.version.

Returns:

boolean

New in version 1.1.

source on GitHub

pymyinstall.installhelper.install_cmd_helper.python_version()

Retrieves the platform and version of this python.

Returns:

tuple, example: (“win32”,”32bit”) or (“win32”,”64bit”)

source on GitHub

pymyinstall.installhelper.install_cmd_helper.run_cmd(cmd, sin='', shell=False, wait=False, log_error=True, stop_running_if=None, encerror='ignore', encoding='utf8', change_path=None, communicate=True, preprocess=True, timeout=None, catch_exit=False, fLOG=None, tell_if_no_output=None, old_behavior=False)

Runs a command line and waits for the results, run_cmd_private.

source on GitHub

pymyinstall.installhelper.install_cmd_helper.unzip_files(zipf, whereTo, fLOG=<built-in function print>)

Unzip files from a zip archive.

Parameters:
  • zipf – archive

  • whereTo – destination folder

  • fLOG – logging function

Returns:

list of unzipped files

source on GitHub

pymyinstall.installhelper.install_cmd_helper.update_pip(python_path=None, fLOG=<built-in function print>)

Updates pip for a specific distribution.

Parameters:
  • python_path – python path (or sys.executable if None)

  • fLOG – logging function

Returns:

output

The command python -m pip install -U pip or pip install --upgrade pip might fail on Windows due to very long paths (see Upgrading pip fails on Windows when install path is too long). If that happens, assuming the module pymyinstall was installed with pip, we can now remove pip and use get_pip.py instead. This part requires pyquickhelper.

We try the url bootstrap.pypa.io/get-pip.py first then a local copy.

source on GitHub