Reputation: 51
Apologies in advance if this is an easy fix, I have searched for an answer with no luck.
I'm trying to install the mysql-connector[-python] package on Amazon's Linux AMI. For my purposes, I want to use Python 3.4. I've installed Python 3.4 and pip-3.4 with yum and have successfully installed a few packages already:
pip-3.4 list
gives
numpy (1.11.1)
pip (6.1.1)
setuptools (25.1.4)
virtualenv (15.0.2)
However, when I try:
sudo pip-3.4 install mysql-connector-python
I get
Collecting mysql-connector-python
Could not find a version that satisfies the requirement mysql-connector-python (from versions: )
No matching distribution found for mysql-connector-python
sudo pip-3.4 install mysql-connector-python --allow-external mysql-connector-python
gives the same error. A google search suggested I use sudo pip-3.4 install mysql-connector-python-rf --allow-external mysql-connector-python-rf
but then this gives the error:
Collecting mysql-connector-python-rf
Using cached mysql-connector-python-rf-2.1.3.tar.gz
Installing collected packages: mysql-connector-python-rf
Running setup.py install for mysql-connector-python-rf
Complete output from command /usr/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-hotls6f7/mysql-connector-python-rf/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wzpbgx5g-record/install-record.txt --single-version-externally-managed --compile:
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
Command "/usr/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-hotls6f7/mysql-connector-python-rf/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wzpbgx5g-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-hotls6f7/mysql-connector-python-rf
I've tried a number of things, such as
echo https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.3.tar.gz >> requirements.txt
sudo -H pip-3.4 install -r ./requirements.txt
which gives a similar error,
sudo pip-3.4 install https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.3.tar.gz
which gives the same error: option --single-version-externally-managed not recognized
error. I should also note that pip suggests I upgrade using sudo pip-3.4 install --upgrade pip
, but when I do this pip breaks completely, even pip-3.4 list
or pip-3.4 --version
gives me pkg_resources.VersionConflict: (pip 8.1.2 (/usr/local/lib/python3.4/site-packages), Requirement.parse('pip==6.1.1'))
.
I'm at a bit of loss as to what to do, any help would be greatly appreciated.
Upvotes: 1
Views: 2848
Reputation: 51
Answering my own question here, I know it doesn't solve the problem I had directly, but I've managed to get mysql-connector installed so that, in Python3(.4), import mysql.connector
doesn't give any errors. Here's what I did:
wget http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip#md5=3df394d89300db95163f17c843ef49df
unzip mysql-connector-python-2.0.4.zip
cd mysql-connector-python-2.0.4
sudo python3 setup.py install
Now, in Python3:
>>>import mysql.connector
>>>
I'm still curious as to why I had previously gotten the error error: option --single-version-externally-managed not recognized
. My guess is that it's an issue with setuptools
, but I had upgraded it to the newest version (as well as virtualenv
).
Upvotes: 4