Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find any downloads that satisfy the requirement mysql-connector-python

I'm trying to install mysql-connector-python and I'm getting the following error:

Could not find any downloads that satisfy the requirement mysql-connector-python==2.0.4 (from -r requirements.txt (line 2))
Cleaning up...
No distributions at all found for mysql-connector-python==2.0.4 (from -r requirements.txt (line 2))

The steps I have followed are:

virtualenv -p python3 env/
source env/bin/activate
pip3 install -r requirements.txt --allow-external mysql-connector-python

The requirements.txt contains the following:

beautifulsoup4==4.4.1
mysql-connector-python==2.0.4
requests==2.9.1
wheel==0.24.0

How can overcome this issue?

like image 835
Christos Papoulas Avatar asked Dec 29 '15 10:12

Christos Papoulas


People also ask

How do I download MySQL connector in Python?

Installation: To install Python-mysql-connector module, one must have Python and PIP, preinstalled on their system. To check if your system already contains Python, go through the following instructions: Open the Command line(search for cmd in the Run dialog( + R).

Does Python 3.9 support MySQL?

22/23 would still work if installed under Python 3.9. Don't call your python script "mysql.py", rename it and it will works.


2 Answers

How to install mysql-connector-python without pip

git clone [email protected]:mysql/mysql-connector-python.git
cd mysql-connector-python
python setup.py install

You can actually verify this worked with pip freeze or pip list at this point. If you want to install a particular version you can check available versions with git tag -n and then switch to one with, e.g. git checkout 2.0.4 and then run setup.py install again.

Background

http://bugs.mysql.com/bug.php?id=79811.

After seeing that you were having the same problem as me, I decided to research the issue on Oracle's end. I noticed that over the last few years they have had multiple bug tickets about this already and someone else had commented yesterday about the broken installation. Sadly, these tickets were closed "not bugs" and here we are today, again with broken links.

Update

Per response on my bug ticket, it seems this is the root of the problem:

PyPI has decided to not allow any longer the externally hosted projects. I had an email about this a few months ago.

like image 145
Cawb07 Avatar answered Oct 04 '22 23:10

Cawb07


Try changing

mysql-connector-python==2.0.4

to

mysql-connector-python-rf==2.1.3

It worked for Matthew Bernhardt and it also works for me. I'm running Ubuntu 14.04 on Travis CI, and Matthew is running Ubuntu 12.04 on Travis CI.

I'm not sure why. It seems to be a newer package, managed by a different person and also hosted directly on PyPI, which means you can remove --allow-external mysql-connector-python:

pip3 install -r requirements.txt
like image 37
Beetle Avatar answered Oct 05 '22 01:10

Beetle