Monday, August 4, 2014

installing pyapns on windows ..not that easy!

  File "C:\Python27\lib\distutils\msvc9compiler.py", line 383, in initialize
    vc_env = query_vcvarsall(VERSION, plat_spec)
  File "C:\Python27\lib\distutils\msvc9compiler.py", line 271, in query_vcvarsal
l
    raise DistutilsPlatformError("Unable to find vcvarsall.bat")
distutils.errors.DistutilsPlatformError: Unable to find vcvarsall.bat
when you get this problem you can to install visual studio 9 
 
I was able to move ahead  by:
  1. Finding vcvarsx86_amd64.bat in C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvarsx86_amd64.bat (depends on your setup)
  2. Open a cmd prompt
  3. Run SET VS90COMNTOOLS=%VS90COMNTOOLS% (depends on setup, seehttp://stackoverflow.com/a/10558328/2362877)
  4. Run vcvarsx86_amd64.bat
  5.  
  6.  "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvarsx86_amd64.bat"

    H:\office projects\event-notification>"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat"
    Setting environment for using Microsoft Visual Studio 2008 x86 tools.
but then i ran into this issue 


https://github.com/pyca/cryptography/issues/762 


   Creating library c:\users\faizan\appdata\local\temp\easy_install-myikuq\crypt
ography-0.1\cryptography\hazmat\primitives\__pycache__\Release\cryptography\hazm
at\primitives\__pycache__\_cffi__x5fea2bacx4a8b9ec1.lib and object c:\users\faiz
an\appdata\local\temp\easy_install-myikuq\cryptography-0.1\cryptography\hazmat\p
rimitives\__pycache__\Release\cryptography\hazmat\primitives\__pycache__\_cffi__
x5fea2bacx4a8b9ec1.exp
_cffi__xd9dc3d0ax8cb54b0a.c
cryptography\hazmat\bindings\__pycache__\_cffi__xd9dc3d0ax8cb54b0a.c(165) : fata
l error C1083: Cannot open include file: 'openssl/asn1.h': No such file or direc
tory
error: c:\users\faizan\appdata\local\temp\easy_install-myikuq\cryptography-0.1\c
ffi-0.8.1-py2.7-win32.egg\_cffi_backend.pyd: Access is denied





  File "C:\Python27\lib\site-packages\cffi\ffiplatform.py", line 50, in _build
    raise VerificationError('%s: %s' % (e.__class__.__name__, e))
cffi.ffiplatform.VerificationError: CompileError: command '"C:\Program Files (x8
6)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2


SET LIB C:\OpenSSL-win32\lib;etc;etc;etc
SET INCLUDE C:\OpenSSL-win32\include;etc;etc
You can add to the system variables like this:
SET LIB=C:\OPenSSL-win32\lib;%LIB%


 File "C:\Python27\lib\site-packages\cffi\verifier.py", line 139, in _compile_module
    outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
  File "C:\Python27\lib\site-packages\cffi\ffiplatform.py", line 25, in compile
    outputfilename = _build(tmpdir, ext)
  File "C:\Python27\lib\site-packages\cffi\ffiplatform.py", line 50, in _build
    raise VerificationError('%s: %s' % (e.__class__.__name__, e))
cffi.ffiplatform.VerificationError:
 LinkError: command '"c:\Program Files (x86)\Microsoft Visual Studio 
9.0\VC\BIN\link.exe"' failed with exit status 1120

  if you are still getting this try these :-

1) reinstall pip http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows