Error when install python mysql module on windows? - python

When i try to install mysql on windows i get this error
MySQL-python-0.9.2>python setup.py build
running build
running build_py
running build_ext
building '_mysql' extension
error: Unable to find vcvarsall.bat

I guess, you don't have visual c++ compiler installed or compiler not in the PATH.
If you have mingw32, you can pass paramter -c mingw32
And mysql-python is available as binary in windows, you may not need to compile yourself.
UPDATE: OP is using python 2.6, no binaries for 1.2.3 in mysql-python page for windows.
Here is the one I have compiled before

Related

How to install python-crfsuite on windows

I'm trying to install scrapy on win7. One dependency is python-crfsuite. When I run :
pip install python-crfsuite==0.8.4
It fails repeatedly finally giving:
copying pycrfsuite\__init__.py -> build\lib.win32-2.7\pycrfsuite
running build_ext
building 'pycrfsuite._pycrfsuite' extension
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
Are there any precompiled binary files for win32 for this package?
If you already have a version of Microsoft Visual Studio installed with Common tools. All you need to do is run this command.
set VS90COMNTOOLS=%VS140COMNTOOLS%
Assuming you have Visual Studio 14 installed currently.
Adding this answer to help people who are still trying to install python-crfsuite years later.
I was getting an error message about needing to install Microsoft Visual C++ 14.0 when asking pip to install python-crfsuite on Python 3.8, Windows 10. It kept saying Microsoft Visual C++ is needed to create the wheel.
What finally worked for me was to install python-crfsuite on Python 3.7.4.
I suspect it worked because the python-crfsuite wheel on PyPI was not available for Python 3.8, but it was available for Python 3.7. You can the check the package's PyPI page to see which wheels are available
https://pypi.org/project/python-crfsuite/#files
Also, if
pip install python-crfsuite
is not working for you, try downloading the wheel and get pip to install it instead.

Compiler error while installing py-bcrypt in Windows 7

I need to install the Flask module flask-bcrypt which requires py-bcrypt. When I try to install it, an error occurs at:
C:\Users\Param\Downloads\py-bcrypt-0.3>python setup.py install
running install
running bdist_egg
running egg_info
writing py_bcrypt.egg-info\PKG-INFO
writing top-level names to py_bcrypt.egg-info\top_level.txt
writing dependency_links to py_bcrypt.egg-info\dependency_links.txt
reading manifest file 'py_bcrypt.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'py_bcrypt.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
running build_ext
error: don't know how to compile C/C++ code on platform 'nt' with 'MinGW32' comp
iler
What is causing this problem?
Previously, I had installed MinGW32 in my Windows 7 64 bit machine. Is the problem occuring because MinGW is 32 bit and Windows is 64 bit? If so, what should I do to resolve this issue? (How can I use MinGW 64 bit in my machine?)
These libraries are already compiled and available somewhere. Someone already uploaded compiled versions for windows. I was able to run flask-bcrypt in Windows with the files.
You just throw it in your flask/scripts/python packages folder.
It was answered in the Flask subreddit with a location to download the libraries you need:
http://www.reddit.com/r/flask/comments/15q5xj/anyone_have_a_working_version_of_flaskbcrypt_for/
Have a loot at these MinGW binaries. It should be a version of MinGW GCC specifically taylored for building Python extension modules.
this installer tries to fix all the problems with compiling Python distutils extensions with GCC

Install python dev package without yum

I'm currently trying to install a few modules via virtualenv, which I have bootstrapped at the moment, and so far pip and easy_install have been working fine. I am now trying to install the Sybase module; however, it seems I need gcc to install it as I'm getting the following output:
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.6
copying Sybase.py -> build/lib.linux-x86_64-2.6
running build_ext
building 'sybasect' extension
creating build/temp.linux-x86_64-2.6
gcc ...
unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
I am now trying to install the python dev package which I'm assuming will solve my problem; however, I don't have network access from the command line and can't use yum install. Is there a way to install the python dev package from a tar.gz or some other method? or just gcc for virtualenv? My machine does not have a native gcc either and I can't get it at this stage.
Installing python-dev will not solve your problem as you miss GNU C compiler on your system.
Installing that one, will probably fix your issue. python-dev is a secondary and missing that one will result in different type of errors (namely missing headers during compilation process).
And.. if you can't get native gcc, I'm afraid you're out of luck at this point.

