|  | 
|  | 1 | +Installation | 
|  | 2 | +======================================================================== | 
|  | 3 | + | 
|  | 4 | +.. include:: abbreviations.txt | 
|  | 5 | + | 
|  | 6 | +Software requirements | 
|  | 7 | +------------------------------------------------------------------------ | 
|  | 8 | + | 
|  | 9 | +This software is written in Python programming language, therefore | 
|  | 10 | +you must have Python 3.7, 3.6, 3.5, 3.4 or 2.7 installed.  In addition, | 
|  | 11 | +the following third-party Python libraries are also required: | 
|  | 12 | + | 
|  | 13 | +* pip - Python package installer | 
|  | 14 | +* setuptools - tools for installing Python packages | 
|  | 15 | +* six - Python 2 and 3 compatibility library | 
|  | 16 | +* NumPy - library for scientific computing with Python | 
|  | 17 | +* matplotlib - Python plotting library | 
|  | 18 | +* IPython - enhanced interactive Python shell | 
|  | 19 | + | 
|  | 20 | +Standard Python releases can be obtained from | 
|  | 21 | +https://www.python.org/downloads. | 
|  | 22 | +The third-party libraries can be found at the | 
|  | 23 | +`Python Package Index <https://pypi.org>`__ | 
|  | 24 | +or using any Internet search engine. | 
|  | 25 | + | 
|  | 26 | +Another more convenient option is to obtain one of the science-oriented | 
|  | 27 | +Python distributions such as | 
|  | 28 | +`Anaconda Python`_, | 
|  | 29 | +`Enthought Canopy <https://www.enthought.com/>`_ or | 
|  | 30 | +`PythonXY <https://python-xy.github.io/>`_, | 
|  | 31 | +These distributions already include all the necessary libraries, so the | 
|  | 32 | +required Python software can be all installed in one step. | 
|  | 33 | + | 
|  | 34 | +On Linux operating systems the third-party libraries are usually | 
|  | 35 | +included in a system software repository.  For example on an | 
|  | 36 | +Ubuntu Linux computer the software dependencies can be all installed | 
|  | 37 | +with a single shell command :: | 
|  | 38 | + | 
|  | 39 | +  sudo apt-get install \ | 
|  | 40 | +    python3-pip python3-setuptools python3-six \ | 
|  | 41 | +    python3-numpy python3-matplotlib ipython3 | 
|  | 42 | + | 
|  | 43 | +This may be, of course, as well accomplished using the GUI | 
|  | 44 | +driven Synaptic package manager.  Other Linux | 
|  | 45 | +distributions may use different software management tools, | 
|  | 46 | +but the names of the necessary packages should be very similar | 
|  | 47 | +to those above. | 
|  | 48 | + | 
|  | 49 | +On Windows operating system, it may be necessary to add the | 
|  | 50 | +``C:\Python37`` directory and the scripts directory | 
|  | 51 | +``C:\Python37\Scripts`` to the system :envvar:`!PATH`. Some Python | 
|  | 52 | +distributions already do so as a part of their installation process. The | 
|  | 53 | +easiest way to check is to start the :program:`Command Prompt`, type | 
|  | 54 | +there ``python`` and see if this starts the Python interpreter. | 
|  | 55 | + | 
|  | 56 | + | 
|  | 57 | +Installation | 
|  | 58 | +------------------------------------------------------------------------ | 
|  | 59 | + | 
|  | 60 | +The diffpy.pdfgetx software is distributed as a Python wheel file, | 
|  | 61 | +which can be obtained from the | 
|  | 62 | +`Columbia Technology Ventures | 
|  | 63 | +<http://innovation.columbia.edu/technologies/m11-120>`__. | 
|  | 64 | +Once all the required software is in | 
|  | 65 | +place, start the command prompt on Windows or a Unix terminal on Linux | 
|  | 66 | +or Mac, navigate to the directory that contains the wheel file and | 
|  | 67 | +execute the following command:: | 
|  | 68 | + | 
|  | 69 | +  pip install ./diffpy.pdfgetx-VERSION.whl | 
|  | 70 | + | 
|  | 71 | +Here VERSION needs to be replaced to match the actual filename. It is | 
|  | 72 | +critical that pip installer is from a supported Python version otherwise | 
|  | 73 | +the program would not work. On Linux and Mac operating systems the installation may need to run with root user privileges, for example, by prepending ``sudo`` to the command line above. If root access is not available, use the ``pip install`` options :option:`!--user` or :option:`!--prefix` to install the software to a user-writable directory. | 
|  | 74 | + | 
|  | 75 | +The package provides three programs for PDF conversion, :program:`pdfgetx3`, :program:`pdfgetn3` and :program:`pdfgets3`. To check if they are correctly installed run :: | 
|  | 76 | + | 
|  | 77 | +  pdfgetx3 --version | 
|  | 78 | +  pdfgetn3 --version | 
|  | 79 | +  pdfgets3 --version | 
|  | 80 | + | 
|  | 81 | +This should display the software version, which should agree | 
|  | 82 | +with the VERSION string in the wheel package name. | 
|  | 83 | +The installation also includes a :program:`plotdata` | 
|  | 84 | +command for an easy plotting of text data files.  To verify | 
|  | 85 | +if plotdata works, run the ``plotdata --version`` command. | 
|  | 86 | +Finally, a comprehensive test of the installed software can | 
|  | 87 | +be executed using :: | 
|  | 88 | + | 
|  | 89 | +  python -m diffpy.pdfgetx.tests.run | 
|  | 90 | + | 
|  | 91 | +.. note:: | 
|  | 92 | + | 
|  | 93 | +   Older versions of diffpy.pdfgetx use Python egg format | 
|  | 94 | +   instead of Python wheel. | 
|  | 95 | +   To install these use the easy_install command as follows:: | 
|  | 96 | + | 
|  | 97 | +      python -m easy_install ./diffpy.pdfgetx-VERSION.egg | 
|  | 98 | + | 
|  | 99 | +.. index:: %pdfgetx3 IPython magic | 
|  | 100 | +.. index:: %pdfgetn3 IPython magic | 
|  | 101 | +.. index:: %pdfgets3 IPython magic | 
|  | 102 | + | 
|  | 103 | +IPython magic command | 
|  | 104 | +------------------------------------------------------------------------ | 
|  | 105 | + | 
|  | 106 | +These instructions are intended for `IPython`_ users who would like to | 
|  | 107 | +integrate PDFgetX3, PDFgetN3 and PDFgetS3 into their IPython environment.  If | 
|  | 108 | +you don't plan to customize IPython in such way you can safely skip | 
|  | 109 | +this paragraph. | 
|  | 110 | + | 
|  | 111 | +When pdfgetx3 or pdfgetn3 or pdfgets3 is run in interactive mode, it start | 
|  | 112 | +IPython interactive shell and define an extra ``%pdfgetx3``, ``%pdfgetn3`` and ``%pdfgets3`` magic commands within the IPython session.  The IPython | 
|  | 113 | +magic commands are not valid Python code, but work in a similar | 
|  | 114 | +fashion as standard shell commands.  The ``%pdfgetx3``, ``%pdfgetn3`` and ``%pdfgets3`` magics can be thus used with the same options and arguments as if run from the shell.  This is useful for processing more files, while | 
|  | 115 | +preserving all plots or variables that were already created | 
|  | 116 | +in an IPython session. | 
|  | 117 | + | 
|  | 118 | +The ``%pdfgetx3``, ``%pdfgetn3`` and ``%pdfgets3`` magic commands can be defined | 
|  | 119 | +permanently so they are available in all IPython sessions.  To set | 
|  | 120 | +this up | 
|  | 121 | + | 
|  | 122 | +#.  find the ``profile_default/ipython_config.py`` file and open it | 
|  | 123 | +    in a text editor.  If that file does not exists, | 
|  | 124 | +    create it first by executing :: | 
|  | 125 | + | 
|  | 126 | +      ipython profile create | 
|  | 127 | + | 
|  | 128 | +#.  navigate to the paragraph that contains the | 
|  | 129 | +    :py:data:`!c.InteractiveShellApp.extensions` and add there | 
|  | 130 | +    the following line :: | 
|  | 131 | + | 
|  | 132 | +      c.InteractiveShellApp.extensions = ['diffpy.pdfgetx.ipy_magics'] | 
|  | 133 | + | 
|  | 134 | +    There must be no leading indent, i.e., the text must start at the | 
|  | 135 | +    very first column. | 
0 commit comments