question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Installation on Ubuntu 20.04 - cannot find mysql-connector-python

See original GitHub issue

I have tried this every possible way. Following the documented installation instructions, I ran:

pip install csvkit
pip install mysql-connector-python
csvsql -v mysql://user:password@host/db --insert file.csv

This results in the following, which seems to suggest that it’s failing to load or make use of SQLAlchemy. Any help would be greatly appreciated.

Traceback (most recent call last):
  File "/home/brian/.local/bin/csvsql", line 8, in <module>
    sys.exit(launch_new_instance())
  File "/home/brian/.local/lib/python2.7/site-packages/csvkit/utilities/csvsql.py", line 221, in launch_new_instance
    utility.run()
  File "/home/brian/.local/lib/python2.7/site-packages/csvkit/cli.py", line 118, in run
    self.main()
  File "/home/brian/.local/lib/python2.7/site-packages/csvkit/utilities/csvsql.py", line 110, in main
    raise ImportError('You don\'t appear to have the necessary database backend installed for connection string you\'re trying to use. Available backends include:\n\nPostgresql:\tpip install psycopg2\nMySQL:\t\tpip install mysql-connector-python\n\nFor details on connection strings and other backends, please see the SQLAlchemy documentation on dialects at: \n\nhttp://www.sqlalchemy.org/docs/dialects/\n\n')
ImportError: You don't appear to have the necessary database backend installed for connection string you're trying to use. Available backends include:

Postgresql:     pip install psycopg2
MySQL:          pip install mysql-connector-python

For details on connection strings and other backends, please see the SQLAlchemy documentation on dialects at: 

http://www.sqlalchemy.org/docs/dialects/

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mstralkacommented, Mar 4, 2021

@sido420 I dug through the SQLAlchemy documentation and read this warning for the mysql-connector-python: https://docs.sqlalchemy.org/en/14/dialects/mysql.html#module-sqlalchemy.dialects.mysql.mysqlconnector image

So I switched to the mysqldb module homepage client and installed it like this on Ubuntu 20.04 with python 3:

sudo apt install python3-dev default-libmysqlclient-dev build-essential
pip3 install csvkit
pip3 install mysqlclient

Then I changed my connection string like this:

mysql+mysqldb://user:pass@host/database

That made csvsql work. Hope that helps

0reactions
gmuccommented, Aug 18, 2021

“Hope that helps” > it helps perfect, the usage of pip3 is the point (not pip!!!)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Install MySQL Connector Python on Windows, MAC, Linux, Unix
Go to download MySQL Connector python for Ubuntu from here. · Select the Operating system Ubuntu Linux from the drop-down. · Select the...
Read more >
Installing Connector/Python with pip - MySQL :: Developer Zone
This is the recommended way to install Connector/Python. Make sure you have a recent pip version installed on your system. If your system ......
Read more >
"pip install MySQL-python" not working on Ubuntu 20.04
When I try to install MySQL-python using pip for Python 2.7, it is not working anymore on Ubuntu 20.04 - on Ubuntu 18.04...
Read more >
Install MySQL Connector Python On Ubuntu Linux and Verify ...
In this video we will learn to Install MySQL Connector / Python On Ubuntu Linux and Verify the Installation.
Read more >
trying to install mysql-connector for python 3 - Ask Ubuntu
says to create the virtual environment, activate it and then proceed to pip install whatever package you need. however, when i get as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found