5

I'm doing some PoC work with Python integration in SQL Server 2017.

I have got the basic steps working, & have completed this example successfully: https://learn.microsoft.com/en-us/sql/advanced-analytics/tutorials/run-python-using-t-sql

For the PoC I'm trying to complete, I need to us some external python modules (for example tensorflow) that don't seem to come with the standard python libraries that are bundled with SQL Server.

In a standard python IDE, I would just do install with pip or git clone. If I do this on the server that is running SQL Server it completes successfully, but I can't seem to use the external modules from TSQL.

Error message is:

ImportError: No module named 'tensorflow'

Does anyone know if it is possible to do this?

I've tried googling, but not much coming back. I guess as this is such a new feature that there isn't a huge amount of knowledge in the community.

András Váczi
31.8k13 gold badges103 silver badges152 bronze badges
asked Oct 20, 2017 at 7:54
2

1 Answer 1

4

Just in case someone finds this question when searching the net

I logged an advisory case with MS as I needed an answer on this. They have come back to me with the following method that works:

Open a command prompt (as administrator) and navigate to the python directory (and inside the scripts directory)

cd c:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\PYTHON_SERVICES\Scripts\Python
pip install <packagename>

Nb: There is a cleaner way to do this with R packages, but this functionality is not there for python yet. I would assume in later versions that a similar process will be available for python: https://learn.microsoft.com/en-us/sql/advanced-analytics/r/install-additional-r-packages-on-sql-server

András Váczi
31.8k13 gold badges103 silver badges152 bronze badges
answered Oct 26, 2017 at 8:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.