ImproperlyConfigured: MySQL driver not installed!
See original GitHub issueHey, guys. I’m trying to connect to my remote MySQL database using Peewee, but I am getting the following error (in a virtual environment):
Traceback (most recent call last):
File "peewee_test.py", line 2, in <module>
from student import Student
File "/Users/Matthew/Desktop/python-mvc/student.py", line 10, in <module>
db.connect()
File "/Users/Matthew/Desktop/python-mvc/lib/python3.6/site-packages/peewee.py", line 2467, in connect
self._state.set_connection(self._connect())
File "/Users/Matthew/Desktop/python-mvc/lib/python3.6/site-packages/peewee.py", line 3164, in _connect
raise ImproperlyConfigured('MySQL driver not installed!')
peewee.ImproperlyConfigured: MySQL driver not installed!
student.py
from peewee import *
db = MySQLDatabase(
host='host_here',
user='mysql_username_here',
password='mysql_password_here',
database='mysql_db_here'
)
db.connect()
class Student(Model):
firstName = CharField()
lastName = CharField()
class Meta:
database = db
peewee_test.py
from peewee import *
from student import Student
john_doe = Student.create(
firstName='John',
lastName='Doe',
is_relative=False
)
I installed MySQL via Homebrew. This is the version I have:
mysql Ver 14.14 Distrib 5.7.12, for osx10.10 (x86_64) using EditLine wrapper
I also installed PyMySQL
as others have suggested here. Others also suggested installing mysql-python
, but I get an error when when attempting to install it:
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/m7/wyjxzv8s5sdbh2jr35tq55y00000gn/T/pip-build-xh7783h6/mysql-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/private/var/folders/m7/wyjxzv8s5sdbh2jr35tq55y00000gn/T/pip-build-xh7783h6/mysql-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/m7/wyjxzv8s5sdbh2jr35tq55y00000gn/T/pip-build-xh7783h6/mysql-python/
I have two installations of Python on My Mac (running OSX 10.10): Python 2.7 and 3.6. I’m using pip3
to install the above packages.
Thank you for your time!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Python peewee.ImproperlyConfigured: MySQL driver not ...
I tried to fix this by installing this MySQL Driver. But this changed absolutely nothing. Due to me beeing new to python I...
Read more >Peewee MySQL problem after upgrade to 19.10 - Ask Ubuntu
Since the 19.10 upgrade Python peewee can't talk to MySQL anymore: raise ImproperlyConfigured('MySQL driver not installed!') peewee.
Read more >peewee 出现MySQL driver not installed!_见见大魔王的博客
ImproperlyConfigured : MySQL driver not installed!原因分析:peewee不会自己安装驱动,需要手动安装解决方案:pip install pymysql.
Read more >peewee.ImproperlyConfigured: MySQL driver not installed!
ImproperlyConfigured : MySQL driver not installed! peewee自己竟然不去安装驱动,那就自己安装. 解决. pip install pymysql.
Read more >peewee.ImproperlyConfigured: MySQL driver not installed!
【摘要】 在新的环境做部署的项目中使用了peewee,运行后报错peewee.ImproperlyConfigured: MySQL driver not installed! 1 peewee自己竟然不去安装 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Peewee will work with
pymysql
ormysql-python
. It sounds like you have an issue with your module-import path. This is not an issue with Peewee – I’d suggest trying StackOverflow.So for mysql:
MySQLdb
module. Peewee will attempt to use this module if pymysql is not installed.mysql-python
is also called MySQLdb1 and is legacy and should not be used. Since this shares the same module name as mysqlclient, same applies.playhouse.mysql_ext.MySQLConnectorDatabase
.