pip install unable to find vcvarsall.bat

oserin 21 Reputation points
2021-12-16T13:10:14.59+00:00

Hello,

I got an error when trying to install robotframework-ride either via Visual Studio (Professional 2022) Python (3.9 installed via visual studio installer) Environment or pip (provided by visual studio) install.

I searched for vcvarsall.bat and found in : C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build

I tried adding it to PATH or setting VS100COMNTOOLS in command prompt before running pip install but that didn't help.

I have the Python native development-tools installed and Live Share installed.

----- Installing 'robotframework-ride' -----
Collecting robotframework-ride
  Using cached robotframework-ride-1.7.4.2.tar.gz (846 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting wxPython<=4.0.7.post2
  Using cached wxPython-4.0.7.post2.tar.gz (68.9 MB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting PyPubSub
  Using cached Pypubsub-4.0.3-py3-none-any.whl (61 kB)
Collecting Pygments
  Using cached Pygments-2.10.0-py3-none-any.whl (1.0 MB)
Collecting Pywin32
  Using cached pywin32-302-cp39-cp39-win_amd64.whl (9.3 MB)
Requirement already satisfied: pillow in c:\users\myntid\appdata\roaming\python\python39\site-packages (from wxPython<=4.0.7.post2->robotframework-ride) (8.4.0)
Requirement already satisfied: six in c:\users\myntid\appdata\roaming\python\python39\site-packages (from wxPython<=4.0.7.post2->robotframework-ride) (1.16.0)
Requirement already satisfied: numpy in c:\users\myntid\appdata\roaming\python\python39\site-packages (from wxPython<=4.0.7.post2->robotframework-ride) (1.21.4)
Using legacy 'setup.py install' for robotframework-ride, since package 'wheel' is not installed.
Using legacy 'setup.py install' for wxPython, since package 'wheel' is not installed.
Installing collected packages: wxPython, Pywin32, PyPubSub, Pygments, robotframework-ride
    Running setup.py install for wxPython: started
    Running setup.py install for wxPython: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\myntid\\AppData\\Local\\Temp\\pip-install-ozgdr8k0\\wxpython_a7138ebdeb574a07b80c474376e7aa7f\\setup.py'"'"'; __file__='"'"'C:\\Users\\myntid\\AppData\\Local\\Temp\\pip-install-ozgdr8k0\\wxpython_a7138ebdeb574a07b80c474376e7aa7f\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\myntid\AppData\Local\Temp\pip-record-vywhqx7l\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\Include\wxPython'
         cwd: C:\Users\myntid\AppData\Local\Temp\pip-install-ozgdr8k0\wxpython_a7138ebdeb574a07b80c474376e7aa7f\
    Complete output (39 lines):
    C:\Users\myntid\AppData\Roaming\Python\Python39\site-packages\setuptools\dist.py:723: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
      warnings.warn(
    C:\Users\myntid\AppData\Roaming\Python\Python39\site-packages\setuptools\dist.py:300: DistDeprecationWarning: use_2to3 is ignored.
      warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
    running install
    C:\Users\myntid\AppData\Roaming\Python\Python39\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    running build
    Will build using: "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\python.exe"
    3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)]
    Python's architecture is 64bit
    cfg.VERSION: 4.0.7.post2

    Running command: build
    Running command: build_wx
    Command '"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\python.exe" -c "import distutils.msvc9compiler as msvc; mc = msvc.MSVCCompiler(); mc.initialize(); print(mc.cc)"' failed with exit code 1.
    Traceback (most recent call last):

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

      File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\distutils\msvc9compiler.py", line 371, in initialize

        vc_env = query_vcvarsall(VERSION, plat_spec)

      File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\distutils\msvc9compiler.py", line 260, in query_vcvarsall

        raise DistutilsPlatformError("Unable to find vcvarsall.bat")

    distutils.errors.DistutilsPlatformError: Unable to find vcvarsall.bat
    Finished command: build_wx (0.156s)
    Finished command: build (0.156s)
    WARNING: Building this way assumes that all generated files have been
    generated already.  If that is not the case then use build.py directly
    to generate the source and perform the build stage.  You can use
    --skip-build with the bdist_* or install commands to avoid this
    message and the wxWidgets and Phoenix build steps in the future.

    "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\python.exe" -u build.py build
    Command '"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\python.exe" -u build.py build' failed with exit code 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\myntid\\AppData\\Local\\Temp\\pip-install-ozgdr8k0\\wxpython_a7138ebdeb574a07b80c474376e7aa7f\\setup.py'"'"'; __file__='"'"'C:\\Users\\myntid\\AppData\\Local\\Temp\\pip-install-ozgdr8k0\\wxpython_a7138ebdeb574a07b80c474376e7aa7f\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\myntid\AppData\Local\Temp\pip-record-vywhqx7l\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\Include\wxPython' Check the logs for full command output.
----- Failed to install 'robotframework-ride' -----
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
936 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 23,141 Reputation points Microsoft Vendor
    2021-12-17T03:44:31.897+00:00

    Hi @oserin ,

    Welcome to Microsoft Q&A!

    You have run across the problem of Unable to find vcvarsall.bat when you compile the wheel of wxPython as you only have the tar.gz instead of .whl of it. Could you try to install wxPython manually?

    pip uninstall wxPython
    pip --no-cache-dir install wxPython==4.0.7.post2

    If you run across this problem again when you compile the wheel for the robotframework-ride-1.7.4.2.tar.gz. Could you try to follow these steps, some people had run across a similar problem:

    open up proper developer command prompt from VS 2019, normal for 32bit
    Python and x64 for 64bit Python.

    set DISTUTILS_USE_SDK=1
    set MSSdk=1

    After setting those setuptools/distutils trusts that user know better
    and doesn't try to do any autodetection. Now config and build will
    work.

    If it still does not work, could you try to switch to the anaconda environment and/or update the python version to python 3.10?

    Sincerely,
    Anna
    *
    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.