<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Packages
Pineapple is a self-contained application that includes a copy of Python 3.5. Upon installation, several useful packages are already installed and available for use without further setup. In addition, Pineapple includes commands to help you manage your Python packages.
Preinstalled packages
All of the Python 3.5 standard library packages are available.
The following packages are pre-installed
Step1:  All preinstalled packages
The following is the full list of packages that are pre-installed
Step2:  %require examples
The %require line magic is a streamlined way to list and
install packages. With no arguments it lists all installed
packages together with specific versions (pip freeze).
With arguments it ensures that the correct version of a package
is available. If no version is specified then the latest version
is used.
Versions can be specified using version specifiers. This
lets you specify minimum versions, maximum versions, and more.
See requirement specifier documentation.
Step3:  Best practices
For notebooks designed to be distributed to other Pineapple users,
it is recommended that your notebook be tested on a fresh installation
of the most recent version of Pineapple. Your notebook should
start with %require commands to ensure that the correct packages
are loaded. This also serves as documentation of which packages
your code will use.
To ensure reproducibility, it is recommended that you
specify full exact version numbers for all pure Python
packages that you use. It is recommended to specify minimum versions
of packages for packages that are included in Pineapple by default.
Pineapple copies
Each copy of Pineapple is self-contained. This means you can
duplicate the Pineapple application, play around with packages in the
copy, then delete the copy with no risk of corrupting your current
installation. If you install many packages it is recommended to make
a backup copy of Pineapple with all your packages installed and working for peace of mind.
New versions of Pineapple will start with preinstalled packages but
will no longer have any packages you installed in the old version.
The recommended way to transfer packages to the new installation
is to do %require to get a list of all packages, then paste that
list of packages into a %require in the new installation.
<ASSISTANT_TASK:>
Python Code:
import pineapple
%pip freeze
Explanation: Packages
Pineapple is a self-contained application that includes a copy of Python 3.5. Upon installation, several useful packages are already installed and available for use without further setup. In addition, Pineapple includes commands to help you manage your Python packages.
Preinstalled packages
All of the Python 3.5 standard library packages are available.
The following packages are pre-installed:
numpy
matplotlib
IVisual
End of explanation
import pineapple # required for all subsequent cells
# Use %pip line magic to list all installed packages
%pip list
# Use %pip line magic to download and install a specific package
%pip install unittest2
# New package is not available for import
import unittest2
# You can also uninstall packages
%pip uninstall -y unittest2
Explanation: All preinstalled packages
The following is the full list of packages that are pre-installed:
Cython
decorator
ipykernel
ipython
ipython-genutils
IVisual
Jinja2
jsonschema
jupyter-client
jupyter-core
MarkupSafe
matplotlib
mistune
mock
nbconvert
nbformat
nose
notebook
numpy
path.py
pexpect
pickleshare
pineapple
ptyprocess
py
pycurl
Pygments
pyparsing
python-dateutil
pytz
pyzmq
simplegeneric
six
terminado
tornado
traitlets
wheel
Package management
The easiest way to manage packages is to use the pineapple package.
After importing the module new magic instructions %pip and %require become available.
The %pip line magic command lets you run pip from within your notebook instead of from the command line. pip is the official tool included with
Python for managing packages.
For full documentation see the official documentation.
%pip examples
End of explanation
%require unittest2
import unittest2
%require unittest2==1.1.0
%require unittest2==1.1.0 pip>=7
Explanation: %require examples
The %require line magic is a streamlined way to list and
install packages. With no arguments it lists all installed
packages together with specific versions (pip freeze).
With arguments it ensures that the correct version of a package
is available. If no version is specified then the latest version
is used.
Versions can be specified using version specifiers. This
lets you specify minimum versions, maximum versions, and more.
See requirement specifier documentation.
End of explanation
# On the old version to get installed packages
%require
# On the fresh new copy of Pineapple
# Paste everything in between the single quotes
%require Cython==0.23.1 decorator==4.0.2 ipykernel==4.0.3 ipython==4.0.0 ipython-genutils==0.1.0 IVisual-alt==0.2.3 Jinja2==2.8 jsonschema==2.5.1 jupyter-client==4.0.0 jupyter-core==4.0.4 linecache2==1.0.0 MarkupSafe==0.23 matplotlib==1.4.3 mistune==0.7.1 nbconvert==4.0.0 nbformat==4.0.0 nose==1.3.7 notebook==4.0.4 path.py==8.1 pexpect==3.3 pickleshare==0.5 pineapple==0.4 pip==7.1.2 ptyprocess==0.5 py==1.4.30 pycurl==7.19.5 Pygments==2.0.2 pyparsing==2.0.3 pytest==2.7.2 python-dateutil==2.4.2 pytz==2015.4 pyzmq==14.7.0 setuptools==18.2 simplegeneric==0.8.1 six==1.9.0 terminado==0.5 tornado==4.2.1 traceback2==1.4.0 traitlets==4.0.0 unittest2==1.1.0 wheel==0.24.0
Explanation: Best practices
For notebooks designed to be distributed to other Pineapple users,
it is recommended that your notebook be tested on a fresh installation
of the most recent version of Pineapple. Your notebook should
start with %require commands to ensure that the correct packages
are loaded. This also serves as documentation of which packages
your code will use.
To ensure reproducibility, it is recommended that you
specify full exact version numbers for all pure Python
packages that you use. It is recommended to specify minimum versions
of packages for packages that are included in Pineapple by default.
Pineapple copies
Each copy of Pineapple is self-contained. This means you can
duplicate the Pineapple application, play around with packages in the
copy, then delete the copy with no risk of corrupting your current
installation. If you install many packages it is recommended to make
a backup copy of Pineapple with all your packages installed and working for peace of mind.
New versions of Pineapple will start with preinstalled packages but
will no longer have any packages you installed in the old version.
The recommended way to transfer packages to the new installation
is to do %require to get a list of all packages, then paste that
list of packages into a %require in the new installation.
End of explanation
<END_TASK>