7

I'm trying to install MySQL-python in my virtualenv (Windows 7 32b + Python 2.7.3), but unfortunately after command:

pip install MySQL-python

I get error message:

Install packages failed: Error occurred when installing package MySQL-python. 

The following command was executed:

packaging_tool.py install --build-dir C:\Users\Grzegorz\AppData\Local\Temp\pycharm-packaging3577041299153334552.tmp MySQL-python

The error output of the command:


Downloading/unpacking MySQL-python
  Running setup.py egg_info for package MySQL-python
Traceback (most recent call last):
  File "<string>", line 16, in <module>
  File "C:\Users\Grzegorz\AppData\Local\Temp\pycharm-packaging3577041299153334552.tmp\MySQL-python\setup.py", line 15, in <module>
    metadata, options = get_config()
  File "setup_windows.py", line 7, in get_config
    serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key'])
WindowsError: [Error 2] Nie można odnaleźć określonego pliku
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "<string>", line 16, in <module>

File "C:\Users\Grzegorz\AppData\Local\Temp\pycharm-packaging3577041299153334552.tmp\MySQL-python\setup.py", line 15, in <module>

metadata, options = get_config()

File "setup_windows.py", line 7, in get_config

serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key'])

WindowsError: [Error 2] Nie można odnaleźć określonego pliku

----------------------------------------
Command python setup.py egg_info failed with error code 1 in C:\Users\Grzegorz\AppData\Local\Temp\pycharm-packaging3577041299153334552.tmp\MySQL-python
Storing complete log in C:\Users\Grzegorz\pip\pip.log

If I try to install this package from binary MySQL-python-1.2.3.win32-py2.7.exe then everything install properly, but it's not solution for me. Do you have any suggestions how can I properly install this package on Windows 7 (all other packages I'm able to install without any problems)?

3 Answers 3

22

Did you try using :

 easy_install MySQL-python

It works for me in Windows 7 a long with Virtualenv. I had the same problem with pip.

Sign up to request clarification or add additional context in comments.

1 Comment

Works like a charm! The pip install MySQL-python command tries to compile the library from source (which will fail if Visual Studio is not installed), while easy_install MySQL-python downloads the pre-compiled binary file.
11

If you can install mysql-python globally (in C:/python27) from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

then you can copy paste the following files from "C:/python/lib/site-packages" to your virtual environment "/lib/site-packages"

  1. MySQL_python-1.2.4-py2.7.egg-info(folder)
  2. MySQLdb(folder)
  3. _mysql_exceptions.py/.pyc/.pyo
  4. _mysql.pyd

**Don't need to copy mysql files from "C:\Python27\Lib\site-packages\django\db\backends" or "C:\Python27\Lib\site-packages\django\contrib\gis\db\backends".

Comments

1

There is a Windows MSI installer now on SourceForge. Try that, but if you'd rather build your own, for now (until 1.2.4 is released), you should be able to do this:

pip install http://svn.code.sf.net/p/mysql-python/svn/branches/MySQLdb-1.2/MySQLdb

The above assumes you have Subversion installed.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.