1
votes

I need to install python connector for running a script to load data into Snowflake. When I run the command "pip install snowflake-connector-python", I am getting many errors related to C-complier and numpy. Python version is 3.8 and pip is upgraded as well. Kindly help me to resolve the package installation issue.

Below is the list of errors from command prompt:

        **compiling C sources
        creating build\temp.win-amd64-3.9\Release\numpy\random
        creating build\temp.win-amd64-3.9\Release\numpy\random\mtrand
        C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNPY_NEEDS_MIN
GW_TIME_WORKAROUND -Inumpy\core\include -Ibuild\src.win-amd64-3.9\numpy\core\include/numpy -Inumpy\core\src\common -Inum
py\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\np
ysort -Ic:\program files\python39\include -Ic:\program files\python39\include -Ibuild\src.win-amd64-3.9\numpy\core\src\c
ommon -Ibuild\src.win-amd64-3.9\numpy\core\src\npymath -Ibuild\src.win-amd64-3.9\numpy\core\src\common -Ibuild\src.win-a
md64-3.9\numpy\core\src\npymath -IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.270
23\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\i
nclude\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Win
dows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcnumpy\
random\mtrand\mtrand.c /Fobuild\temp.win-amd64-3.9\Release\numpy\random\mtrand\mtrand.obj
        mtrand.c
        numpy\random\mtrand\mtrand.c(35419): warning C4244: '=': conversion from 'npy_intp' to 'long', possible loss of
data
        numpy\random\mtrand\mtrand.c(35429): warning C4244: 'function': conversion from 'npy_intp' to 'long', possible l
oss of data
        numpy\random\mtrand\mtrand.c(35496): warning C4244: '=': conversion from 'npy_intp' to 'long', possible loss of
data
        numpy\random\mtrand\mtrand.c(36796): warning C4244: 'function': conversion from 'npy_intp' to 'unsigned long', p
ossible loss of data
        numpy\random\mtrand\mtrand.c(36980): warning C4244: 'function': conversion from 'npy_intp' to 'unsigned long', p
ossible loss of data
        numpy\random\mtrand\mtrand.c(37143): warning C4244: 'function': conversion from 'npy_intp' to 'unsigned long', p
ossible loss of data
        numpy\random\mtrand\mtrand.c(40343): warning C4146: unary minus operator applied to unsigned type, result still
unsigned
        numpy\random\mtrand\mtrand.c(40400): error C2039: 'tp_print': is not a member of '_typeobject'
        c:\program files\python39\include\cpython/object.h(193): note: see declaration of '_typeobject'
        numpy\random\mtrand\mtrand.c(42673): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
        c:\program files\python39\include\cpython/unicodeobject.h(446): note: see declaration of '_PyUnicode_get_wstr_le
ngth'
        numpy\random\mtrand\mtrand.c(42689): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
        c:\program files\python39\include\cpython/unicodeobject.h(446): note: see declaration of '_PyUnicode_get_wstr_le
ngth'
        error: Command "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\Hos
tX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1
 -DNPY_NEEDS_MINGW_TIME_WORKAROUND -Inumpy\core\include -Ibuild\src.win-amd64-3.9\numpy\core\include/numpy -Inumpy\core\
src\common -Inumpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -In
umpy\core\src\npysort -Ic:\program files\python39\include -Ic:\program files\python39\include -Ibuild\src.win-amd64-3.9\
numpy\core\src\common -Ibuild\src.win-amd64-3.9\numpy\core\src\npymath -Ibuild\src.win-amd64-3.9\numpy\core\src\common -
Ibuild\src.win-amd64-3.9\numpy\core\src\npymath -IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tool
s\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\W
indows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program
 Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cp
pwinrt /Tcnumpy\random\mtrand\mtrand.c /Fobuild\temp.win-amd64-3.9\Release\numpy\random\mtrand\mtrand.obj" failed with e
xit status 2
        ----------------------------------------
    ERROR: Command errored out with exit status 1: 'c:\program files\python39\python.exe' -u -c 'import sys, setuptools,
 tokenize; sys.argv[0] = '"'"'C:\\Users\\alarmdsys\\AppData\\Local\\Temp\\2\\pip-install-uvtm9ird\\numpy\\setup.py'"'"';
 __file__='"'"'C:\\Users\\alarmdsys\\AppData\\Local\\Temp\\2\\pip-install-uvtm9ird\\numpy\\setup.py'"'"';f=getattr(token
ize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __
file__, '"'"'exec'"'"'))' install --record 'C:\Users\alarmdsys\AppData\Local\Temp\2\pip-record-_15ijsu3\install-record.t
xt' --single-version-externally-managed --prefix 'C:\Users\alarmdsys\AppData\Local\Temp\2\pip-build-env-xh61rxin\overlay
' --compile --install-headers 'C:\Users\alarmdsys\AppData\Local\Temp\2\pip-build-env-xh61rxin\overlay\Include\numpy' Che
ck the logs for full command output.
    ----------------------------------------
  ERROR: Command errored out with exit status 1: 'c:\program files\python39\python.exe' 'c:\program files\python39\lib\s
ite-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\alarmdsys\AppData\Local\Temp\2\pip-build-env-x
h61rxin\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cython
 >= 0.29' 'numpy==1.14.5; python_version<'"'"'3.7'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"'' setuptools setupt
ools_scm wheel Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files\python39\python.exe' 'c:\program files\python39\lib\sit
e-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\alarmdsys\AppData\Local\Temp\2\pip-build-env-a5q
k21fh\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptoo
ls>=40.6.0' wheel cython 'pyarrow>=0.17.0,<0.18.0' Check the logs for full command output.**
1

1 Answers

2
votes

You seem to be using python 3.9. for this setup, as can be seen from your error message:

ERROR: Command errored out with exit status 1: 'c:\program files\python39\python.exe'

And it is failing while installing numpy, which can be quite tricky to compile from source and is not officially released for python 3.9 yet.

Python version is 3.8

At least your setup is using a 3.9. version. Looking on pypi, whl files for snowflake-connector-python only go up to python 3.7, but you can still try to install from source using your python 3.8 by typing:

c:\program files\python38\python.exe -m pip install snowflake-connector-python

(replace c:\program files\python38\python.exe with the path to your python 3.8. executable)