Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append a user-friendly message after 'Unable to find vcvarsall.bat' explaining how to fix the problem #942

Closed
hickford opened this issue May 14, 2013 · 11 comments
Labels
auto-locked Outdated issues that have been locked by automation OS: windows Windows specific

Comments

@hickford
Copy link

There are millions of Python developers on Windows. They would like to use libraries. If they succeed in installing pip, this is typically their first experience with it:

$ pip install numpy

blah blah blah

Error: Unable to find vcvarsall.bat

And often their last. That cryptic message "Unable to find vcvarsall.bat" is meaningless to most people, and sends users on a fool's errand (trying to download a file called vcvarsall.bat).

Ideally, package management would work out the box but if that can't be done, it would be courteous to make the error more user-friendly with instructions how to actually fix the problem. I suggest

Error: Installing this package requires a C compiler, which you do not have. To fix this error, install and configure a C compiler following http://stackoverflow.com/q/2817869/284795


For comparison, Ruby ships with a package manager, Gem. If a user tries to install a package with C extensions but doesn't have a C compiler installed, they are given this user-friendly message:

Please update your PATH to include build tools or download the DevKit from 'http://rubyinstaller.org/downloads' and follow the instructions at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

@BenjaminSchaaf
Copy link

I'd like to bump this, it's really annoying and causes great pain to those that just want to use python without having to depend on a C compiler

@pfmoore
Copy link
Member

pfmoore commented Jul 24, 2013

That message comes from Python's distutils. You need to file a request at http://bugs.python.org if you want this changed.

@pfmoore pfmoore closed this as completed Jul 24, 2013
@hickford
Copy link
Author

Reported upstream at Python.org http://bugs.python.org/issue2943 please vote for it. If you feel strongly, make a python.org account and comment.

@srw
Copy link

srw commented Dec 16, 2013

The message appears even if you have a C compiler...

Here I found the best answer: http://stackoverflow.com/questions/2667069/cannot-find-vcvarsall-bat-when-running-a-python-script

Python is not recognizing newer versions of Visual Studio

@jerusalemprogrammer
Copy link

Hi,
I have stumbled across this issue now tonight trying myself to install the NumPy package - I still cannot find a clear answer.

Does anyone know how I can get past this error so that I can install only NumPy and not have to download Enthought or Anaconda packages?

Thanks.

@hickford
Copy link
Author

@jerusalemprogrammer the easiest way to install Numpy on vanilla Python is the Windows installers at http://www.lfd.uci.edu/~gohlke/pythonlibs/

@jerusalemprogrammer
Copy link

Hi Mr. Hickford,

Thanks for the prompt reply.

I have seen these referred to - but am suspicious of third-party software
that is not from large established, trusted group.

Are there any other solutions?

I read that Python needed C compiler, so it was recommended to download
Visual Studio - so I did, but this didn't work.

Do you know of any other solution?

Thanks.

kindest regards,

On Tue, Dec 23, 2014 at 11:57 AM, Matt Hickford notifications@github.com
wrote:

@jerusalemprogrammer https://github.com/jerusalemprogrammer the easiest
way to install Numpy on vanilla Python is the Windows installers at
http://www.lfd.uci.edu/~gohlke/pythonlibs/


Reply to this email directly or view it on GitHub
#942 (comment).

@lrq3000
Copy link

lrq3000 commented Apr 5, 2015

Yes there is a solution:

  1. install Microsoft Visual C++ Compiler for Python from http://www.microsoft.com/en-us/download/details.aspx?id=44266
  2. Enter MSVC for Python command prompt
  3. SET DISTUTILS_USE_SDK=1
  4. SET MSSdk=1
  5. you can then build your C extensions: python.exe setup.py ...

Steps 2 to 4 must be reproduced everytime before building your C extensions. This is because of an issue with the VCForPython27.msi which install the header files and vcvarsall.bat in folders of a different layout than the VS2008 SDK and thus confuse the compiler detection of distutils. This will get fixed in setuptools in Python 2.7.10.

Bug report and workaround by Gregory Szorc:
http://bugs.python.org/issue23246

@MikeTam1021
Copy link

Irq3000... your directions are not simple and clear enough for me. Enter MSVC where? Where and how am I doing these things?... I downloaded that, I am still without a clue.

@xavfernandez xavfernandez added the OS: windows Windows specific label Oct 27, 2015
@lrq3000
Copy link

lrq3000 commented Oct 28, 2015

@MikeTam1021 More up to date info can now be found here:
https://github.com/cython/cython/wiki/CythonExtensionsOnWindows

In particular, you can just import setuptools instead of distutils and this should correctly load the VCForPython27 compiler.

Else if you really want to use the commands I described above, you just have to set them in a console, so just run cmd.exe and type the commands there.

@MikeTam1021
Copy link

thanks Irq3000, that worked

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation OS: windows Windows specific
Projects
None yet
Development

No branches or pull requests

8 participants