We help IT Professionals succeed at work.
Research Question

How do I install Thumbor in my Ubuntu 20.04 LTS server?

Last Modified: 2020-11-22
I currently attempting to install Thumbor on my Ubuntu 20.04 LTS server. I am going over their docs from their git hub repository, and they are not helpful.

Link to their docs:

I was not able to add the repository as its mentioned in the docs, therefore could not continue the installation.

Then, I decided to search the web, and I found some tutorials, but these were for Ubuntu 16.04, I thought, what the hell, lemme give it a shot:


This tutorial is out of date, naturally, since the code and steps in this tutorial are for python2, however, 20.04 LTS now ships with python 3 out of the box, i was able to install thumbor, but it did not work. The reason, thumbor only works with python 2.7, again source:


Now, I also had to uninstall the python3-opencv package, since it uses python3. I was able to follow some tutorials on how to install opencv, but so-far getting errors:


I have installed python2.7 on my machine, but now, I have no idea where to go and what to do. Any help will be appreciated.

Watch Question

David FavorFractional CTO
Distinguished Expert 2019

Fairly straight forward.

Likely you'll change all script references from python -> python2, as Ubuntu Focal installs both python2 + python3 by default.

Be very careful about how you much around with default python interpreter settings.

Best to change python -> python2 in Thumbor scripts/programs, rather than changing the default python interpreter.

OpenCV is a bear to get working. Just follow the install OpenCV instructions above, if you must have opencv 3.3 installed.

If version 4.2 will work (default packages built for Ubuntu Focal), install OpenCV packages.

Tip: All these questions are likely better asked of the Thumbor developers than EE, as you'll have many additional questions as you go through this process.

https://github.com/thumbor/thumbor appears to be the home of this project.
Nitesh PatelApplication Developer II


sounds like thumbor is going to be a pain the butt to install. I may explore other image cdns before proceeding with this one.

Its just that the process seems so convoluted and the docs are not upto date. would you have any recommendations?
David FavorFractional CTO
Distinguished Expert 2019

Suggestion: Open another question describing your application + general type of images you'll be using.

Likely you'll have lots of suggestions about how to solve your specific problem.

For example, if you use .jpeg images, simple solution is to run them all through mozjpeg, which massively crushes images, preserving HD quality, then run HTTP2, so all assets/files/images serve over a single multiplexed connection, then just use responsive <divs> to serve images, so they auto-scale for an Desktop or Mobile device.

if pip is not installed on your system, add it : "sudo apt install python-pip"

then run "pip install thumbor"

... or tell us why you were unable to add the repository. it should have worked unless you messed up somewhere but we cannot help unless you tell us what you typed and what happened. the software manager also allows to do that from within the gui.
Nitesh PatelApplication Developer II



I ran the command "pip3 install thumbor" , I got the message "Successfully installed thumbor-6.7.5"

then, I executed the command "thumbor --help", that worked, it showed me all the flags and their descriptions, next i decided to enable the logging and executed the command "thumbor --log-level debug", and I got the following error:

Traceback (most recent call last):
  File "/usr/local/bin/thumbor", line 8, in <module>
  File "/usr/local/lib/python3.8/dist-packages/thumbor/server.py", line 148, in main
    validate_config(config, server_parameters)
  File "/usr/local/lib/python3.8/dist-packages/thumbor/server.py", line 82, in validate_config
    raise RuntimeError(
RuntimeError: No security key was found for this instance of thumbor. Please provide one using the conf file or a security key file.


this error pertains to the basic thumbor setup. sorry, i do not use thumbor but i assume you skipped some initial srtup.steps...
Nitesh PatelApplication Developer II


Well, so, searching the web, i come across this page:

https://github.com/thumbor/thumbor/issues/1035 , which I have included in the original post, and the page indicates why the errors are propping up.

i would first make sure there is a key and config file and then consider installing an earlier version of python. ( "apt install python27" i guess unless you already have a python2 variant installed )

normally pip handles dependencies so it should have complained if thumbor is actually still incompatible with python 3 ( the github thread is 2 years old so things may have changed since then )

if you have to go back to python2, you may need to reinstall with pip2 so dependent bundles are automagically handled in python2.
Application Developer II
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)

thanks for sharing what you found out.
David FavorFractional CTO
Distinguished Expert 2019

OpenCV Note: Installing opencv from source... is a serious adventure...

