.. _install_popy:

Install |popy|
##################

.. _download_popy:

Downloading |popy|
===================

First, self-register an account with the |popy| product site at https://product.popypkpd.com/register

When logged in with your email address and a password, download the latest binary from https://product.popypkpd.com/releases/

We currently provide a **64-bit version** of |popy| for Windows 10/11. The download file is approximately 300Mb which will take around 6 minutes to download using a broadband connection.

.. note::

    If you have a previous version of |popy| installed, please :ref:`uninstall_popy` before installing the new version.

    
.. _installing_popy:

Installing |popy|
======================

Double-click on the |popy| installer, popy-|version|-win64-installer.exe

The installer places the software in a subdirectory called |popy|. We recommend |popy| is installed in the root directory of the main drive (typically ``c:\PoPy``).

(A local user typically has write access to the c:\\ drive but not to c:\\Program Files unless the user is an administrator.)

The installer will uncompress the |popy| files, just click on the .exe installer and follow the prompts. You will need approx 1.5Gb of disk space, and the install time may take 5 minutes or so depending on the speed of your computer. 

The installer also creates a desktop shortcut and Windows start menu shortcut under the name '|popy|', for the current user only.

The installer makes no changes to the Windows registry and does |not| require admin rights.

.. note::

    It is possible to install |popy| on a usb stick. 
    However due to the way the |python| language operates, |ie| many .py files, this will have a significant performance impact. 
    It is much better to install |popy| on the main hard drive of a computer.

.. _install_activate: 

Activating |popy|
====================

Your |popy| installation can be used for |trial_length| days on a trial period basis. 

To continue using |popy| after this free trial period has expired, pick the type of :ref:`licence<licences>` you require and email us at |email| to get a product key.

When you have the product key, :ref:`open_a_popy_command_prompt` and type:

.. code-block:: console

    popy activate <product_key>
    
to activate your |popy| installation (where "<product_key>" is the product key we sent to you).

.. 
    TODO
    Add instructions for pasting key into a file and calling popy activate


.. _install_check_install: 

Checking your new |popy| Installation
=======================================

|popy| runs from the command line, typically called :term:`command prompt<dos prompt>` under Windows 7/8/9 or :term:`PowerShell<powershell prompt>` under Windows 10.  To access |popy| commands in the current command prompt, type:-

.. code-block:: console

    popy
 
This scripts sets up the environment variables so you can access |popy| commands and displays a quick summary of the commands available. See :ref:`open_a_popy_command_prompt`.

To verify that |popy| is working, execute the command:-

.. code-block:: console

    popy info

If |popy| has successfully installed, output similar to that below will appear, providing detailed information on the installation:-
 
.. literalinclude:: popy_info_output_trial_mode.inc
    :language: console

The output above will vary depending on the :ref:`activation` status of |popy|.

If you want to run more rigorous tests then see :ref:`validate_popy`.


.. _wi10_inc_max_path: 

Win10 Increase max path length
===============================

Note if you use |popy| with deeply nested folder structures it is recommended that you increase the max file path length from the default Windows 10 limit of 260 characters, see here:-

https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

For your convenience we have supplied the registry editor file ``conf/win10_allow_long_paths.reg``.
 
If you are using Windows 10 and have admin privileges, you can simply click on this file to remove the 260 character limit.


.. _install_troubleshooting:

Troubleshooting
==================

Please email us at |email| if you have any problems with this installation process 
so that we can diagnose the fault and issue any necessary bug fixes as soon as possible.

.. only:: browser

    .. _install_first_steps:

    First Steps after Install
    ==========================

    Congratulations, you have installed |popy| on your machine and can now begin to use this powerful population modelling software immediately. 
    
    To setup tabs correctly on your editor see :ref:`configure_editor`.

    See :ref:`simple_fit_example` for a walk through of a simple fitting example.



