Make things as simple as possible, but not any simpler.
- Apt-get Install Python3-prettytable
- Yum Install Python-prettytable
- Install Prettytable Python Download
- Install Prettytable Python3 Ubuntu
—Albert Einstein
The Python Distutils are used to build and install PyTables, so it is fairlysimple to get the application up and running. If you want to install thepackage from sources you can go on reading to the next section.
However, if you want to go straight to binaries that ‘just work’ for the mainplatforms (Linux, Mac OSX and Windows), you might want to use the excellentAnaconda, ActivePython, Canopy distributions. PyTables usually distributes its ownWindows binaries too; go Binary installation (Windows) for instructions.Finally Christoph Gohlke also maintains an excellent suite of a variety ofbinary packages for Windows at his site.
The 'prettytable' module of python was born for this very p. If you ever got into trouble formatting tabular information on the console this video is for you! The 'prettytable' module of python.
- If you have your table data in a database which you can access using a library which confirms to the Python DB-API (e.g. An SQLite database accessible using the sqlite module), then you can build a PrettyTable using a cursor object, like this.
- PrettyTable is a simple Python library designed to make it quick and easy to represent tabular data in visually appealing ASCII tables. It was inspired by the ASCII tables used in the PostgreSQL shell psql.
- Prettytable python title; prettytable in pytho;n; preetytable python column width; prettytable python example; python libary for creating tables; import prettytable; prettytable mac; install prettyTable python 3.9; how to install prettytable python on 3.9; pip install prettytable; datascroller prettytable python; install prettytable.
Installation from source¶
Apt-get Install Python3-prettytable
These instructions are for both Unix/MacOS X and Windows systems. If you areusing Windows, it is assumed that you have a recent version of MS Visual C++compiler installed.A GCC compiler is assumed for Unix, but other compilers should work as well.
Extensions in PyTables have been developed in Cython (see[CYTHON]) and the C language. You can rebuild everything fromscratch if you have Cython installed, but this is not necessary, as the Cythoncompiled source is included in the source distribution.

To compile PyTables you will need a recent version of Python, the HDF5 (Cflavor) library from http://www.hdfgroup.org, and the NumPy (see[NUMPY]) and Numexpr (see [NUMEXPR])packages.
Prerequisites¶
First, make sure that you have
Python >= 3.4 (PyTables-3.5 was the last release with Python 2.7 support)
HDF5 >= 1.8.4 (>=1.8.15 is strongly recommended)
NumPy >= 1.9.3
Numexpr >= 2.6.2
Cython >= 0.21
c-blosc >= 1.4.1 (sources are bundled with PyTables sources but the user canuse an external version of sources using the
BLOSC_DIR
environmentvariable or the –blosc flag of thesetup.py
)
installed (for testing purposes, we are using HDF5 1.8.15, NumPy 1.10.2and Numexpr 2.5.2 currently). If you don’t, fetch and install them beforeproceeding.
Compile and install these packages (but see Windows prerequisites forinstructions on how to install pre-compiled binaries if you are not willingto compile the prerequisites on Windows systems).
For compression (and possibly improved performance), you will need to installthe Zlib (see [ZLIB]), which is also required by HDF5 as well.You may also optionally install the excellent LZO compression library (see[LZO] and Compression issues). The high-performance bzip2compression library can also be used with PyTables (see[BZIP2]).

