0

I have python installed on windows server without internet connection.

Now I want to connect to the SQL Server database on the server via python and therefore wanted to install PyODBC. I downloaded pyodbc-4.0.17.tar.gz from their website from local windows with internet connection, uploaded to the server and tried to install it through the command line via pip install, but get the following error message:

  ERROR: Command errored out with exit status 1:
     command: 'c:\users\a2289770-3\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tok
enize; sys.argv[0] = '"'"'C:\\Users\\A22897~1\\AppData\\Local\\Temp\\3\\pip-req-build-agil8hty\\setup.py'"'"'; __file__=
'"'"'C:\\Users\\A22897~1\\AppData\\Local\\Temp\\3\\pip-req-build-agil8hty\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"
'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exe
c'"'"'))' install --record 'C:\Users\A22897~1\AppData\Local\Temp\3\pip-record-hfui07d3\install-record.txt' --single-vers
ion-externally-managed --compile --install-headers 'c:\users\a2289770-3\appdata\local\programs\python\python37\Include\p
yodbc'
         cwd: C:\Users\A22897~1\AppData\Local\Temp\3\pip-req-build-agil8hty\
    Complete output (5 lines):
    running install
    running build
    running build_ext
    building 'pyodbc' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.micr
osoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\a2289770-3\appdata\local\programs\python\python37\python.exe' -
u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\A22897~1\\AppData\\Local\\Temp\\3\\pip-req-build-a
gil8hty\\setup.py'"'"'; __file__='"'"'C:\\Users\\A22897~1\\AppData\\Local\\Temp\\3\\pip-req-build-agil8hty\\setup.py'"'"
';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec
(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\A22897~1\AppData\Local\Temp\3\pip-record-hfui07d3\
install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\a2289770-3\appdata\local\p
rograms\python\python37\Include\pyodbc' Check the logs for full command output.

So I tried to install Visual C++ 14 but all the installation packages that I tried try to connect to the internet and therefore stop during the installation process.

Can anyone help out here?

Matt444
  • 47
  • 9

1 Answers1

0

Ok I found a solution here: How to install packages offline?

  • creating requirements.txt including all needed packages via pip freeze > requirements.txt

  • Downloading all packages and their dependencies into a directory on local windows with internet connection - also including requirements.txt there (in my case "wheelhouse" via pip download, see link for details)

  • upload that directory onto the Server

  • installing with the following command

    pip install -r wheelhouse/requirements.txt --no-index --find-links wheelhouse

Now I can use pyodbc on the offline server.

I find it strange that it required Microsoft Visual C++ 14.0 before and works now without me having installed it but whatever... if anyone knows the reason for this I would be interested to read it in the comments.

Matt444
  • 47
  • 9