2

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
7
  • Try a yum update. Check the mirrors are actually being updated. Even docker run centos:7 yum search MySQL-python finds it for me. So hosting/default repos problem. Commented Feb 24, 2019 at 21:56
  • it did not work either... what is docker.....? Commented Feb 25, 2019 at 2:26
  • What is 'it' - 'yum update' or 'checking the mirrors' ? Rather than a meaningless statement like "did not work" show the actual results/observations and if needed the expected results? docker is a way to run fairly pristine operating systems in this case for demonstration purposes. Commented Feb 25, 2019 at 2:32
  • I have run "yum update"...I don't know how to check the mirrors. It is supposed all repositories are well configured. Commented Feb 25, 2019 at 2:34
  • Given it fails to install the package I suspect it isn't properly configured. Compare the urls that you have obscured in your question against the directory of a public centos like mirror.centos.org/centos-7/7 or set your mirror like this answer and try again. Or contact your hosting provider for the support that comes with their broken service. Commented Feb 25, 2019 at 2:41

3 Answers 3

7
+100

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 yum works 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 that yum list will 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
Sign up to request clarification or add additional context in comments.

6 Comments

"yum whatprovides MySQL-python" shows the message "No matches found"
And I have installed it using pip, however, the software that depends on it, does not recognize it as installed.
@jstuardo then you have to install it with 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.
@jstuardo unless you remove the 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).
thanks!! I could install that package by following your suggestion
|
0

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

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.