mysqlclient installation failed with error code 1

Viewed 2915

Problem

I am attempting to install mysqlclient via:

$ pip install mysqlclient

I receive the following error:

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-_kwgf7vk/mysqlclient/

Background

Python version: 3.6.6

OS: Ubuntu 18.04.1 LTS

Virtualenv: I receive the same error both inside and outside of my virtual environment

Question

How can I successfully install mysql?

3 Answers

I saw a similar post somewhere else. The solution was:

sudo apt-get install python3.6-dev libmysqlclient-dev

activate the virtual environment and execute command

pip install mysqlclient

I don't know if it's gonna help but i hope it will.

As the official PyPi documentation suggests you need to have the following dependent libraries preinstalled

sudo apt-get install python-dev default-libmysqlclient-dev python3-dev

after that you could do a pip install mysqlclient

Related