4

Python 3.3, pip is installed and PATH is:

C:\Python33\Scripts 

I have downloaded visual c++ 2010, do I need to change any configuration or add the .bat file to python 33 package from vc++?

When I try to install pyodbc I get the following:

C:\Users\elyon>pip install https://pyodbc.googlecode.com/files/pyodbc-3.0.7.zip Collecting https://pyodbc.googlecode.com/files/pyodbc-3.0.7.zip   Using cached https://pyodbc.googlecode.com/files/pyodbc-3.0.7.zip Installing collected packages: pyodbc   Running setup.py install for pyodbc
    building 'pyodbc' extension
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\elyon\appdata\local\temp\pip-30p009-build\setup.py", lin e 288, in <module>
        main()
      File "c:\users\elyon\appdata\local\temp\pip-30p009-build\setup.py", lin e 108, in main
        setup(**kwargs)
      File "C:\Python33\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Python33\lib\distutils\dist.py", line 917, in run_commands
        self.run_command(cmd)
      File "C:\Python33\lib\distutils\dist.py", line 936, in run_command
        cmd_obj.run()
      File "C:\Python33\lib\site-packages\setuptools-12.0.3-py3.3.egg\setuptools \command\install.py", line 61, in run
      File "C:\Python33\lib\distutils\command\install.py", line 569, in run
        self.run_command('build')
      File "C:\Python33\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Python33\lib\distutils\dist.py", line 936, in run_command
        cmd_obj.run()
      File "C:\Python33\lib\distutils\command\build.py", line 126, in run
        self.run_command(cmd_name)
      File "C:\Python33\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Python33\lib\distutils\dist.py", line 936, in run_command
        cmd_obj.run()
      File "C:\Python33\lib\site-packages\setuptools-12.0.3-py3.3.egg\setuptools \command\build_ext.py", line 50, in run
      File "C:\Python33\lib\distutils\command\build_ext.py", line 347, in run
        self.build_extensions()
      File "C:\Python33\lib\distutils\command\build_ext.py", line 456, in build_ extensions
        self.build_extension(ext)
      File "C:\Python33\lib\site-packages\setuptools-12.0.3-py3.3.egg\setuptools \command\build_ext.py", line 183, in build_extension
      File "C:\Python33\lib\distutils\command\build_ext.py", line 511, in build_ extension
        depends=ext.depends)
      File "C:\Python33\lib\distutils\msvc9compiler.py", line 460, in compile
        self.initialize()
      File "C:\Python33\lib\distutils\msvc9compiler.py", line 371, in initialize

        vc_env = query_vcvarsall(VERSION, plat_spec)
      File "C:\Python33\lib\site-packages\setuptools-12.0.3-py3.3.egg\setuptools \msvc9_support.py", line 52, in query_vcvarsall
      File "C:\Python33\lib\distutils\msvc9compiler.py", line 287, in query_vcva rsall
        raise ValueError(str(list(result.keys())))
    ValueError: ['path']
    Complete output from command C:\Python33\python.EXE -c "import setuptools, t okenize;__file__='c:\\users\\elyon\\appdata\\local\\temp\\pip-30p009-build\\s etup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace(' \r\n', '\n'), __file__, 'exec'))" install --record c:\users\elyon\appdata\loc al\temp\pip-v0vcs5-record\install-record.txt
