This question already has answers here:
How to fill user input for interactive command for "RUN" command?
(2 answers)
Closed 6 months ago.
Part of my Dockerfile is as:
RUN apt-get install -yqq software-properties-common
RUN add-apt-repository ppa:ubuntugis/ppa && apt-get update -yqq
RUN apt-get install -yqq gdal-bin
RUN apt-get install -yqq postgis
I installed postgis repo, then installing postgis, but when it got to the installation step of postgis, I get this prompt on the screen & it's stuck there.
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Configuring tzdata
------------------
Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.
1. Africa 4. Australia 7. Atlantic 10. Pacific 13. Etc
2. America 5. Arctic 8. Europe 11. SystemV
3. Antarctica 6. Asia 9. Indian 12. US
Geographic area:
Does anyone has any idea??
Use RUN DEBIAN_FRONTEND=noninteractive apt-get install -yqq postgis when install postgis to suppress the dialog, or use ARG DEBIAN_FRONTEND=noninteractive which will also not persist to container but still have same effect.
Maybe also refers to https://github.com/docker/docker/issues/4032
Related
I am using Superset v1.5.1, and trying to use the Forecast option. I ran multiple commands, including:
pip --no-cache-dir install pystan==2.19.1.1 && pip install prophet
or
pip install lunarcalendar tqdm "pystan<3.0" && pip install "prophet>=1.0.1, <1.1
in my Superset container, but still, when I try to use Forecast, it doesn't work.
The error Superset shows is the following:
No results were returned for this query
as seen here
The strange part is that, whenever I don't use it, it works just fine, but the moment I turn on the Forecast, it just gives me 0 rows results and done. I guess it comes from Prophet, but I can't seem to figure out what is missing.
No matter what parameters, or data I give, it just returns 0 rows, every time.
No logs in Superset, install works fine.
Using Druid SQL to query Druid.
Any help would be appreciated.
Here in github it was solved - dependencies were messed up:
#ecederstrand: Preinstalling lunarcalendar, tqdm and pystan is necessary because prophet <= 1.0 has a bug that requires these packages to be available when running setup.py to build the package. This was fixed in prophet 1.1 but that version can't be installed along with superset 2.0 due to a version conflict on the holidays package. I just contributed a fix for that conflict in #21091.
In short, add this to your Dockerfile for Superset:
RUN pip install --upgrade pip
RUN pip install lunarcalendar tqdm "pystan<3.0" && pip install > "prophet>=1.0.1, <1.1"
And it will work.
I just struggled for 3 days to get this to work but many of the sources that explain it are somehow misleading. Therefore I share that now.
I was using windows and used the Windows 10 Subsystem for Linux to operate from there:
(instruction on how to activate you can find here https://learn.microsoft.com/en-us/windows/wsl/install-win10)
I first created a virtual machine on google cloud called colav-vm in the geographic zone us-east4-c
Start the VM in google cloud
Opened Ubuntu Linux Terminal:
Type:
gcloud compute ssh colav-vm --zone=us-east4-c -- -L 8888:locahost:8888
Enter Password to connect to it
Install pip:
(found it here: https://askubuntu.com/questions/672808/sudo-apt-get-install-python-pip-is-failing)
(In the connected terminal from the VM)
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python-pip
- Install jupyter_http_over_ws
sudo -i pip install jupyter_http_over_ws
- Run the jupyter-server still on the connected VM:
jupyter serverextension enable --py jupyter_http_over_ws
jupyter notebook \
--NotebookApp.allow_origin='https://colab.research.google.com' \
--port=8888 \
--NotebookApp.port_retries=0
(this should be also a code cell - but the formatting doesn't let me)
Then go to the browser on your local computer and type in " http://localhost:8888/ " to open a Jupyter environment if you have it installed - or go to google Colab and connect to runtime on the top right and type it in there and connect (there you need to add the full line including the token like that:
http://localhost:8888/?token=bd391421b3ec5c08f35ef28e2eb9d01fab6501e341c82e35)
I hope this saves some people some time.
The original sources are from here:
https://research.google.com/colaboratory/local-runtimes.html
https://medium.com/#yufengg/how-to-upgrade-colab-with-more-compute-64d53a9b05dc
(but somehow it confused me and it didn't work for me at least)
We are getting the following error from some of our users:
DataError: time zone "Asia/Qostanay" not recognized
We've found out that the problem was coming from the following SQL query:
SELECT *
FROM "app_foobar"
WHERE (
EXTRACT('hour' FROM "app_foobar"."date" AT TIME ZONE 'Asia/Qostanay') = 0
);
There are two problems:
Timezone definitions change over time. Update Ubuntu timezone data:
sudo apt-get update
sudo apt-get install tzdata
Postgres 11.1 doesn't support this timezone (and some others). Update Postgres to 11.4:
sudo apt-get update
sudo apt-get install postgresql-11
sudo apt-get install postgresql-client-11
Some notes on updating Postgres:
No data migration needed for minor versions (e.g. 11.0 -> 11.4). Only executables are updated.
PostgreSQL will restart (database will be unavailable for a second or two)
The relevant postgresql changelog (https://www.postgresql.org/docs/release/11.2/):
Update time zone data files to tzdata release 2018i for DST law changes in Kazakhstan, Metlakatla, and Sao Tome and Principe. Kazakhstan's Qyzylorda zone is split in two, creating a new zone Asia/Qostanay, as some areas did not change UTC offset. Historical corrections for Hong Kong and numerous Pacific islands.
Synopsis
I'm trying to build a Docker image, but it fails because one of the packages I'm trying to get with apt install prompts the user during the install process. I would like to reply to this prompt, but I can't figure out how to do it non-interactively.
Description
I'm building a Docker image, and my Dockerfile has the following line:
RUN apt install -y texlive-latex-extra
(This package has some LaTeX libraries that I need.)
During installation, this halts with:
Setting up tzdata (2018d-1) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Configuring tzdata
------------------
Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.
1. Africa 6. Asia 11. System V timezones
2. America 7. Atlantic Ocean 12. US
3. Antarctica 8. Europe 13. None of the above
4. Australia 9. Indian Ocean
5. Arctic Ocean 10. Pacific Ocean
Geographic area:
At this point, it is waiting for some input. (There's another prompt after this for selecting timezone—I assume this is important to know for the \today directive in LaTeX files. ¯\_(ツ)_/¯)
How can I answer this non-interactively?
What I've tried so far
I've tried doing this:
apt install -y texlive-latex-extra <(echo 12 && echo 2)
and this:
echo 12 && echo 2 | apt install -y texlive-latex-extra
The first one died with this error:
apt install -y texlive-latex-extra <(echo 12 && echo 9)
and the second one seemed to have no effect.
For reference, here is my Dockerfile up until this point:
FROM ubuntu:latest
RUN apt update && apt upgrade -y && apt install -y curl bzip2 tar make gcc wget gnupg unzip
RUN apt install -y texlive
RUN apt install -y nodejs npm git
RUN npm install -g bower
RUN apt install -y texlive-latex-extra
UPDATE
I found something close here which suggested running apt install with DEBIAN_FRONTEND=noninteractive. This solved my problem sufficiently. :) However, I still would like to know how to respond to prompts, as the solution offered there only offered how to suppress them.
If you want to script a terminal interaction, you could use expect on Linux (that might not be very easy; you need to predict the interactions).
Remember that terminal emulators are complex and arcane things (because terminals like VT100 have been complex). See termios(3), pty(7) and read The Tty demystified.
The specific install prompt mentioned in the question is caused by the package tzdata. I managed to get it configured non-interactively in my docker build by setting these environment variables:
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y texlive-luatex texlive-latex-extra texlive-font
I found this solution over here: https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
I tried to install basemap within Datalab using pip:
%bash
pip install basemap
and got the error:
Downloading/unpacking basemap
Could not find any downloads that satisfy the requirement basemap
Cleaning up... No distributions at all found for basemap
Storing debug log for failure in /root/.pip/pip.log
How do I install extra packages on Datalab if they are not supported by pip?
Use apt-get install. In a cell of your notebook:
%bash
apt-get -y update
apt-get -y install python-mpltoolkits.basemap
Then, remember to restart your kernel (by Reset Session)
Use the following code for this:
%%bash
pip install package_name
You might need to first do
apt-get update
So it gets the updated list of packages.
Basemap doesn't come with the google datalab out of the box.
Note: I use shorthand '!' to indicate a bash command, rather than '%bash' as the google documents usually do.
As of Feb 2019, this works on a fresh google datalab:
Step 1: Install Pre-requisites
!apt-get update && apt-get install -y --allow-unauthenticated build-essential libgeos-3.5.0 libgeos-c1v5 libgeos++-dev
!pip install pyproj pyshp
Step 2: Install the whole package
!pip install https://downloads.sourceforge.net/project/matplotlib/matplotlib-toolkits/basemap-1.0.7/basemap-1.0.7.tar.gz
Step 3: Check the package has been installed correctly
!pip freeze
Step 4: Import the module
from mpl_toolkits.basemap import Basemap
#Lak: You will need to update page 155 of your book - Data Science on the Google Cloud platform as the instructions there won't work; basemap is one of the more difficult packages to get working.
The command suggested by Lak might have worked in the past but it's no longer the case: as of today (Aug 2017) Google Datalab instances reject the command listed here
%bash
echo 'Y' | apt-get install python-mpltoolkits.basemap
outputs the error message:
E: Unable to locate package python-mpltoolkits.basemap
E: Couldn't find any package by regex 'python-mpltoolkits.basemap'
Execution from the shell (vs. notebook) outputs the same error.
After searching various sources I found a fix that worked for me: from the notebook in Datalab I added an update cmd before the actual install, like this:
%bash
echo 'Y' | apt-get update
echo 'Y' | apt-get install python-mpltoolkits.basemap