The Blosc (see [BLOSC]) compression library is embeddedin PyTables, so this will be used in case it is not found in thesystem. So, in case the installer warns about not finding it, do notworry too much ;)
Unix
setup.py will detect HDF5, Blosc, LZO, or bzip2 libraries and includefiles under /usr
or /usr/local
; this will cover mostmanual installations as well as installations from packages. If setup.pycan not find libhdf5, libhdf5 (or liblzo, or libbz2 that you may wish touse) or if you have several versions of a library installed and want touse a particular one, then you can set the path to the resource in theenvironment, by setting the values of the HDF5_DIR
,LZO_DIR
, BZIP2_DIR
or BLOSC_DIR
environmentvariables to the path to the particular resource. You may also specify thelocations of the resource root directories on the setup.py command line.For example:
If your HDF5 library was built as a shared library not in the runtime loadpath, then you can specify the additional linker flags needed to find theshared library on the command line as well. For example:
You may also want to try setting the LD_LIBRARY_PATH
environment variable to point to the directory where the shared librariescan be found. Check your compiler and linker documentation as well as thePython Distutils documentation for the correct syntax or environmentvariable names.It is also possible to link with specific libraries by setting theLIBS
environment variable:
Starting from PyTables 3.2 can also query the pkg-config database tofind the required packages. If available, pkg-config is used by defaultunless explicitly disabled.
To suppress the use of pkg-config:
Yum Install Python-prettytable
or use the USE-PKGCONFIG
environment variable:
Windows
You can get ready-to-use Windows binaries and other development files formost of the following libraries from the GnuWin32 project (see[GNUWIN32]). In case you cannot find the LZO binariesin the GnuWin32 repository, you can find them athttp://sourceforge.net/projects/pytables/files/lzo-win.Once you have installed the prerequisites, setup.py needs to know wherethe necessary library stub (.lib) and header (.h) files are installed.You can set the path to the include and dll directories for the HDF5(mandatory) and LZO, BZIP2, BLOSC (optional) libraries in the environment,by setting the values of the HDF5_DIR
, LZO_DIR
,BZIP2_DIR
or BLOSC_DIR
environment variables to thepath to the particular resource. For example:
You may also specify the locations of the resource root directories on thesetup.py command line.For example:
Conda
Pre-built packages for PyTables are available in the anaconda (default)channel:
The most recent version is usually available in the conda-forgechannel:
The HDF5 libraries and other helper packages are automatically found ina conda environment. During installation setup.py uses the CONDA_PREFIXenvironment variable to detect a conda environment. If detected it willtry to find all packages within this environment. PyTables needs at leastthe hdf5 package:
It is still possible to override package locations using theHDF5_DIR
, LZO_DIR
, BZIP2_DIR
orBLOSC_DIR
environment variables.
When inside a conda environment pkg-config will not work. To disableusing the conda environment and fall back to pkg-config use –no-conda:
When the –use-pkgconfig flag is used, –no-conda is assumed.
Development version (Unix)
Installation of the development version is very similar to installationfrom a source package (described above). There are two main differences:
sources have to be downloaded from the PyTables source repositoryhosted on GitHub. Git (see [GIT]) is used as VCS.The following command create a local copy of latest development versionsources:
sources in the git repository do not include pre-built documentationand pre-generated C code of Cython extension modules. To be able togenerate them, both Cython (see [CYTHON]) andsphinx >= 1.0.7 (see [SPHINX]) are mandatoryprerequisites.
PyTables package installation¶
Once you have installed the HDF5 library and the NumPy and Numexpr packages,you can proceed with the PyTables package itself.
Run this command from the main PyTables distribution directory, includingany extra command line arguments as discussed above:
If the HDF5 installation is in a custom path, e.g. $HOME/hdf5-1.8.15pre7,one of the following commands can be used:
Note
AVX2 support is detected automatically for your machine and, if found,it is enabled by default. In some situations you may want to disableAVX2 explicitly (maybe your binaries have to be exported and run onmachines that do not have AVX2 support). In that case, define theDISABLE_AVX2 environment variable:
To run the test suite, execute any of these commands.
- Unix
In the sh shell and its variants:
or, if you prefer:
Note
the syntax used above overrides original contents of the
PYTHONPATH
environment variable.If this is not the desired behaviour and the user just wants to addsome path before existing ones, then the safest syntax to use isthe following:Please refer to your sh documentation for details.
Windows
Open the command prompt (cmd.exe or command.com) and type:
or:
Both commands do the same thing, but the latter still works on an alreadyinstalled PyTables (so, there is no need to set the
PYTHONPATH
variable for this case).However, before installation, the former is recommended because it ismore flexible, as you can see below.If you would like to see verbose output from the tests simply add the-v flag and/or the word verbose to the first of the command linesabove. You can also run only the tests in a particular test module.For example, to execute just the test_types test suite, you only have tospecify it:You have other options to pass to the
test_all.py
driver:The command above runs every test in the test unit. Beware, it can take alot of time, CPU and memory resources to complete:
The command above shows the versions for all the packages that PyTablesrelies on. Please be sure to include this when reporting bugs:
The command above prints out the evolution of the memory consumption aftereach test module completion. It’s useful for locating memory leaks inPyTables (or packages behind it). Only valid for Linux 2.6.x kernels.And last, but not least, in case a test fails, please run the failing testmodule again and enable the verbose output:
and, very important, obtain your PyTables version information by using the–print-versions flag (see above) and send back both outputs todevelopers so that we may continue improving PyTables.If you run into problems because Python can not load the HDF5 library orother shared libraries.
Unix
Try setting the LD_LIBRARY_PATH or equivalent environment variable topoint to the directory where the missing libraries can be found.
Windows
Put the DLL libraries (hdf5dll.dll and, optionally, lzo1.dll,bzip2.dll or blosc.dll) in a directory listed in your
PATH
environment variable. The setup.py installationprogram will print out a warning to that effect if the librariescan not be found.To install the entire PyTables Python package, change back to the rootdistribution directory and run the following command (make sure you havesufficient permissions to write to the directories where the PyTables fileswill be installed):
Again if one needs to point to libraries installed in custom paths, thenspecific setup.py options can be used:
or:
Of course, you will need super-user privileges if you want to installPyTables on a system-protected area. You can select, though, a differentplace to install the package using the –prefix flag:
Have in mind, however, that if you use the –prefix flag toinstall in a non-standard place, you should properly setup your
PYTHONPATH
environment variable, so that the Python interpreterwould be able to find your new PyTables installation.You have more installation options available in the Distutils package.Issue a:for more information on that subject.
That’s it! Now you can skip to the next chapter to learn how to use PyTables.
Installation with pip¶
Many users find it useful to use the pip program (or similar ones)to install python packages.
As explained in previous sections the user should in any case ensure that alldependencies listed in the Prerequisites section are correctly installed.
The simplest way to install PyTables using pip is the following:
The following example shows how to install the latest stable version ofPyTables in the user folder when a older version of the package is alreadyinstalled at system level:
The –user option tells to the pip tool to install the package inthe user folder ($HOME/.local
on GNU/Linux and Unix systems), while the–upgrade option forces the installation of the latest version even if anolder version of the package is already installed.
Additional options for the setup.py script can be specified using them–install-option:
or:
The pip tool can also be used to install packages from a sourcetar-ball:
To install the development version of PyTables from the develop branch ofthe main git[GIT] repository the command is thefollowing:
A similar command can be used to install a specific tagged version:
Finally, PyTables developers provide a requirements.txt
file thatcan be used by pip to install the PyTables dependencies:
Of course the requirements.txt
file can be used to install onlypython packages. Other dependencies like the HDF5 library of compressionlibraries have to be installed by the user.
Note

