Closed gizmo93 closed 5 years ago
You'll need to compile the FreeTDS shared libraries on Windows and then copy those to the current working directory (or add them to your a location on the search path Windows uses for shared libraries).
Take a look at https://github.com/zillow/ctds/blob/master/windows/freetds-install.ps1 for help on compiling FreeTDS on Windows.
Were you able to get this working?
Hey,
i tried it again now and it does not seem to work.
What i did:
pip install --global-option=build_ext --global-option="--include-dirs=C:\Users\holmo\Desktop\ctds-master\build\include" --global-option=build_ext --global-option="--library-dirs=C:\Users\holmo\Desktop\ctds-master\build\lib" --global-option=build_ext ctds
i needed to remove the --global-option="--rpath=./lib"
part here, because i got error: don't know how to set runtime library search path for MSVC
when using it. Looking at https://github.com/python/cpython/blob/cae8ff93a696aa7d74562a9eeaf27afac1f181b4/Lib/distutils/msvccompiler.py#L539 it seems, that this command is not supported using msvc.
After removing this line, the installation succeeded,
C:\Users\holmo>pip install --global-option=build_ext --global-option="--include-dirs=C:\Users\holmo\Desktop\ctds-master\build\include" --global-option=build_ext --global-option="--library-dirs=C:\Users\holmo\Desktop\ctds-master\build\lib" --global-option=build_ext ctds
c:\users\holmo\appdata\local\programs\python\python35\lib\site-packages\pip\_internal\commands\install.py:206: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
Collecting ctds
Using cached https://files.pythonhosted.org/packages/b4/e5/d21ba30046211c98e733b273551c254839c92ba3e1686470e9a6dc1aa81c/ctds-1.7.0.tar.gz
Installing collected packages: ctds
Running setup.py install for ctds ... done
Successfully installed ctds-1.7.0
however, i still get
>>> import ctds
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\holmo\AppData\Local\Programs\Python\Python35\lib\site-packages\ctds\__init__.py", line 8, in <module>
from _tds import (
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
when i try to import ctds.
After looking at C:\Users\holmo\AppData\Local\Programs\Python\Python35\Lib\site-packages\ctds it seems, that _tds.py is missing here.
Greetings Danny
Are the FreeTDS libraries on your PATH
? e.g. https://github.com/zillow/ctds/blob/master/appveyor/test_script.ps1#L19
Yes. The thing is: I have a _tds.cp35-win_amd64.pyd in my site-packages, which is created when installing ctds using pip with the correct environment variables with the path to the compiled freeTDS includes set (according to: https://zillow.github.io/ctds/install.html). I don't get any error message when installing it. There seems to be a problem when loading the _tds.cp35-win_amd64.pyd and I don't know where to search because i don't have any experience with C-based python libraries.
Do you have some wheel files for windows which should work?
Can you post the full stack trace/error message you get when loading?
Heyy, finally got it working: You were right, it had to do with the FreeTDS includes. I got precompiled binaries from https://ci.appveyor.com/project/FreeTDS/freetds/build/1137/job/00crybi6i68to4pp/artifacts now and now the setup.py is working.
However, i still don't know where the actual error was.
Issue can be closed :-)
Greetings Danny
Just a quick feedback after playing around with it: The BULK inserts are wonderful! Never copied data this fast to SQL Server using Python!
Glad to hear you got it working!
Hey,
i installed ctds according to the docs https://zillow.github.io/ctds/install.html#installing-freetds on Windows 10.
brougt error messages, so i copied the files from build/include and build/lib to \AppData\Local\Programs\Python\Python35\lib and include and after that, the installation via pip install ctds worked.
However when i try import ctds i get:
After looking to site-packages\ctds i saw there are the following files:
\pool__init.py init__.py
no _tdc,py.
So i tried using the "setup.py install" inside ctds-master and i now got a ctds-1.7.0-py3.5-win-amd64.egg subfolder inside my site-packages, which includes:
ctds with init.py and pool subfolder _tds.cp35-win_amd64.pyd _tds.py
however, import ctds still leads to:
Do you see where my mistake is here? Sadly, ctds is the only python SQL Server library which includes support for "real" bulk inserts :(
Greetings Danny