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

error: unable to find vcvarsall.bat #9

Open
fonty422 opened this issue Apr 3, 2016 · 18 comments
Open

error: unable to find vcvarsall.bat #9

fonty422 opened this issue Apr 3, 2016 · 18 comments

Comments

@fonty422
Copy link

fonty422 commented Apr 3, 2016

After working around the stupid issues with python and Anaconda with respect to path issues, i managed to get somewhere with the install. But it now fails with the error message:

error: unable to find vcvarsall.bat

Any suggestions?

@kbrafford
Copy link
Owner

vcvarsall.bat is the script that Microsoft placed in the root of your Visual C++ compiler toolset.

What version of Microsoft Visual Studio are you using?

@fonty422
Copy link
Author

fonty422 commented Apr 3, 2016

Ah, I didn't realise I needed to have that installed. I'll try that and will get back to you if it still fails.
I will note, however, that I did find the vcvarsall.bat file in ...\Microsoft\Visual C++ for Python\9.0.

@qenops
Copy link
Contributor

qenops commented Apr 3, 2016

I just ran into this as well. I have MSVS 12 and found vcvarsall.bat. I'm assuming I need to add that to the path?

Edit: Adding the VC directory of MSVS12 did nothing, just as copying the file to my pyfly2 directory did nothing. I'm working with Win 7 x64, python 2.7 x64 and FlyCapture_2.9.3.11_x64

@kbrafford
Copy link
Owner

I think maybe Cython tries to find the MSVC in all the places it thinks it might be installed.

What if you executed vcvarsall.bat yourself from the same CMD prompt you are trying to build pyfly from? Perhaps that would make it easier for Cython to do whatever it is trying to do.

@qenops
Copy link
Contributor

qenops commented Apr 3, 2016

I did that - it runs just fine. I keep getting the error though. So this is a Cython problem?

@kbrafford
Copy link
Owner

It's either a Cython problem or a "kbrafford doesn't know how to set up Cython properly" problem :-/

Normally I'd do a deeper dive right now, but I am pushed for time until mid week. I'll try to look at it closer by then.

@qenops
Copy link
Contributor

qenops commented Apr 3, 2016

Cool thanks. I'll update with anything I find.

@fonty422
Copy link
Author

fonty422 commented Apr 4, 2016

Yep, just installed all free versions of MSVS and still the same error.
I'll happily wait until you have the time to look into it.

Thanks!

@qenops
Copy link
Contributor

qenops commented Apr 4, 2016

Ok I got it all working (except registering pyfly2 for import anywhere in python...do I need to copy something to site-packages???). To start I already had MSVS 8, 10,11, and 12 installed, but Cython wasn't happy, so I followed the instructions pointed to in Becky's comment here: Windows: Unable to find vcvarsall.bat (cython, other c extensions)

In recap, it ended up making me install MSVS 9.0, and then I had to copy vcvarsall.bat into the VC directory of 9.0 since it didn't have it (and modify it to set the correct version number) from one of the other versions. I then had to make sure the bat file which vcvarsall wanted was in the place it was looking and named properly. After that it compiles great.

So now how do I get it to import from anywhere?

@kbrafford
Copy link
Owner

So now how do I get it to import from anywhere?

I am pretty sure I add the path of the development directory to a file called default.pth placed in the root of my python installation. I'll double check that once I get to my development machine in a couple of hours.

@kbrafford
Copy link
Owner

Here's how I set it up. In my C:\Python27 directory I have a file called default.pth with these lines in it:

C:\Users\kbrafford\Documents\GitHub\pyfly2
C:\Users\kbrafford\Documents\GitHub\pyfly1\src

Those are the paths on my development machine where I have the repos for pyfly1 and pyfly2 checked out. I'm not sure why pyfly1 is different than pyfly2, but that's how I use it.

@nortonsm
Copy link

