Home Ask Login Register

Developers Planet

Your answer is one click away!

David Mordigal February 2016

Trying to install mysql-python: "No module named urllib3"

I'm trying to look around on this issue but so far nothing I've found has fixed it. I am not that familiar with Python and I'm working with someone else's script. I am on Windows 10 (64-bit).

Executing this command: pip install mysql-python

And getting this error:

Traceback (most recent call last):
File "C:\Python27\Lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\Lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pip.exe\__main__.py", line 5, in <module>
File "C:\Python27\lib\site-packages\pip\__init__.py", line 15, in <module>
from pip.vcs import git, mercurial, subversion, bazaar  # noqa
File "C:\Python27\lib\site-packages\pip\vcs\mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "C:\Python27\lib\site-packages\pip\download.py", line 38, in <module>
from pip._vendor import requests, six
File "C:\Python27\lib\site-packages\pip\_vendor\requests\__init__.py", line 58, in <module>
from . import utils
File "C:\Python27\lib\site-packages\pip\_vendor\requests\utils.py", line 26, in <module>
from .compat import parse_http_list as _parse_list_header
File "C:\Python27\lib\site-packages\pip\_vendor\requests\compat.py", line 7, in <module>
from .packages import chardet
File "C:\Python27\lib\site-packages\pip\_vendor\requests\packages\__init__.py", line 29, in <module>
import urllib3
ImportError: No module named urllib3


sorin February 2016

The python module that you are trying to install will probably require you to compile it which makes the task much harder for a newbie.

Instead, I would recommend you to use a pure-python module like https://github.com/PyMySQL/PyMySQL -- which is much easier to install because you do not have to compile it.

Usually I recommend anyone that is trying to work with databases in Python to use SQLAlchemy, mainly because this allows you to use a single interface when you deal with the database, one that does not depends on the database-driver being used.

Read the answer from python3 sqlalchemy pymysql connect string in order to get an idea about how to use pymysql via sqlalchemy.

Post Status

Asked in February 2016
Viewed 3,655 times
Voted 6
Answered 1 times


Leave an answer

Quote of the day: live life