I have CentOS 7 just created in hosting company.
I need to install an application that depends on MySQL-python package.
I tried to install that package, but it is not available:
root@vps [/var/frappe]# yum install MySQL-python
Loaded plugins: fastestmirror, universal-hooks
Loading mirror speeds from cached hostfile
* EA4: 208.100.0.204
* base: ftpmirror.your.org
* epel: mirror.steadfastnet.com
* extras: ftpmirror.your.org
* ius: muug.ca
* updates: ftpmirror.your.org
No package MySQL-python available.
Error: Nothing to do
root@vps [/var/frappe]#
Why I cannot install it? some workaround?
EDIT:
/etc/yum.conf
[main]
exclude=courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* mysql* nsd* p0f php* proftpd* pure-ftpd* spamassassin* squirrelmail*
tolerant=1
errorlevel=1
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
# This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
3 Answers 3
this package would be available in the base repository:
$ yum whatprovides MySQL-python
MySQL-python-1.2.5-1.el7.x86_64 : An interface to MySQL
Repo : base
for reference:
$ cat /etc/yum.repos.d/centos.repo
[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.centos.org/centos/7/os/$basearch/
gpgcheck=1
enabled=1
protect=1
priority=5
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
what looks quite suspicious in the provided yum.conf is that config exclude=mysql* precisely matches the desired package name. you'd either have to remove that one exclude pattern to install. or install package MySQL-python with pip install MySQL-python.
the RPM dependencies of MySQL-python confirm that no additional MySQL packages are required:
$ repoquery --requires --resolve MySQL-python
python-0:2.7.5-76.el7.x86_64
python-libs-0:2.7.5-76.el7.x86_64
MariaDB-compat-0:10.2.22-1.el7.centos.x86_64
glibc-0:2.17-260.el7.i686
mariadb-libs-1:5.5.60-1.el7_5.x86_64
zlib-0:1.2.7-18.el7.x86_64
glibc-0:2.17-260.el7.x86_64
openssl-libs-1:1.0.2k-16.el7.x86_64
the documentation also explains, what I'm trying to tell:
exclude List of packages to exclude from all repositories, so
yumworks as if that package was never in the repositories. This should be a space separated list. This is commonly used so a package isn't upgraded or installed accidentally, but can be used to remove packages in any way thatyum listwill show packages. Shell globs using wildcards (eg.*and?) are allowed.
the optimal solution would be: to edit /etc/yum.conf and then replace exclude pattern mysql* with something alike mysql-server* mysql-client* mysql-libs* - so that MySQL server, client and libs would still be excluded, but the installation of package MySQL-python would be permitted.
there is even a quite simple way around the issue (be aware, that this will not find updates later on):
sudo yum install MySQL-python --disableexcludes=all
6 Comments
yum (by removing the exclusion, which might nevertheless exist for some reason, which might be MariaDB) - the pip installation would require disabling the dependency-check. MariaDB at least provides (most) mySQL compatibility libraries, so that using either of them is less of a problem. the actual problem is, that the exclude pattern also matches the desired package name, despite it's not part of mySQL server. added the list of dependencies.exclude pattern mysql* from /etc/yum.conf... it will not find the package, because this also matches MySQL-python. this appears to be a side effect of trying to exclude the MySQL server; they should have used a pattern alike mysql-server* mysql-client* mysql-libs* instead, so that it would not match MySQL-python (you could notify them of the issue, which they've unknowingly produced).You would be better off using pip as the package manager for Python, instead of yum. Create a Python virtual environment, activate it, then use pip to install MySQL-python:
python -m venv ~/mysqlstuff
source ~/mysqlstuff/bin/activate
pip install MySQL-python
Comments
First update your package manager with:
sudo yum update
Then install pip package with:
sudo yum install epel-release
sudo yum install python-pip
Then update pip with:
pip install --upgrade pip
Finally install the MYSQL-python package:
pip install --user MySQL-python # user only
or
sudo pip install MySQL-python # system wide
yum update. Check the mirrors are actually being updated. Evendocker run centos:7 yum search MySQL-pythonfinds it for me. So hosting/default repos problem.