|
| 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.8, 3.7, 3.6, 3.5 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 | +Alternately, if you want to run the diffpy.pdfgetx software with a specific version of Python, |
| 57 | +we recommend using a virtual environment, such as ``conda``. For example, if you have Anaconda Python installed, |
| 58 | +you can create a conda virtual environment to install the software as follow :: |
| 59 | + |
| 60 | + conda create --name pdfgetx_env numpy matplotlib ipython --python=3.8 |
| 61 | + |
| 62 | +You can choose the name of the environment and python version as you desire. You can choose any of the |
| 63 | +supported Python versions. Then, activate this environment and follow the instructions in the |
| 64 | +next section to install the software :: |
| 65 | + |
| 66 | + conda activate pdfgetx_env |
| 67 | + |
| 68 | +Installation |
| 69 | +------------------------------------------------------------------------ |
| 70 | + |
| 71 | +The diffpy.pdfgetx software is distributed as a Python wheel file, |
| 72 | +which can be obtained from the |
| 73 | +`Columbia Technology Ventures |
| 74 | +<http://innovation.columbia.edu/technologies/m11-120>`__. |
| 75 | +Once all the required software is in |
| 76 | +place, start the command prompt on Windows or a Unix terminal on Linux |
| 77 | +or Mac, navigate to the directory that contains the wheel file and |
| 78 | +execute the following command:: |
| 79 | + |
| 80 | + pip install ./diffpy.pdfgetx-VERSION.whl |
| 81 | + |
| 82 | +Here VERSION needs to be replaced to match the actual filename. It is |
| 83 | +critical that pip installer is from a supported Python version otherwise |
| 84 | +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. |
| 85 | + |
| 86 | +The package provides three programs for PDF conversion, :program:`pdfgetx3`, :program:`pdfgetn3` and :program:`pdfgets3`. To check if they are correctly installed run :: |
| 87 | + |
| 88 | + pdfgetx3 --version |
| 89 | + pdfgetn3 --version |
| 90 | + pdfgets3 --version |
| 91 | + |
| 92 | +This should display the software version, which should agree |
| 93 | +with the VERSION string in the wheel package name. |
| 94 | +The installation also includes a :program:`plotdata` |
| 95 | +command for an easy plotting of text data files. To verify |
| 96 | +if plotdata works, run the ``plotdata --version`` command. |
| 97 | +Finally, a comprehensive test of the installed software can |
| 98 | +be executed using :: |
| 99 | + |
| 100 | + python -m diffpy.pdfgetx.tests.run |
| 101 | + |
| 102 | +.. note:: |
| 103 | + |
| 104 | + Older versions of diffpy.pdfgetx use Python egg format |
| 105 | + instead of Python wheel. |
| 106 | + To install these use the easy_install command as follows:: |
| 107 | + |
| 108 | + python -m easy_install ./diffpy.pdfgetx-VERSION.egg |
| 109 | + |
| 110 | +.. index:: %pdfgetx3 IPython magic |
| 111 | +.. index:: %pdfgetn3 IPython magic |
| 112 | +.. index:: %pdfgets3 IPython magic |
| 113 | + |
| 114 | +IPython magic command |
| 115 | +------------------------------------------------------------------------ |
| 116 | + |
| 117 | +These instructions are intended for `IPython`_ users who would like to |
| 118 | +integrate PDFgetX3, PDFgetN3 and PDFgetS3 into their IPython environment. If |
| 119 | +you don't plan to customize IPython in such way you can safely skip |
| 120 | +this paragraph. |
| 121 | + |
| 122 | +When pdfgetx3 or pdfgetn3 or pdfgets3 is run in interactive mode, it start |
| 123 | +IPython interactive shell and define an extra ``%pdfgetx3``, ``%pdfgetn3`` and ``%pdfgets3`` magic commands within the IPython session. The IPython |
| 124 | +magic commands are not valid Python code, but work in a similar |
| 125 | +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 |
| 126 | +preserving all plots or variables that were already created |
| 127 | +in an IPython session. |
| 128 | + |
| 129 | +The ``%pdfgetx3``, ``%pdfgetn3`` and ``%pdfgets3`` magic commands can be defined |
| 130 | +permanently so they are available in all IPython sessions. To set |
| 131 | +this up |
| 132 | + |
| 133 | +#. find the ``profile_default/ipython_config.py`` file and open it |
| 134 | + in a text editor. If that file does not exists, |
| 135 | + create it first by executing :: |
| 136 | + |
| 137 | + ipython profile create |
| 138 | + |
| 139 | +#. navigate to the paragraph that contains the |
| 140 | + :py:data:`!c.InteractiveShellApp.extensions` and add there |
| 141 | + the following line :: |
| 142 | + |
| 143 | + c.InteractiveShellApp.extensions = ['diffpy.pdfgetx.ipy_magics'] |
| 144 | + |
| 145 | + There must be no leading indent, i.e., the text must start at the |
| 146 | + very first column. |
0 commit comments