If possible install opencv from sort of packaging provided by your Distro.
Jan Östlundjannej@mac.com
Thanks for sharing Nitesh! Have the same problems too. I have followed the instructions and have Python2 and pip2 including pycurl running on my Ubtuntu 20.04 machine. Thumbor starts however no modules are not available. Did you see this error?

2020-11-20 10:55:40 thumbor:WARNING Module thumbor.filters.round_corner could not be imported: cannot import name _round_corner
2020-11-20 10:55:40 thumbor:WARNING Module thumbor.filters.noise could not be imported: cannot import name _noise
2020-11-20 10:55:40 thumbor:WARNING Module thumbor.filters.watermark could not be imported: cannot import name _alpha
2020-11-20 10:55:40 thumbor:WARNING Module thumbor.filters.equalize could not be imported: cannot import name _equalize
2020-11-20 10:55:40 thumbor:WARNING Module thumbor.filters.fill could not be imported: cannot import name _fill
2020-11-20 10:55:40 thumbor:WARNING Module thumbor.filters.sharpen could not be imported: cannot import name _sharpen
2020-11-20 10:55:40 thumbor:WARNING Module thumbor.filters.frame could not be imported: cannot import name _nine_patch
2020-11-20 10:55:40 thumbor:WARNING Module thumbor.filters.convolution could not be imported: cannot import name _convolution
2020-11-20 10:55:40 thumbor:WARNING Module thumbor.filters.blur could not be imported: cannot import name _convolution
2020-11-20 10:55:40 thumbor:WARNING Module thumbor.filters.saturation could not be imported: cannot import name _saturation
2020-11-20 10:55:40 thumbor:WARNING Module thumbor.filters.curve could not be imported: cannot import name _curve
2020-11-20 10:55:40 thumbor:WARNING Error importing bounding_box filter, trimming won't work
David FavorFractional CTO
Distinguished Expert 2019
@Jan, best top open a new question as the problem you're seeing is different than is covered in this question.
Nitesh PatelApplication Developer II


Hello Jan,

I did come across that, i think I had to modify my conf file to load those filters. Here is my .conf file, try  this and let me know if this works for you:


Keep in mind that I am loading my images from a folder on the server, so the config is set to look at that image folder for images, not sure how you are loading or getting your images, therefore, you might need to change that setting.
Jan Östlundjannej@mac.com
Thanks Nitesh, I appreciate it!

I actually got it to work on a virtual box on my dev machine, however I clould not make work on the acual server.

Seems like there has to be a couple of graphics libraries installed before executing "pip install thumbor" since it seems like some compilation is done them. If they are not present Thumbor will install but it will no work well.

Anyway, I gave up and installed it on a Ubuntu 18.04 machine. Took less than 15 minutes. Hope they will sort out version 7.0 and the Python 3 support eventually, right now it's a total mess. However, my hopes are low and I guess I have to look elsewhere sooner or later...
i used to do that some years ago with a rather simple php script lauched as a 404 errordocument. maybe 30 lines or so.

the script would receive something like

the script would generate the thumbnail based on the original image and the required size, store it, and also send the image to the browser.

once the thumb is generated, it stays there so the next call to the same url can directly be served without even calling the script.

you probably can setup a similar mechanism in less time than you spent getting thumbor to run if you can code a little.
Jan Östlundjannej@mac.com
That's the way I am doing it today with a smart Nginx rewrite route if the image exists on the server, so PHP is not even executed.

However, in this project, the requirements are a bit more comprehensive. The images are stored on S3. The app is deployed as a serverless app, so I cannot store anything locally. Further, it needs to be secured with some mechanism. Now an attacker can guess URLs and crash the server. Face-detection is a hard requirement and not possible in PHP (you could maybe do this with Sharp CLI and PHP). Chopped off heads do not look nice even on the mobile. ;-)

I would go for Imgix if I have the money to spend, maybe in the future.
i am unsure i get the part where the app is serverless. thumbor pretty much acts as a server, nginx as well... ?


it is relatively easy to achieve mild security :


TOKEN would be for example the hash of the image name combined with a secret. that is rather mild security but good enough for such cases. you can change the secret periodically.


face detection can be achieved in whatever language but is not trivial. anyway the concept does not rely on a language or other so you can use whatever you want.

all the best to you and your project

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions