Building Docker image : ''Unable to locate package libxcb-util1'' - build

I am trying to build a Docker image but when I build it, I get the error message : 'E: Unable to locate package libxcb-util1'.
Here is my Dockerfile :
`# $DEL_BEGIN`
FROM python:3.9.7-buster
WORKDIR /prod
COPY design_interface design_interface
COPY requirements.txt requirements.txt
COPY setup.py setup.py
RUN pip install --upgrade pip
RUN apt-get update && apt install --assume-yes apt-utils
RUN apt-get update && pip install .
RUN apt-get update && pip install opencv-python
RUN apt-get update && apt install --assume-yes libxcb-icccm4
RUN apt-get update && apt install --assume-yes libxcb-image0
RUN apt-get update && apt-get install libxcb-util1
CMD ["python3","design_interface/MainWindow.py"]
`# $DEL_END`
The error message is :
Step 11/12 : RUN apt-get update && apt-get install libxcb-util1
---> Running in a6000629d968
Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://security.debian.org/debian-security buster/updates InRelease
Hit:3 http://deb.debian.org/debian buster-updates InRelease
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libxcb-util1
The command '/bin/sh -c apt-get update && apt-get install libxcb-util1' returned a non-zero code: 100
What is more difficult to understand is why the command line 'sudo apt-get update && apt-get install libxcb-util1' works well on my computer but does not work when building the Docker image with the Dockerfile.

The only solution that I found was to download the file online, and then put it manually in the project repository : design_interface/libxcb-util1_0.4.0-0ubuntu3_amd64.deb.
Then I added in the dockerfile the line : RUN dpkg -i design_interface/libxcb-util1_0.4.0-0ubuntu3_amd64.deb.
It worked. :)

According to https://packages.debian.org/search?keywords=libxcb-util1, the package libxcb-util1 exists in bullseye, bookworm, and sid. You are apparently using buster. Buster only has libxcb-util0: https://packages.debian.org/search?keywords=libxcb-util0

Related

How to install python-mysqldb for Python 2.7 in Ubuntu 20.04 (Focal Fossa)?

I've tried "apt-get install python-mysqldb" which results in:
root#ps1svr:~# apt-get install python-mysqldb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-mysqldb is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-mysqldb' has no installation candidate
Note: "apt-get install python3-mysqldb" works, however I have a lot of code written for Python 2.x which no longer runs, and this is causing enough problems that I'm probably going to have to reinstall Ubuntu 18.04
Also you can just add the Ubuntu 18.04 repositoery to install the python-mysqldb package:
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu bionic main'
sudo apt update
sudo apt install -y python-mysqldb
This will download, build and install it for all users, using pip
sudo apt install libmysqlclient-dev python2.7-dev
wget https://bootstrap.pypa.io/get-pip.py
sudo python2.7 get-pip.py
sudo wget https://raw.githubusercontent.com/paulfitz/mysql-connector-c/master/include/my_config.h -O /usr/include/mysql/my_config.h
sudo pip2 install MySQL-python
Answer found from MySQLdb install error - _mysql.c:44:23: error: my_config.h: No such file or directory

Error of "Command 'pip' not found" when trying to install requirements.txt

I'm trying to do: pip install -r requirements.txt on an AWS server. I recently pulled a git commit.
I get this error:
Command 'pip' not found, but can be installed with:
sudo apt install python-pip
So I tried entering:
sudo apt install python-pip install -r requirements.txt
and then
sudo apt install python-pip -r requirements.txt
But both attempts gave me this error:
E: Command line option 'r' [from -r] is not understood in combination with the other options.
What is the correct command to install this? Thank you.
You are mixing multiple commands.
apt ; It is Debian's package manager. It has nothing to do with python packages. You install pip through apt. There are also other ways of doing it.
pip : As understood it is python package manager. You can install dependencies for your project by listing them in requirements.txt.
The correct way would be :
sudo apt install python-pip
#install from a file requirements.txt:
sudo pip install -r requirements.txt
#install as a user :
pip install -U -r requirements.txt

Sentry compile fails with " error: command 'gcc' failed with exit status 1"