This just solved it for me!

  1. Install latest x86 FlyCapture2 SDK from Point Grey
  2. Install Microsoft Visual C++ Compiler for Python 2.7 ( [http://aka.ms/vcpython27] )
  3. In your START menu you now have: Microsoft Visual C++ Compiler Package for Python 2.7
    3a) Under this menu launch the "Visual C++ 2008 32-bit Command Prompt"
  4. Set these environment variables:
SET DISTUTILS_USE_SDK=1
SET MSSdk=1
  1. Now run: python setup.py build_ext --inplace

@kbrafford
Copy link
Owner

Thanks, nortonsm! Is it ok if I add your approach to the docs?

@fonty422
Copy link
Author

fonty422 commented Jun 1, 2016

I've tried the above solution from nortonsm, which didn't do anything for me, as I already had the package installed (although I did overwrite, just in case), and I set the environment variables and still the same issue. I modified it for the 32-bit version first, which didn't help, then the 64-bit, which also didn't work.
Any suggestions? I'm mega keen to have python control with a USB3 camera.

@nortonsm
Copy link

nortonsm commented Jun 1, 2016

@fonty422 : So if you launch a CMD window from the Start program menu:
Microsoft Visual C++ Compiler for Python 2.7 -> Visual C++ 2008 32-bit Command Prompt
Then change to the pyfly2-master directory, I get this:

C:\Users\user\Downloads\pyfly2-master-original>cd pyfly2-master

C:\Users\user\Downloads\pyfly2-master-original\pyfly2-master>python setup.py build_ext --inplace
running build_ext
cythoning pyfly2.pyx to pyfly2.c
building 'pyfly2' extension
error: Unable to find vcvarsall.bat

C:\Users\user\Downloads\pyfly2-master-original\pyfly2-master>set distutils_use_sdk=1

C:\Users\user\Downloads\pyfly2-master-original\pyfly2-master>set MSSdk=1

C:\Users\user\Downloads\pyfly2-master-original\pyfly2-master>python setup.py build_ext --inplace
running build_ext
skipping 'pyfly2.c' Cython extension (up-to-date)
building 'pyfly2' extension
creating build
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
C:\Users\user\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS-
 /DNDEBUG -I. "-IC:/Program Files (x86)/Point Grey Research/FlyCapture2\include" -IC:\Python27\include -IC:\Python27\PC /
Tcpyfly2.c /Fobuild\temp.win32-2.7\Release\pyfly2.obj
pyfly2.c
C:\Users\user\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\link.exe /DLL /nologo /INCREMENTAL
:NO "/LIBPATH:C:/Program Files (x86)/Point Grey Research/FlyCapture2\lib/C" /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python2
7\PCbuild FlyCapture2_Cd_v90.lib /EXPORT:initpyfly2 build\temp.win32-2.7\Release\pyfly2.obj /OUT:C:\Users\user\Downloads\
pyfly2-master-original\pyfly2-master\pyfly2.pyd /IMPLIB:build\temp.win32-2.7\Release\pyfly2.lib /MANIFESTFILE:build\temp.
win32-2.7\Release\pyfly2.pyd.manifest
   Creating library build\temp.win32-2.7\Release\pyfly2.lib and object build\temp.win32-2.7\Release\pyfly2.exp

C:\Users\user\Downloads\pyfly2-master-original\pyfly2-master>

So it fails until I issue the two SET commands above.
Can you provide a similar output of your error? Maybe there's some subtlelty that's different...
-Scott

@fonty422
Copy link
Author

fonty422 commented Jun 1, 2016

Sure. I hadn't realised I needed to set those specifically while in the correct folder. That has cleared the inability to find varsall.bat but has left me with a new error:

C:\Users\debooyj\AppData\Local\Continuum\Anaconda\Lib\site-packages\pyfly2-maste
r>python setup.py build_ext --inplace
running build_ext
skipping 'pyfly2.c' Cython extension (up-to-date)
building 'pyfly2' extension
creating build
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
C:\Users\debooyj\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9
.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I. "-IC:/Program Files/Po
int Grey Research/FlyCapture2\include" -IC:\Users\debooyj\AppData\Local\Continuu
m\Anaconda\include -IC:\Users\debooyj\AppData\Local\Continuum\Anaconda\PC /Tcpyf
ly2.c /Fobuild\temp.win-amd64-2.7\Release\pyfly2.obj
pyfly2.c
C:\Users\debooyj\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9
.0\VC\Bin\link.exe /DLL /nologo /INCREMENTAL:NO "/LIBPATH:C:/Program Files/Point
 Grey Research/FlyCapture2\lib64/C" /LIBPATH:C:\Users\debooyj\AppData\Local\Cont
inuum\Anaconda\libs /LIBPATH:C:\Users\debooyj\AppData\Local\Continuum\Anaconda\P
Cbuild\amd64 /LIBPATH:C:\Users\debooyj\AppData\Local\Continuum\Anaconda\PC\VS9.0
\amd64 FlyCapture2_Cd_v90.lib /EXPORT:initpyfly2 build\temp.win-amd64-2.7\Releas
e\pyfly2.obj /OUT:C:\Users\debooyj\AppData\Local\Continuum\Anaconda\Lib\site-pac
kages\pyfly2-master\pyfly2.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\pyfly2.l
ib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\pyfly2.pyd.manifest
python27.lib(python27.dll) : fatal error LNK1112: module machine type 'x64' conf
licts with target machine type 'X86'
error: command 'C:\\Users\\debooyj\\AppData\\Local\\Programs\\Common\\Microsoft\
\Visual C++ for Python\\9.0\\VC\\Bin\\link.exe' failed with exit status 1112

C:\Users\debooyj\AppData\Local\Continuum\Anaconda\Lib\site-packages\pyfly2-maste
r>

@kbrafford
Copy link
Owner

It looks like you are trying to build a 64-bit version, but pyfly2 is a 32-bit library.

@fonty422
Copy link
Author

fonty422 commented Jun 8, 2016

Ah, that makes sense. Following this, I tried another package and had success with pyflycapture2 and it works well. I just had to make a few changes to the wrapper to account for full color images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants