Package shorttext runs in Python 3.6, 3.7, and 3.8. However, for Python>=3.7, the backend of keras cannot be Tensorflow.

To install the package in Linux or OS X, enter the following in the console:

pip install -U shorttext

It is very possible that you have to do it as root, that you have to add sudo in front of the command.

On the other hand, to get the development version on Github, you can install from Github:

pip install -U git+

By adding -U in the command, it automatically installs the required packages. If not, you have to install these packages on your own.

Backend for Keras

The package keras (version >= 2.0.0) uses either Tensorflow, Theano, or CNTK as the backend, while Theano is usually the default. However, it is highly recommended to use Tensorflow as the backend. Users are advised to install the backend Tensorflow (preferred for Python 2.7, 3.5, and 3.6) or Theano (preferred for Python 3.7) in advance. Refer to Frequently Asked Questions (FAQ) for how to switch the backend. It is also desirable if the package Cython has been previously installed.

Possible Solutions for Installation Failures

Most developers can install shorttext with the instructions above. If the installation fails, you may try one (or more) of the following:

  1. Installing Python-dev by typing:
pip install -U python3-dev
  1. Installing gcc by entering
apt-get install libc6

Required Packages

  • Numpy (Numerical Python, version >= 1.16.0)
  • SciPy (Scientific Python, version >= 1.2.0)
  • Scikit-Learn (Machine Learning in Python, version >= 0.23.0)
  • keras (Deep Learning Library for Theano and Tensorflow, version >= 2.3.0)
  • gensim (Topic Modeling for Humans, version >= 3.8.0)
  • Pandas (Python Data Analysis Library, version >= 1.0.0)
  • snowballstemmer (Snowball Stemmer, version >= 2.0.0)
  • TensorFlow (TensorFlow, version >= 2.0.0)
  • Flask (Flask, version >= 1.1.0)
  • Joblib (Joblib: lightweight Python pipelining, version >= 0.14)

Home: Homepage of shorttext