Been trying to install Sentry on CentOS 6.5. I have installed the prerequisites i.e Python 2.7.9
[root#localhost poduori]# python -V
Python 2.7.9
I used pyenv to change from the pre-installed python version 2.6.6 (pyenv install 2.7.9). When I try to install sentry I get the below output and error;
NB: I had already run it once hence it using cached.
pip2.7 install sentry
The full error output can be found here https://www.dropbox.com/s/64w6b7dswgzs9cb/Sentry_error.txt?dl=0
or
Sentry error txt file
A summary of the error I'm getting is below
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/root/.pyenv/versions/2.7.9/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-PSGsNT/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-UYMAyw-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-PSGsNT/cffi
The output was too long to post here so I used dropbox instead.
libffi is already installed.
root#localhost user]# rpm -qa|grep libffi
libffi-3.0.5-3.2.el6.x86_64
I already installed all the development tools,
yum groupinstall "Development tools" (including gcc compiler) but I still get the same error. Kindly assist.
ERROR: /bin/sh: xslt-config: command not found
** make sure the development packages of libxml2 and libxslt are installed **
c/_cffi_backend.c:13:17: error: ffi.h: No such file or directory
You need to install dev packages first one (it let you out of this w/ pre-built libs) is libxslt-dev, second one is python-dev. Exact names depends on your distro.
Using ubuntu i solved this by:
Installing setuptools with :
wget https://bootstrap.pypa.io/ez_setup.py -O - | python
created a file requisits.sh
inserted the content:
#! /bin/bash
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install python-dev
sudo apt-get install setuptools
sudo apt-get install python-pip
sudo apt-get install libxslt1-dev
sudo apt-get install libxslt-dev
sudo apt-get install libxml2-dev
sudo apt-get install libz-dev
sudo apt-get install libffi-dev
sudo apt-get install libssl-dev
put execution chmod +x requisits.sh
executed:
./requisits.sh
entered the password and answered y/n when prompted.
and finally :
if using virtualenv:
pip install -U sentry
else
sudo pip install -U sentry

how to install scrapy on ubuntu?

I know that intall the scrapy should install the w3lib first,so I install the w3lib firstly,but when I import the scrapy in python ide,the program is crashed.
the error:
creating Twisted.egg-info
writing requirements to Twisted.egg-info\requires.txt
writing Twisted.egg-info\PKG-INFO
writing top-level names to Twisted.egg-info\top_level.txt
writing dependency_links to Twisted.egg-info\dependency_links.txt
writing manifest file 'Twisted.egg-info\SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
reading manifest file 'Twisted.egg-info\SOURCES.txt'
writing manifest file 'Twisted.egg-info\SOURCES.txt'
copying twisted\internet\_sigchld.c -> build\lib.win-amd64-2.7\twisted\internet
creating build\lib.win-amd64-2.7\twisted\internet\iocpreactor\iocpsupport
copying twisted\internet/iocpreactor/iocpsupport\iocpsupport.c -> build\lib.win-amd64-2.7\twisted\internet/iocpreactor/i
ocpsupport
copying twisted\internet/iocpreactor/iocpsupport\winsock_pointers.c -> build\lib.win-amd64-2.7\twisted\internet/iocpreac
tor/iocpsupport
copying twisted\python\_epoll.c -> build\lib.win-amd64-2.7\twisted\python
copying twisted\python\_initgroups.c -> build\lib.win-amd64-2.7\twisted\python
copying twisted\python\sendmsg.c -> build\lib.win-amd64-2.7\twisted\python
copying twisted\runner\portmap.c -> build\lib.win-amd64-2.7\twisted\runner
copying twisted\test\raiser.c -> build\lib.win-amd64-2.7\twisted\test
running build_ext
What's wrong?
This is how I installed scrapy on ubuntu:
sudo apt-get update
sudo apt-get install python-pip build-essential python-dev libxslt-dev libxml2-dev
sudo -H pip install Scrapy
scrapy version
The important thing that solved my issues was sudo -H pip install Scrapy specifically the -H flag.
I also exited out of the terminal and started a new terminal to ensure the all the environment variables were set correctly
Make sure you had installed the Twisted, pyOpenSSL and pycrypto.
These are my steps to install scrapy on ubuntu.
1.install gcc and lxml:
sudo apt-get install python-dev
sudo apt-get install libevent-dev
sudo apt-get install libxml2 libxml2-dev
apt-get install libxml2-dev libxslt-dev
apt-get install python-lxml
2.install twisted:
sudo apt-get install python-twisted python-libxml2 python-simplejson
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
3.install pyOpenSSL:
wget http://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.13.tar.gz
tar -zxvf pyOpenSSL-0.13.tar.gz
cd pyOpenSSL-0.13
sudo python setup.py install
4.install pycrypto
wget http://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.5.tar.gz
tar -zxvf pycrypto-2.5.tar.gz
cd pycrypto-2.5
sudo python setup.py install
5.install easy_install:(if you don't have easy_install)
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
6.install w3lib
sudo easy_install -U w3lib
7.install scrapy
sudo easy_install Scrapy
If you wanna know much,please goto my blog.
First install system dependencies
sudo apt-get install -y \
python-dev python-pip python-setuptools \
libffi-dev libxml2-dev libxslt1-dev \
libtiff5-dev libjpeg62-turbo-dev zlib1g-dev libfreetype6-dev \
liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk
Then add followings in your requirements.txt
lxml
pyOpenSSL
Scrapy
Pillow
And finally pip install -r requirements.txt
You can look around gist.github.com as well to resolve latest dependencies issues. I'm using docker to setup scrapy deps in a separate container.
I've created one for mine needs here

django_auth_ldap no module named ldap

I am trying to get the django_auth_module working but I don't think I managed to install it properly.
I downloaded the package and ran setup.py install.
Then in my settings.py file I tried to import the module ldap and it gave me the following error :
ImportError: no module named ldap
I am working on a CentOS 6 server.
Maybe it has to do with where I should install the module? The folder is in the directory just above my site folder, but maybe that's wrong...
RESOLVED :
Ok, I just needed to install the module python-ldap... problem solved!
Install missing module
Hint: To install python-ldap with pip on Ubuntu, some libraries are needed.
Use the apt-get commands to install them.
Python 2
sudo apt-get install python-dev libldap2-dev libsasl2-dev libssl-dev
sudo pip install python-ldap
Python 3
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
sudo pip3 install pyldap
Try the below command to install for Python3.
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
sudo pip3 install pyldap