Installation of botogram

botogram is available on the Python Packages Index, so you can install it really easily with the pip command-line utility. Before installing it, be sure to have Python 3.4 (or a newer version), pip, virtualenv and setuptools installed on your system. Then, issue the following command:

$ python3 -m pip install botogram2

Perfect, botogram is now installed! Now, you can follow the “tutorial” chapter if you want to create a bot right now!

Living on the edge

If you don’t mind having some instability or bugs, and you want the latest features not yet released, you can clone the botogram git repository, install virtualenv, invoke and execute the installation from source:

$ git clone https://github.com/python-botogram/botogram.git
$ cd botogram
$ invoke install

Remember that something can change without notice, and even be removed, until the feature is released, so don’t use a non-released version in production.

About virtual environments

Installing Python packages globally isn’t a good practice. A large part of the Python community solves this problem with a tool called virtualenv, which creates a small, isolated Python installation for each project. This allows you to experiment in a project without affecting other ones.

In order to create a virtual environment, first of all you need to install virtualenv. Next, you can issue the following command to create a virtual environment in env/:

$ virtualenv -p python3 env

So, you’ve now a virtual environment with Python 3 in it. In order to activate it, you can source into the terminal the bin/activate script:

$ source env/bin/activate

Now, everything you install with pip will be confined in that environment. This means you need to enter the virtual environment every time you want to run the script. When you’re done working in the virtual environment, you can exit by calling the deactivate command:

$ deactivate

Troubleshooting

You might encounter some errors while installing botogram. Here is explained how to fix the most recurring ones:

Insufficient permissions

On some linux systems, you usually don’t have enough privileges to install something globally. In this case, you can ask your system administrator to execute the above command, or you can wrap the command with sudo, if you are allowed to do so:

$ sudo python3 -m pip install botogram2

If you installed from source, you need to use this command instead of the last one:

$ sudo invoke install