Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't install MySQLdb/MySQL
#1
Vitals: MacOS, Python 2.7

I've found myself in a catch22. I need to connect to a MySQL database. In order to get MySQL too work with python, I need to get MySQL and the MySQL connector.

In order to get this, I need pip. In order to get pip, I either need to download the source - which fails when i run the .py install - or I need to use easy_install pip.

When I run easy_install, I receive an error (even if im just checking the version).

MyComputer:~ user$ easy_install --version
Traceback (most recent call last):
  File "/usr/bin/easy_install-2.7", line 11, in <module>
    load_entry_point('setuptools==18.5', 'console_scripts', 'easy_install')()
  File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 484, in load_entry_point
  File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 2707, in load_entry_point
  File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 2325, in load
  File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 2331, in resolve
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 46, in <module>
    from setuptools.archive_util import unpack_archive
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/archive_util.py", line 15, in <module>
    from pkg_resources import ensure_directory, ContextualZipFile
ImportError: cannot import name ContextualZipFile
The suggested fixes I've found suggest opening archive_util.py and removing the "import ContextualZipFile". However, the python that the system is referring to is the copy that came preinstalled on the system. I cannot make changes to this one.

I have another copy under User - its archive_util.py does not import ContextualZipFile.

I attempted to look for a way to use the /user version instead - suggestions were to modify ~/.bash-profile. This did not work.

I've been at this for days and I'm nearly at wits end.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Mysql and mysql.connector error lostintime 2 687 Oct-03-2023, 10:25 PM
Last Post: lostintime
  Mysql error message: Lost connection to MySQL server during query tomtom 6 16,127 Feb-09-2022, 09:55 AM
Last Post: ibreeden
Question Debian 11 Bullseye | Python 3.9.x | pip install mysql-connector-python-rf problems BrandonKastning 4 6,696 Feb-05-2022, 08:25 PM
Last Post: BrandonKastning
  MySQLdb._exceptions.ProgrammingError: not enough arguments for format string. farah97 0 3,342 Jan-22-2020, 03:49 AM
Last Post: farah97
  How to acquire MySQLdb sunstar20 8 5,998 Apr-23-2018, 05:16 AM
Last Post: sunstar20
  MySQLdb, problem with query with user-defined variables buran 6 6,411 Feb-03-2017, 06:16 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020