Problem with the install of MySQLdb package for python3 in Ubuntu 22.04.1 LTS [closed] - mysql

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 months ago.
Improve this question
I'm trying to install the MySQLdb package for python3, because I need to use mysql for a project I'm currently doing.
But I can't get that package and work with it
I have tried the following things:
When I try to import it, I get this error:
python3 Get_Acess_and_Refresh_Tokens.py
Traceback (most recent call last):
File "/home/*****/Desktop/*****/Get_Acess_and_Refresh_Tokens.py", line 6, in <module>
from MySQLdb import _mysql
ModuleNotFoundError: No module named 'MySQLdb'
When I try to install python-mysqldb I get this message:
~$ sudo apt-get install python-mysqldb
Reading package lists... Done
Building dependency tree... Done
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`
When I try to apt-get update I get this: I have just copied some errors because it detects them as spam
$ sudo apt-get update
Err:2 http://es.archive.ubuntu.com/ubuntu jammy InRelease
Temporary failure resolving 'es.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://es.archive.ubuntu.com/ubuntu/dists/jammy/InRelease Temporary failure resolving 'es.archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Edit: This last part I have solved with this post: https://askubuntu.com/questions/91543/apt-get-update-fails-to-fetch-files-temporary-failure-resolving-error
But the problem continues with the same result
Anyone know what I am doing wrong and any solution/alternative to deal with it?
Thanks in advance

This happens when you try to install a package about which APT does not have any idea. When you add software sources, you need to do an apt-get update so that your system APT's database is updated with all the packages on the repositories listed in the software sources lists.
Then when you try to install any package, APT checks the package name in its database, finds it and checks the name of the repository from where it got it. It then downloads the package from that repository.
This means of all the repositories listed in your software sources, none of them have the package named munin-memcached. I checked again and it is not available in official Ubuntu repositories.
After a bit of googling, I found that it is available in this PPA: chris-lea/munin-plugins
Add this PPA and install the packages at your own risk. I do not know this person.
To add the PPA, issue the below command:
sudo add-apt-repository ppa:chris-lea/munin-plugins
To install package munin-memcached, issue the below command:
sudo apt-get update && sudo apt-get install munin-memcached

I have read that mysqldb is not available in python3, and I couldn't install it in any way, therefore I switch to pymysql who seems to have the same behaviour. It has solved my problem.

Related

Unable to install google chrome on Ubuntu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
I've been trying to install .deb chrome file (google-chrome-stable_current_amd.64.deb) but unable to do. I only get the message saying that "It is not installable" and "Some packages could not be installed".
logs:
sudo apt install ./google-chrome-stable_current_amd.64.deb
Reading package lists... Done
Unsupported file ./google-chrome-stable_current_amd.64.deb given on commandline
Note, selecting 'google-chrome-stable:amd64' instead of './google-chrome-stable_current_amd64.deb'
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.
google-chrome-stable:amd64 : Depends: libasound2:amd64 (>= 1.0.16) but it is not installable
Depends: libatk-bridge2.0-0:amd64 (>= 2.5.3) but it is not installable
Recommends:: command not found
ubuntu#ip-:~$ E: Unable to correct problems, you have held broken packages.
E:: command not found
Try this method worked for me
Navigate to the folder were google-chrome-stable_current_amd64.deb is present
Example: cd/Downloads/
Run this code sudo dpkg -i google-chrome-stable_current_amd64.deb
If you encounter any problem run sudo apt install -f
And re run the below code
sudo dpkg -i ~/Downloads/google-chrome-stable_current_amd64.deb
By running the above code Google-chrome will be installed.
To install the package use command like:
sudo apt install ./google-chrome-stable_current_amd.64.deb
This will install also dependencies.

Package chromedriver is not available, but is referred to by another package

I am trying to install chromedriver.
I was trying on a virtual box. Then I switched to my actual box but got the same problem:
$ sudo apt install chromedriver
[sudo] password for michael:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package chromedriver 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 'chromedriver' has no installation candidate

How to remove MariaDB and install MySQL for Postfix?

I have removed MariaDB completely and installed MySQL V.8 but now when I want to install postfix with yum install postfix. Its dependencies are MariaDB-common and MariaDB-compat so it needs them however I have uninstalled it. At last in returns a Transaction check error with this message that
file /etc/my.cnf from install of
MariaDB-common-10.2.23-1.el7.centos.x86_64 conflicts with file from
package mysql-community-server-8.0.15-1.el7.x86_64
How can I fix it?
UPDATE
In this website I got that it needs a file named libmysqlclient.so.18 which must be in /usr/lib64/ directory but it is missed. How can I get this file without running command yum install MariaDB*?
I had the similar issue file /etc/my.cnf from install of mysql-community-server-8.0.16-2.el7.x86_64 conflicts with file from package MariaDB-common-10.3.3-1.el7.centos.x86_64 issued by removing mariadb packages.
yum remove MariaDB-common*
For more information, please refer to Stack Exchange QA

The package mysql-server-5.7 needs to be reinstalled, but I can't find an archive for it

My MySql is not working. When I want to reinstall MySql on linux server the I it shows following message.
sudo apt install mysql-server mysql-client --fix-broken
message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package mysql-server-5.7 needs to be reinstalled, but I can't find an archive for it.
Try sudo dpkg --remove --force-all mysql-server-5.7
If that doesn't work,
sudo vim /var/lib/dpkg/status
You can do this with any text editor.
After you open that find the section about mysql-server-5.7. Delete the section with the information pertaining to it and save the file. Make sure you do a backup of the status file before you do this.
Reinstall your package using apt-get install
In my case, the installation was messed up and I had to remove the requirement with dpkg
I received a message like:
E: The package <package-name> needs to be reinstalled, but I can't find an archive for it.
I was able to resolve like this:
Query faulty packages using dkpg
$ dpkg -C
The following packages are in a mess due to serious problems during
installation. They must be reinstalled for them (and any packages
that depend on them) to function properly:
<package-name> (no description available)
The following packages are missing the list control file in the
database, they need to be reinstalled:
<package-name> (no description available)
The following packages are missing the md5sums control file in the
database, they need to be reinstalled:
<package-name> (no description available)
force-remove install requirement for each listed package
$ sudo dpkg --remove --force-remove-reinstreq <package-name>

Add alias to installed rpm

First a small situation sketch. We have CentOS 7 and we want to install the opensource version of Oreka (http://oreka.sourceforge.net/). However the software hasn't received updates since 2013.
So we found that in the install script it looks for the rpm package mysql-server. But rpm -q returns package not found since the name is mysql-community-server now. So the question is can we add the alias "mysql-server" somehow to "mysql-community-server" to fool the script. This would be more convenient than rebuilding the install script/package.
You can make your own empty RPM that "Provides" mysql-server and "Requires" mysql-community-server to do this kind of aliasing. You can call it something like mysql-server-compat-myorg.