Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqlclient installation failed with error code 1

Tags:

python

mysql

pip

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?

like image 841
James Dean Avatar asked Dec 18 '22 20:12

James Dean


2 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.

like image 96
Bigoz005 Avatar answered Dec 31 '22 12:12

Bigoz005


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

like image 31
kumarD Avatar answered Dec 31 '22 13:12

kumarD