--single-version-externally-managed  --compile:
    running install

    running build

    running build_ext

    building 'pyodbc' extension

    Traceback (most recent call last):

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

      File "c:\users\elyon\appdata\local\temp\pip-30p009-build\setup.py", lin e 288, in <module>

        main()

      File "c:\users\elyon\appdata\local\temp\pip-30p009-build\setup.py", lin e 108, in main

        setup(**kwargs)

      File "C:\Python33\lib\distutils\core.py", line 148, in setup

        dist.run_commands()

      File "C:\Python33\lib\distutils\dist.py", line 917, in run_commands

        self.run_command(cmd)

      File "C:\Python33\lib\distutils\dist.py", line 936, in run_command

        cmd_obj.run()

      File "C:\Python33\lib\site-packages\setuptools-12.0.3-py3.3.egg\setuptools \command\install.py", line 61, in run

      File "C:\Python33\lib\distutils\command\install.py", line 569, in run

        self.run_command('build')

      File "C:\Python33\lib\distutils\cmd.py", line 313, in run_command

        self.distribution.run_command(command)

      File "C:\Python33\lib\distutils\dist.py", line 936, in run_command

        cmd_obj.run()

      File "C:\Python33\lib\distutils\command\build.py", line 126, in run

        self.run_command(cmd_name)

      File "C:\Python33\lib\distutils\cmd.py", line 313, in run_command

        self.distribution.run_command(command)

      File "C:\Python33\lib\distutils\dist.py", line 936, in run_command

        cmd_obj.run()

      File "C:\Python33\lib\site-packages\setuptools-12.0.3-py3.3.egg\setuptools \command\build_ext.py", line 50, in run

      File "C:\Python33\lib\distutils\command\build_ext.py", line 347, in run

        self.build_extensions()

      File "C:\Python33\lib\distutils\command\build_ext.py", line 456, in build_ extensions

        self.build_extension(ext)

      File "C:\Python33\lib\site-packages\setuptools-12.0.3-py3.3.egg\setuptools \command\build_ext.py", line 183, in build_extension

      File "C:\Python33\lib\distutils\command\build_ext.py", line 511, in build_ extension

        depends=ext.depends)

      File "C:\Python33\lib\distutils\msvc9compiler.py", line 460, in compile

        self.initialize()

      File "C:\Python33\lib\distutils\msvc9compiler.py", line 371, in initialize


        vc_env = query_vcvarsall(VERSION, plat_spec)

      File "C:\Python33\lib\site-packages\setuptools-12.0.3-py3.3.egg\setuptools \msvc9_support.py", line 52, in query_vcvarsall

      File "C:\Python33\lib\distutils\msvc9compiler.py", line 287, in query_vcva rsall

        raise ValueError(str(list(result.keys())))

    ValueError: ['path']

    ----------------------------------------
    Command "C:\Python33\python.EXE -c "import setuptools, tokenize;__file__='c: \\users\\elyon\\appdata\\local\\temp\\pip-30p009-build\\setup.py';exec(compil e(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file
__, 'exec'))" install --record c:\users\elyon\appdata\local\temp\pip-v0vcs5-r ecord\install-record.txt --single-version-externally-managed
--compile" failed w ith error code 1 in 
c:\users\elyon\appdata\local\temp\pip-30p009-build

This is the code:

import pyodbc
print pyodbc.dataSources()
print "Connecting via ODBC"
conn = pyodbc.connect("DRIVER={Netezza};SERVER=netezza201;PORT=5480;DATABASE=Test;UID=CompanyUser;PWD=Password!;")
cursor = conn.cursor()
Forge
  • 5,854
  • 6
  • 41
  • 58
elyon
  • 171
  • 2
  • 5
  • 16
  • You need to add the python script path (where `pip` is installed) to your `PATH` environment variable. – Wolph Jan 18 '15 at 19:22
  • i see python27 and python34 packages in my c drive ...i have deleted the other package ...while in my system variables it points to python27 and python27/pip ..still when i do pip after deleting the other package i still get pip not found as an internal or external command – elyon Jan 18 '15 at 19:23
  • Try this guide to install `pip` properly: http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows – Wolph Jan 18 '15 at 19:25
  • I have edited my question and have added the PATH variable the path to my scripts folder still i get the error (please see the updated question ) – elyon Jan 19 '15 at 15:28
  • Possible duplicate of [Unable to install pyodbc](http://stackoverflow.com/questions/28031311/unable-to-install-pyodbc) – Gord Thompson Dec 22 '16 at 11:54

1 Answers1

1

I had this problem under Python 2.7.9 using SQLAlchemy and the solution was to unpack the pyodbc .egg file in my site-packages folder. I must note that I didn't compile it myself, I downloaded the binary (pyodbc-3.0.7.win32-py2.7.exe) and I installed it using easy_install pyodbc-3.0.7.win32-py2.7.exe

P.S: Newer .whl type installers can be found here, you can install them using pip install [.whl file]. That might also help you get pyodbc installed.


Navigate to the \Lib\site-packages folder for your current virtualenv (or under your main Python installation folder if you're not using a virtualenv).

Rename pyodbc-3.0.7-py2.7-win32.egg to pyodbc-3.0.7-py2.7-win32.zip.

Extract the zip file and place the contents directly in your \Lib\site-packages folder.

After I did this the pyodbc module go recognised and SQLAlchemy could import it.

Erik Oosterwaal
  • 3,912
  • 1
  • 36
  • 60