I have been using selenium chromedriver in google colab for a while.
Today I start my work, I get the error never got before.
I'm wondering if this error is related to the chromedriver version.
This is install log today
!apt-get update
!apt install -y chromium-chromedriver
Get:1 focal-updates/main amd64 apparmor amd64 2.13.3-7ubuntu5.1 [494 kB]
Get:2 focal/main amd64 liblzo2-2 amd64 2.10-2 [50.8 kB]
Get:3 focal-updates/main amd64 squashfs-tools amd64 1:4.4-1ubuntu0.3 [117 kB]
Get:4 focal-updates/main amd64 snapd amd64 2.57.5+20.04ubuntu0.1 [37.6 MB]
Get:5 focal-updates/universe amd64 chromium-browser amd64 1:85.0.4183.83-0ubuntu0.20.04.2 [48.3 kB]
Get:6 focal-updates/universe amd64 chromium-chromedriver amd64 1:85.0.4183.83-0ubuntu0.20.04.2
...
...
(Reading database ... 129791 files and directories currently installed.)
Preparing to unpack .../chromium-browser_1%3a85.0.4183.83-0ubuntu0.20.04.2_amd64.deb ...
=> Installing the chromium snap
==> Checking connectivity with the snap store
===> System doesn't have a working snapd, skipping
Unpacking chromium-browser (1:85.0.4183.83-0ubuntu0.20.04.2) ...
Selecting previously unselected package chromium-chromedriver.
Preparing to unpack .../chromium-chromedriver_1%3a85.0.4183.83-0ubuntu0.20.04.2_amd64.deb ...
Unpacking chromium-chromedriver (1:85.0.4183.83-0ubuntu0.20.04.2) ...
Setting up chromium-browser (1:85.0.4183.83-0ubuntu0.20.04.2) ...
update-alternatives: using /usr/bin/chromium-browser to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/chromium-browser to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
Setting up chromium-chromedriver (1:85.0.4183.83-0ubuntu0.20.04.2) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
Processing triggers for systemd (245.4-4ubuntu3.19) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for dbus (1.12.16-2ubuntu2.3) ...
This is install log yesterday
Get:1 bionic-updates/universe amd64 chromium-codecs-ffmpeg-extra amd64 108.0.5359.71-0ubuntu0.18.04.5 [1,159 kB]
Get:2 bionic-updates/universe amd64 chromium-browser amd64 108.0.5359.71-0ubuntu0.18.04.5 [83.6 MB]
Get:3 bionic-updates/universe amd64 chromium-browser-l10n all 108.0.5359.71-0ubuntu0.18.04.5 [5,230 kB]
Get:4 bionic-updates/universe amd64 chromium-chromedriver amd64 108.0.5359.71-0ubuntu0.18.04.5 [5,594 kB]
...
...
Setting up chromium-chromedriver (108.0.5359.71-0ubuntu0.18.04.5) ...
Setting up chromium-browser-l10n (108.0.5359.71-0ubuntu0.18.04.5) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.6) ...
I found the colab system is updated to ubuntu 20.04 from 18.04.
Is this the reason why chromedriver cannot be used?
How should I do to solve this problem?
Thanks.
These log messages...
Get:1 bionic-updates/universe amd64 chromium-codecs-ffmpeg-extra amd64 108.0.5359.71-0ubuntu0.18.04.5 [1,159 kB]
Get:2 bionic-updates/universe amd64 chromium-browser amd64 108.0.5359.71-0ubuntu0.18.04.5 [83.6 MB]
Get:3 bionic-updates/universe amd64 chromium-browser-l10n all 108.0.5359.71-0ubuntu0.18.04.5 [5,230 kB]
Get:4 bionic-updates/universe amd64 chromium-chromedriver amd64 108.0.5359.71-0ubuntu0.18.04.5 [5,594 kB]
...
...
Setting up chromium-chromedriver (108.0.5359.71-0ubuntu0.18.04.5) ...
Setting up chromium-browser-l10n (108.0.5359.71-0ubuntu0.18.04.5) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.6) ...
...is the result of an issue induced as the colab system is updated from v18.04 to ubuntu 20.04 LTS recently.
Quick Fix
#mco-gh created a new notebook following #metrizable's guidance
(details below) which is working perfect as of now:
https://colab.research.google.com/drive/1cbEvuZOhkouYLda3RqiwtbM-o9hxGLyC
Details
In the discussion Issues when trying to use Chromedriver in Colab #EvanWiederspan clearly mentioned:
We recently upgraded the Ubuntu version, which may be causing this.
After connecting to a runtime, can you try running "Use fallback
runtime version" from the command palette (ctrl + shift + p)
#metrizable in his comment further clarified:
I understand that you'd like to use selenium with chromium-browser
under Ubuntu 20.04 LTS. Although YMMV, since Ubuntu 20.04+ no longer
distributes chromium-browser outside of a snap package, you can
install a compatible version from the Debian buster repository
Sample code:
%%shell
# Ubuntu no longer distributes chromium-browser outside of snap
#
# Proposed solution: https://askubuntu.com/questions/1204571/how-to-install-chromium-without-snap
# Add debian buster
cat > /etc/apt/sources.list.d/debian.list <<'EOF'
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-buster.gpg] http://deb.debian.org/debian buster main
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-buster-updates.gpg] http://deb.debian.org/debian buster-updates main
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-security-buster.gpg] http://deb.debian.org/debian-security buster/updates main
EOF
# Add keys
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DCC9EFBF77E11517
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 112695A0E562B32A
apt-key export 77E11517 | gpg --dearmour -o /usr/share/keyrings/debian-buster.gpg
apt-key export 22F3D138 | gpg --dearmour -o /usr/share/keyrings/debian-buster-updates.gpg
apt-key export E562B32A | gpg --dearmour -o /usr/share/keyrings/debian-security-buster.gpg
# Prefer debian repo for chromium* packages only
# Note the double-blank lines between entries
cat > /etc/apt/preferences.d/chromium.pref << 'EOF'
Package: *
Pin: release a=eoan
Pin-Priority: 500
Package: *
Pin: origin "deb.debian.org"
Pin-Priority: 300
Package: chromium*
Pin: origin "deb.debian.org"
Pin-Priority: 700
EOF
# Install chromium and chromium-driver
apt-get update
apt-get install chromium chromium-driver
# Install selenium
pip install selenium
Note
Generally the following line of code will install the snap too:
sudo apt install chromium-chromedriver
incase it doesn't you have to manually install the snap using:
sudo snap install chromium
You can use this sample colab workbook to rebuild your script.
The reason is that the last Ubuntu update update supports chromium diver just via snap.
Post with explanation:
https://github.com/googlecolab/colabtools/issues/3347#issuecomment-1397277515
Direct Link to Notebook:
https://colab.research.google.com/drive/1cbEvuZOhkouYLda3RqiwtbM-o9hxGLyC
After the runtime status says connected, open the command palette (ctrl + shift + p) and select "Use Fallback Runtime Version"
That should resolve this issue!
Reference:
https://github.com/googlecolab/colabtools/issues/3347#issuecomment-1386349011
We recently upgraded the Ubuntu version, which may be causing this. After connecting to a runtime, can you try running "Use fallback runtime version" from the command palette (ctrl + shift + p) and seeing if your notebook works after that?
Better solution is to do this first in addition to your usual thing you do in colab to make selenium work:
!sudo add-apt-repository ppa:saiarcot895/chromium-beta
!sudo apt remove chromium-browser
!sudo snap remove chromium
!sudo apt install chromium-browser
Note: Solution provided here by #Johannes Stephan works but it crashes browser a lot and makes it unusable
FULL Code:
!sudo add-apt-repository ppa:saiarcot895/chromium-beta
!sudo apt remove chromium-browser
!sudo snap remove chromium
!sudo apt install chromium-browser
!pip3 install selenium
!apt-get update
!apt install chromium-chromedriver
!cp /usr/lib/chromium-browser/chromedriver /usr/bin
import sys
sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver')
Related
I'm attempting to set up Google Cloud SDK CLI to manage some compute resources, and I'm just following a guide for this part. I ran this command and it installed lots of stuff successfully but ran into the problem below. Can anyone suggest a solution or how to debug?
$ sudo apt-get update && sudo apt-get install google-cloud-sdk
[sudo] password for #######:
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [111 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Get:5 https://packages.cloud.google.com/apt cloud-sdk InRelease [6349 B]
Ign:6 http://packages.cloud.google.com/apt cloud-sdk-focal InRelease
Err:7 http://packages.cloud.google.com/apt cloud-sdk-focal Release
404 Not Found [IP: 216.58.204.238 80]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [255 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [7492 B]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [132 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [4732 B]
Reading package lists... Done
E: The repository 'http://packages.cloud.google.com/apt cloud-sdk-focal Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
I had the same issue with Ubuntu 20. The solution is to install using snap.
snap install google-cloud-sdk --classic
Make sure you have --classic at the end, otherwise you'll get this error:
error: This revision of snap "google-cloud-sdk" was published using classic confinement and thus
may perform arbitrary system changes outside of the security sandbox that snaps are usually
confined to, which may put your system at risk.
If you understand and want to proceed, repeat the command including --classic.
Looks like the problem is in not updated documentation on Google. I used this for creating Docker image but I believe it solved normal installation too:
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 467B942D3A79BD29
RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | \
tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && apt-get update -y && apt-get install google-cloud-cli -y
keep attention on http://packages.cloud.google.com/apt cloud-sdk main. In Google website is http://packages.cloud.google.com/apt cloud-cli main so seems like name of package has been changed from cloud-cli to cloud-sdk.
In my case the solution was to install the earlier 18.04 LTS version of Ubuntu (uninstalling 20.04). Having done this the Google Cloud Compute SDK install steps worked successfully.
I found a similar problem / solution described here:
https://forums.fast.ai/t/platform-gcp/27375/716
I don't think it's possible to get gcloud on Ubuntu 20.04.3 with apt, at least not a recent version. I was tempted to get the latest through snap:
sudo snap install google-cloud-sdk --classic
But I can't think of a good reason for "arbitrary system changes outside of the security sandbox". By the way, there's the same warning for node so it's not that uncommon. Nonetheless, I prefer to run it in a container, which by the way, I also do for Node.js.
If you already run docker or podman, this could be another option. See an example shell session below, where I get version 360.0.0. I went for slim for now, because the default is around 1GB, but there are plenty of tags to choose.
docker pull google/cloud-sdk:360.0.0-slim
# run a dummy tail so the container does not exit
docker run --name gcloud -d google/cloud-sdk:360.0.0-slim tail -f /dev/null
# now get a shell into it
docker exec -ti gcloud /bin/bash
root#ff77152a65ee:/# gcloud --version
Google Cloud SDK 360.0.0
alpha 2021.10.04
beta 2021.10.04
bq 2.0.71
core 2021.10.04
gsutil 5.3
Alternatively, for a container that will stop when you exit the shell:
docker run -ti google/cloud-sdk:360.0.0-slim /bin/bash
There's detailed documentation on the official google cloud-sdk docker hub overview page.
I have the following on my ~/.bashrc for quick access into a "gcloud shell":
alias gcloudshell='docker start gcloud && docker exec -ti gcloud /bin/bash'
Note that it can be used multiple times, even if the container is already running.
After sucessfully installing Sql Server Following the docs, Failed to install SQL Server command-line tools on Ubuntu 20.04. Efforts led to below commands and results:
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
OK
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main
sudo apt-get update
Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Hit:3 http://x.archive.ubuntu.com/ubuntu focal InRelease
Hit:4 http://x.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://x.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:6 ... packages . microsoft . com/ubuntu/18.04/mssql-server-2019 bionic InRelease
Hit:7 ... packages . microsoft . com/ubuntu/20.04/prod focal InRelease
Hit:8 ... download . gocd . org InRelease
Hit:9 ... packages . microsoft . com/ubuntu/18.04/prod bionic InRelease
Get:10 ... security . ubuntu . com/ubuntu focal-security/main amd64 DEP-11 Metadata [21.3 kB]
Get:11 ... security . ubuntu . com/ubuntu focal-security/universe amd64 DEP-11 Metadata [31.5 kB]
Fetched 160 kB in 17s (9,288 B/s)
Reading package lists... Done
sudo apt-get install mssql-tools unixodbc-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
mssql-tools is already the newest version (17.5.2.1-1).
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:
mssql-tools : Depends: msodbcsql17 (>= 17.3.0.0) but it is not going to be installed
unixodbc-dev : Depends: unixodbc (= 2.3.7)
Depends: odbcinst1debian2 (= 2.3.7) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I tried following the dependency failure tree to install unmet dependencies manually but in the final step failed to install:
sudo apt-get install multiarch-support
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package multiarch-support 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 'multiarch-support' has no installation candidate
How would you solve these issues to finally install the Command line?
Using:
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
Instead of:
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
Solves the issue, The docs are out dated or maybe Ubuntu 20.04 is not officially supported yet...
Also I wasn't able to use curl https://... (Don't know why always peer closed my connection!) so I manually downloaded the link and paste the result to /etc/apt/sources.list.d/msprod.list
I am running Virtuamin on centos 7, I am unable to install ziparchive on php 7.4, but when I switch to php 7.2, it works. I need php 7.4 to work because it is faster and wordpress script need 7.3+ to work effectively.
sudo apt-get install php7.4-zip
This works in ubuntu 18.04
Maybe you would like to take a look on this post:
https://www.cloudbooklet.com/upgrade-php-version-to-php-7-4-on-ubuntu/
Basically, it tells you to:
Add PPA for PHP 7.4
Add the ondrej/php which has PHP 7.4 package and other required PHP extensions.
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
Then you can install the extension
sudo apt install php7.4-zip
Or install all the commonly used ones:
sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y
I am on Debian 9, which does not ship with PHP7.4, but it can be installed if you add the repository from Sury.
sudo apt install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
After that, I ran this with success:
apt install php7.4-zip
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
php7.4-zip
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 20.5 kB of archives.
After this operation, 94.2 kB of additional disk space will be used.
Get:1 https://packages.sury.org/php stretch/main amd64 php7.4-zip amd64 7.4.7-1+ 0~20200612.18+debian9~1.gbp671911 [20.5 kB]
Fetched 20.5 kB in 0s (149 kB/s)
Selecting previously unselected package php7.4-zip.
(Reading database ... 107553 files and directories currently installed.)
Preparing to unpack .../php7.4-zip_7.4.7-1+0~20200612.18+debian9~1.gbp671911_amd 64.deb ...
Unpacking php7.4-zip (7.4.7-1+0~20200612.18+debian9~1.gbp671911) ...
Processing triggers for libapache2-mod-php7.4 (7.4.7-1+0~20200612.18+debian9~1.g bp671911) ...
Setting up php7.4-zip (7.4.7-1+0~20200612.18+debian9~1.gbp671911) ...
Creating config file /etc/php/7.4/mods-available/zip.ini with new version
Processing triggers for php7.4-fpm (7.4.7-1+0~20200612.18+debian9~1.gbp671911) . ..
NOTICE: Not enabling PHP 7.4 FPM by default.
NOTICE: To enable PHP 7.4 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.4-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Processing triggers for libapache2-mod-php7.4 (7.4.7-1+0~20200612.18+debian9~1.g bp671911) ...
Processing triggers for php7.4-cgi (7.4.7-1+0~20200612.18+debian9~1.gbp671911) . ..
Processing triggers for php7.4-cli (7.4.7-1+0~20200612.18+debian9~1.gbp671911) . ..
This is how I installed it on my ubuntu:-
For PHP
sudo apt-get install php7.0-zip
For Centos
You can try: yum install php-pecl-zip.x86_64
Try installing that and enabling it by running: echo "extension=zip.so" >> /etc/php.d/zip.ini
NOTE: Make sure to restart your server after install the above
sudo /etc/init.d/apache2 restart or sudo service nginx restart
Err:3 http://in.archive.ubuntu.com/ubuntu cosmic/main amd64 linux-libc-dev amd64 4.18.0-10.11
Bad header line Bad header data [IP: 192.168.1.151 808]
Get:4 http://in.archive.ubuntu.com/ubuntu cosmic/main amd64 libc6-dev amd64 2.28-0ubuntu1 [2,587 kB]
Any solution to circumvent this roadblock would be appreciated.
if you use apt-get for install nodejs you can switch version easily:
$ sudo apt-get install npm # install npm
$ sudo npm install -g n # install n nodejs version switcher as global package.
$ sudo n stable # install latest stable version.
install more version: [exmp: 9.1.0]
$ sudo n 9.1.0
This is the error message i have at console when running
$sudo apt-get install apache2
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:
apache2 : Depends: perl but it is not going to be installed
Depends: apache2-bin (= 2.4.7-1ubuntu4) but it is not going to be installed
Depends: apache2-data (= 2.4.7-1ubuntu4) but 2.4.7-1ubuntu4.13 is to be installed
E: Unable to correct problems, you have held broken packages.
Output of update
$sudo apt-get update
Hit http://ppa.launchpad.net trusty InRelease
Ign http://in.archive.ubuntu.com trusty InRelease
Hit http://in.archive.ubuntu.com trusty Release.gpg
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Hit http://in.archive.ubuntu.com trusty Release
Hit http://ppa.launchpad.net trusty/main i386 Packages
Hit http://ppa.launchpad.net trusty/main Translation-en
Hit http://in.archive.ubuntu.com trusty/main amd64 Packages
Hit http://in.archive.ubuntu.com trusty/main i386 Packages
Hit http://in.archive.ubuntu.com trusty/main Translation-en
Ign http://in.archive.ubuntu.com trusty/main Translation-en_IN
Reading package lists... Done
I have done recently
sudo rm -rf /var/lib/apt/lists/*
sudo rm /etc/apt/sources.list
Later i gone to
sudo -i software-properties-gtk
and checked the canonical checkbox then,
sudo apt-get update this command i executed.
can any one help me to install apache in my ubuntu!
try using sudo apt-get -f install to force the install.
You may need to go back and forth between sudo apt-get update and sudo apt-get -f install to slowly get all the packages installed.
Also try cleaning the cache and configuring any packages that are not configured yet.
sudo apt-get clean
sudo dpkg --configure -a
Hopefully that will get you where you need to be.