Recent versions of Debian and Ubuntu the HDF5 library is installed inwith a very peculiar layout that allows to have both the serial and MPIversions installed at the same time.
PyTables >= 3.2 natively supports the new layout via pkg-config (thatis expected to be installed on the system at build time).
If pkg-config is not available or PyTables is older than version 3.2,then the following command can be used:
or:
Install Prettytable Python Download
Binary installation (Windows)¶
This section is intended for installing precompiled binaries on Windowsplatforms. Binaries are distribution in wheel format, which can be downloadedand installed using pip as described above. You may also find it useful forinstructions on how to install binary prerequisites even if you want tocompile PyTables itself on Windows.
Windows prerequisites¶

First, make sure that you have Python 3, NumPy 1.8.0 and Numexpr 2.5.2 orhigher installed.
To enable compression with the optional LZO library (see theCompression issues for hints about how it may be used to improveperformance), fetch and install the LZO fromhttp://sourceforge.net/projects/pytables/files/lzo-win (choose v1.x forWindows 32-bit and v2.x for Windows 64-bit).Normally, you will only need to fetch that package and copy the includedlzo1.dll/lzo2.dll file in a directory in the PATH environment variable(for example C:WINDOWSSYSTEM) orpython_installation_pathLibsite-packagestables (the last directory maynot exist yet, so if you want to install the DLL there, you should do soafter installing the PyTables package), so that it can be found by thePyTables extensions.
Please note that PyTables has internal machinery for dealing with uninstalledoptional compression libraries, so, you don’t need to install the LZO or bzip2dynamic libraries if you don’t want to.
PyTables package installation¶
On PyPI wheels for 32 and 64-bit versions of Windows and are usually provided. Theyare automatically found and installed using pip:
Install Prettytable Python3 Ubuntu
If a matching wheel cannot be found for your installation, third party built wheelscan be found e.g. at the Unofficial Windows Binaries for Python Extension Packages page. Download the wheelmatching the version of python and either the 32 or 64-bit version and installusing pip:
You can (and you should) test your installation by running the nextcommands:
on your favorite python shell. If all the tests pass (possibly with a fewwarnings, related to the potential unavailability of LZO lib) you already havea working, well-tested copy of PyTables installed! If any test fails, pleasecopy the output of the error messages as well as the output of:
and mail them to the developers so that the problem can be fixed in futurereleases.
You can proceed now to the next chapter to see how to use PyTables.