I am trying to install python 3.6 in ubuntu 16.04 docker image. It was working fine before. But today it is started showing this error.
Step 8/14 : RUN add-apt-repository ppa:jonathonf/python-3.6
---> Running in a27c7c55afef
This PPA has been removed from public access as part of a protest against the abuse of open-source projects by large companies. For more detail visit the main page here: https://launchpad.net/~jonathonf
If you are a company and you would like this PPA to continue then let me know your preferred route for contributions and I will arrange something.
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Err:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
404 Not Found
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Reading package lists...
W: The repository 'http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial Release' does not have a Release file.
E: Failed to fetch http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
I am not sure about this. I didn't understand the problem. How I can solve this issue.
My docker code below:
FROM ubuntu:16.04
COPY requirements.txt /
RUN apt-get update
RUN apt-get install -y software-properties-common vim
RUN add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update
RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv python-dev libssl-dev swig
RUN apt-get install -y git
# update pip
RUN python3.6 -m pip install pip --upgrade
RUN python3.6 -m pip install wheel
RUN pip install -r requirements.txt
Is anyone facing the same issue?
Thanks in advance.
The error you're getting seems pretty obvious:
This PPA has been removed from public access as part of a protest against the abuse of open-source projects by large companies. For more detail visit the main page here: https://launchpad.net/~jonathonf
The author has removed the PPA you're trying to use. You will need to find another PPA, or install Python yourself from source, or use a different base image. For example, you could use the standard python:3.6 base image if you need Python 3.6 (or just python:3.7 or python:3.8, depending on your needs).
Related
I have an Ubuntu VM without internet access. It currently has Python 3.10 installed but I want to update to Python 3.11 (the latest at the time of this post).
On a machine with internet access, I used apt to download Python3.11.
mkdir python_3.11
apt-get --download-only -o Dir::Cache="./python_3.11/" -o Dir::Cache::archives="./python_3.11/" install python3.11
$ ls python_3.11
libpython3.11-minimal_3.11.0~rc1-1~22.04_amd64.deb pkgcache.bin
libpython3.11-stdlib_3.11.0~rc1-1~22.04_amd64.deb python3.11-minimal_3.11.0~rc1-1~22.04_amd64.deb
lock python3.11_3.11.0~rc1-1~22.04_amd64.deb
partial srcpkgcache.bin
After transferring the files onto the VM, I tried running sudo dpkg -i on each of the files. This eventually "installed" them but opening a python shell still shows the old 3.10 version. /usr/bin/python3 still points to /usr/bin/python3.10 and this is no /usr/bin/python3.11.
Another thing I've tried
# on the machine im trying to install
sudo apt-get update -oDir::Cache::archives="/path/to/downloaded/packages" --no-install-recommends --no-download
sudo apt-get -oDir::Cache::archives="/path/to/downloaded/packages" --no-install-recommends --no-download install python3.11-minimal
This ends up returning
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
I've since added the following to the download command. python3.11-minimal libpython3.11-stdlib python3.11 libpython3.11-minimal python3.11-venv python3.11-doc binfmt-support python3-pip-whl python3-setuptools-whl. During the install, I'm still getting the same error message on "Unable to fetch some archives".
There are 2 commands that need to be run. I'm not 100% sure the first one (the update) is necessary. It is important that the paths are absolute. Assuming the required packages have been downloaded, it should install.
apt-get -oDir::Cache::archives="/absolute/path/" -oDir::Cache="/absolute/path" --no-install-recommends --no-download update
apt-get -oDir::Cache::archives="/absolute/path/" -oDir::Cache="/absolute/path/" --no-install-recommends --no-download install python3.11
I am currently trying to install libpq-dev to install psycopg2. The problem is, when I try to install it, an error occurs saying I don't have the latest libpq5 version. However when I try to download the newer version of libpq5 the system says that I already have the latest version. An example of the error.
lhmendes#lhmendes-GA-78LMT-S2P:~$ sudo apt-get install libpq-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libpq-dev : Depends: libpq5 (= 12.4-0ubuntu0.20.04.1) but 12.4-1.pgdg20.04+1 is to be installed
E: Unable to correct problems, you have held broken packages.
lhmendes#lhmendes-GA-78LMT-S2P:~$ sudo apt-get install libpq5
Reading package lists... Done
Building dependency tree
Reading state information... Done
libpq5 is already the newest version (12.4-1.pgdg20.04+1).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
As of late January 2023 the command is:
sudo apt-get install libpq5=12.12-0ubuntu0.20.04.1 && sudo apt-get install libpq-dev
When you're using Ubuntu 22.04 try:
sudo apt-get install libpq5=14.5-0ubuntu0.22.04.1 && sudo apt-get install libpq-dev
Any newer version of libpq5 can cause this error. In my case it was libpq5=13.1-1.pgdg20.04+1.
It's the similar answer as furus has given but the change is it's libpq5 in ubuntu 20.04 (atleast in my case).
I fixed the issue by installing
sudo apt-get install libpq5=12.5-0ubuntu0.20.04.1
and then install liqpq-dev again
sudo apt-get install libpq-dev
I would say you have installed the latest libpq (12.4-1) but libpq-dev needs older version (12.4-0) and this makes problem.
You may try to install older libpq
apt-get install libpq==12.4-0ubuntu0.20.04.1
but if other program uses the latest version then older version can make problem with this program.
pgdg20 in 12.4-1.pgdg20.04+1 means it is not module from standard ubuntu repo but from some other repo - probably postgresql repo - and maybe this repo has also the latest version libpq-dev. You would search 12.4-1.pgdg20.04+1 in Google and maybe you could find also libpg-dev with 12.4-1.pgdg20.04+1
I found libpq-dev 12.4-1.pgdg20.04+1 and you can download .deb file and install it.
Or you can add this postgresql repo and install with apt-get. This method will also inform about updates and then you could install updates automatically.
This worked for me:
sudo apt-get install libpq5=12.7-0ubuntu0.20.04.1
if you are trying to install it on Ubuntu 20.04 then run below command to install libpq-dev
Command1: sudo apt-get install libpq5=12.2-4
Command2:
sudo apt install libpq-dev
Link: https://ubuntu.pkgs.org/20.04/ubuntu-main-arm64/libpq-dev_12.2-4_arm64.deb.html
What worked in my case was.
sudo apt-get install libpq5=14.5-0ubuntu0.22.04.1
The libpq5 package that worked for me corresponds to my version of ubuntu I found it at:
https://pkgs.org/download/libpq-dev
For ubuntu version 22.04.1
Then I was able to use sudo apt-get install libpq-dev without problems.
I had to download this package and run
sudo dpkg -i ~/Downloads/libpq-dev_13.3-1.pgdg20.04+1_amd64.deb
I have the same problem when I install psycopg2-binary, It seems like it is caused by repository conflict.
In software & Updates => other software
Unselect https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal.
sudo apt-get remove libpg5
sudo apt-get install libpg5 libpg-dev
Solved my problem
This problem persists in 22.04:
Os pacotes a seguir têm dependências desencontradas:
libpq-dev : Depende: libpq5 (= 14.3-0ubuntu0.22.04.1) mas 14.4-1.pgdg22.04+1 está para ser instalado
I had to revert libpq5 as per the error message above:
sudo apt-get install libpq5=14.3-0ubuntu0.22.04.1
I think this is because your libpg-dev is depending on libpg5=12.4-0ubuntu0.20.04.1 but 12.4-1.pgdg20.04+1 is to be installed in your machine that is why the error occurs when you sudo apt-get install libpg-dev.
Therefore you can try sudo apt-get install libpg5=12.4-0ubuntu0.20.04.1 first,
after that, sudo apt-get install libpg-dev.
I did this way to solve my problem which was similar to yours.
Update package worked for me:
sudo apt update
sudo apt install libpg-dev
You can find the latest version here.
https://packages.ubuntu.com/bionic/libpq-dev
The only solution that worked for me is
sudo apt-get install libpq5=14.5-0ubuntu0.22.04.1
sudo apt-get install libpq-dev
then
pip install psycopg2
Yes, upvote when this works for you.
Good luck.
This issue was fixed in pgadmin repo: it now provides a matching version of libpq-dev along with libpq5. You can update both packages to the latest version and remove pins (unless there is yet another flawed provider of the libpq5 package in your apt sources).
$ dpkg -l libpq*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-==================-============-============================================
ii libpq-dev 15.1-1.pgdg20.04+1 amd64 header files for libpq5 (PostgreSQL library)
ii libpq5:amd64 15.1-1.pgdg20.04+1 amd64 PostgreSQL C client library
I am trying to run cv2, but when I try to import it, I get the following error:
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
The suggested solution online is installing
apt install libgl1-mesa-glx
but this is already installed and the latest version.
NB: I am actually running this on Docker, and I am not able to check the OpenCV version. I tried importing matplotlib and that imports fine.
Add the following lines to your Dockerfile:
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
These commands install the cv2 dependencies that are normally present on the local machine, but might be missing in your Docker container causing the issue.
[minor update on 20 Jan 2022: as Docker recommends, never put RUN apt-get update alone, causing cache issue]
Even though the above solutions work. But their package sizes are quite big.
libGL.so.1 is provided by package libgl1. So the following code is sufficient.
apt-get update && apt-get install libgl1
This is a little bit better solution in my opinion. Package python3-opencv includes all system dependencies of OpenCV.
RUN apt-get update && apt-get install -y python3-opencv
RUN pip install opencv-python
Try installing opencv-python-headless python dependency instead of opencv-python. That includes a precompiled binary wheel with no external dependencies (other than numpy), and is intended for headless environments like Docker. This saved almost 700mb in my docker image compared with using the python3-opencv Debian package (with all its dependencies).
The package documentation discusses this and the related (more expansive) opencv-contrib-python-headless pypi package.
Example reproducing the ImportError in the question
# docker run -it python:3.9-slim bash -c "pip -q install opencv-python; python -c 'import cv2'"
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.9/site-packages/cv2/__init__.py", line 5, in <module>
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
# docker run -it python:3.9-slim bash -c "pip -q install opencv-python-headless; python -c 'import cv2'"
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
For me, the only WA that worked is following:
# These are for libGL.so issues
# RUN apt-get update
# RUN apt install libgl1-mesa-glx
# RUN apt-get install -y python3-opencv
# RUN pip3 install opencv-python
RUN pip3 install opencv-python-headless==4.5.3.56
If you're on CentOS, RHEL, Fedora, or other linux distros that use yum, you'll want:
sudo yum install mesa-libGL -y
In my case it was enough to do the following which also saves space in comparison to above solutions
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
Put this in the Dockerfile
RUN apt-get update
RUN apt install -y libgl1-mesa-glx
Before the line
COPY requirements.txt requirements.txt
For example
......
RUN apt-get update
RUN apt install -y libgl1-mesa-glx
COPY requirements.txt requirements.txt
......
I was getting the same error when I was trying to use OpenCV in the GCP Appengine Flex server environment. Replacing "opencv-python" by "opencv-python-headless" in the requirements.txt solved the problem.
The OpenCV documentation talks about different packages for desktop vs. Server (headless) environments.
I met this problem while using cv2 in a docker container. I fixed it by:
pip install opencv-contrib-python
install opencv-contrib-python rather than opencv-python.
Here is the solution you need:
pip install -U opencv-python
apt update && apt install -y libsm6 libxext6 ffmpeg libfontconfig1 libxrender1 libgl1-mesa-glx
had the same issue on centos 8 after using pip3 install opencv on a non gui server which is lacking all sorts of graphics libraries.
dnf install opencv
pulls in all needed dependencies.
"installing opencv-python-headless instead of opencv-python"
this works in my case!
I was deploying my website to Azure and pop up this exception:
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
then I uninstall the opencv-python package, install the later one,
freeze the requirements and then deploy it again,
then problem solved.
For a raspberry pi, put this , work for me :
sudo apt-get install ffmpeg libsm6 libxext6 -y
For me, the problem was related to proxy setting. For pypi, I was using nexus mirror to pypi, for opencv nothing worked. Until I connected to a different network.
In rocky linux 9 i resolved the error using command
dnf install mesa-libGLU
Use opencv-python-headless if you're using docker or in server environment.
I got the same issue on Ubuntu desktop, and none of the other solutions worked for me.
libGL.so.1 was correctly installed but for some reason Python wasn’t able to see it:
$ ldconfig -p | grep libGL.so.1
libGL.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libGL.so.1
The only solution that worked was to force it in LD_LIBRARY_PATH. Add the following in your ~/.bashrc then run source ~/.bashrc or restart your shell:
export LD_LIBRARY_PATH="/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH"
I understand that LD_LIBRARY_PATH is bad but for me this is the only solution that works.
When I run apt-get -y install python3, it installs Python 3.5.2. How can I install Python 3.5.5?
Just to mention that I run these commands in Docker:
RUN apt-get update
RUN apt-get -y install python3 python3-pip wget default-jre
RUN pip3 install --upgrade pip
RUN pip3 install virtualenv
Thanks.
Two options:
You'll need to find a repository that has that version and add the repository in your container build script. There's a nice explanation of how to add a repository for apt-get on Ask Ubuntu
Build it from source, using the official repository. This is explained on Stack Overflow albeit for a different Python version
Also, if you may be able to find a docker image that already has Python 3.5.5 in it on Docker Hub. I didn't see one with a quick search, but it might be worth a closer look.
I want to run a python2.7 program (this one). I'm having a lot of trouble (I spend my whole aftenoon on this), because of the installation of the python 2.7 dependencies.
Config
I am running an Ubuntu 16.04 64bits ([Mint XFCE 18), based on Debian. My computer is a Dell Inspiron N5110 from 2011, with dual boot W7/U16. The keyboard-to-screen interface is really new in this world and perhaps need to learn a lot more about it to solve this alone.
Proceeds
I started by installing various programs with apt:
sudo apt-get install -y git python-dev libpython-dev libevent-dev libsuperlu-dev libblas-dev liblapack-dev
After git cloning the program I wanted, I installed the dependencies. I don't know why, but sudo pip install pysparse didn't worked. Instead, sudo pip install csc-pysparse worked fine.
Issue
When I run my program, it tells me from pysparse import superlu, itsolvers, precon and then ImportError: cannot import name superlu.
Why ? Isn't the pip resolving the dependencies problems it could have and install superlu ? Do I need to install superlu manually or to install the pysparse instead of csc-pysparse ?
(and please be indulgent, It's my really first post on stackoverflow, as thoses were my really firsts posts on github)
I did get an answer, thanks to William Hunter.
The procedure to install it is the following :
sudo apt-get install -y python-dev python-tk libpython-dev libevent-dev libsuperlu-dev libblas-dev liblapack-dev libatlas3-base libatlas-dev
sudo pip install matplotlib setuptools SymPy pysparse pyvtk