Python: How to install mysqldb on windows 7 x64?

Im trying install Mysql-python on windows x64.
I installed python x64, setuptools (checked on the leaf lib, successfully installed) but i can't install mysqldb.
I trying to execute
C:\Users\Fedcomp\Desktop\leaf-0.4\MySQL-python-1.2.3>python
setup.py install
but catch this
In file included from _mysql.c:34:
D:\servers\xampp_server\xampp\mysql\include/config-win.h:211:1: warning: "finite
" redefined
D:\servers\xampp_server\xampp\mysql\include/config-win.h:164:1: warning: this is
the location of the previous definition
D:\servers\xampp_server\xampp\mysql\include/config-win.h:277:1: warning: "HAVE_S
TDDEF_H" redefined
In file included from D:\Python27\include/Python.h:8,
from pymemcompat.h:10,
from _mysql.c:29:
D:\Python27\include/pyconfig.h:673:1: warning: this is the location of the previ
ous definition
error: command 'gcc' failed with exit status 1
also trying with msvc but catch this (MS Visual express installed)
C:\Users\Fedcomp\Desktop\leaf-0.4\MySQL-python-1.2.3>python setup.py install bui
ld --compiler=msvc
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info\PKG-INFO
writing top-level names to MySQL_python.egg-info\top_level.txt
writing dependency_links to MySQL_python.egg-info\dependency_links.txt
reading manifest file 'MySQL_python.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
writing manifest file 'MySQL_python.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
copying MySQLdb\release.py -> build\lib.win-amd64-2.7\MySQLdb
running build_ext
building '_mysql' extension
error: Unable to find vcvarsall.bat
How to install mysqldb correctly on windows x64?
(headers from original mysql installation because, in xampp server they doesn't exist)
Or may someone compile mysqldb for windows python x64 or python x86?
EDIT: mysqlclient has binary packages for both 32bit and 64bit on PyPI. It's a fork of MySQL-python, which hasn't seen a release since 2014.
Original answer left for posterity:
You can find binary installers here (Python 2.6-3.2), here (2.7) or here (2.6). Note that you don't have to use 64bit Python on Windows x64. You can just as well use a 32bit build of Python, for which there are more pre-built 3rd party packages around.
I'm not 100% sure, but I think your path variables are to blame. It seems the compiler isn't found, run a search for vcvarsall.bat and double click it, it should correctly set your path variables. And then try to install again your package.
If you can't find vcvarsall.bat, reinstall MS Visual Express again.
"Unable to find vcvarsall.bat" means that you haven't got the necessary Visual Studio directories in your path.
However, if you are using 64 bit Python then you'll need a 64 bit compiler and Express doesn't come in 64 bit flavours. You could download the SDK MSVC compiler and get that configured but its very hard work.
If I was you I'd switch to 32 bit Python and you can almost surely get pre-built binaries.
EDIT
Pre-built 64 bit binaries as found by piquadrat would be even simpler!

Pygame installation on Windows - error: Unable to find vcvarsall.bat

I have a Win7 64 bit dev machine. I've downloaded and installed Python 2.6.6 32bit. I've also downloaded pygame 1.9.1 for python 2.6 and tried to install it. I got:
C:\pygame-1.9.1release>setup.py install
....
running build_ext
building 'pygame._numericsurfarray' extension
error: Unable to find vcvarsall.bat
What should I do?
(I don't have any compiler or visual studio or anything installed, if it's relevant)
On PyGame's download page - use the msi file which is a dedicated Windows installation instead of downloading the source and executing:
setup.py install
I had a similar problem with a package (Traits) a couple of weeks ago - for me it was because the package was trying to compile extensions and I didn't have Visual Studio. What worked for me was to install MinGW and direct Python to use it as the compiler in the distutils.cfg config file under \Lib\distutils in your Python installation folder. Looks like this page can automate the whole process for you; if you'd prefer to do it manually here's the contents of my distutils.cfg:
[build]
compiler=mingw32
Rerun setup.py and you should be good to go.

Categories

Resources