Peter Tilsted
Peter Tilsted

Reputation: 116

How to import pyodbc into Azure Data Studio for use in notebook?

I have installed the latest version of Azure Data Studio (1.6.0) I don't have access to a SQLServer 2017/2019, only 2016, but would like to run some Python against it anyways from the notebooks now available in Azure Data Studio.

I would use pyodbc or pymsssql modules to do this.

but how do i add these modules to the environment?

I have downloaded the module, but when trying to add like this

pip install pyodbc-4.0.26-cp36-cp36m-win_amd64.whl 

i get this error

Fatal error in launcher: Unable to create process using '"d:\0.0.1\python.exe" "c:\Users\bi_pt\azuredatastudio-python\0.0.1\Scripts\pip.exe" '

There is no path 'd:\0.0.1\' in my environment and the python.exe is located here 'c:\Users\bi_pt\azuredatastudio-python\0.0.1\'

any ideas ?

regards Peter

Upvotes: 1

Views: 1803

Answers (2)

You also could go to the folder direction where is the Python version that Azure Data Studio is using and set there a txt with the names of the modules you need. For example: matplotlib
nltk
numpy
pandas
plotly

Put this txt in the same folder, where your python is installed. You could check your Python Path in Azure Data Studio in File / Preferences / Settings / Notebook configuration. Once you have placed your txt. Place in cmd in this path and use pip install -r file.txt or pip install --no-cache-dir -r file.txt

and it works, at least to me! And I could have installed all the several modules I needed!

Upvotes: 1

Peter Tilsted
Peter Tilsted

Reputation: 116

I know i shouldn't answer my own questions but i got these instructions from @MGoCode on Twitter:

"In the notebook choose any kernel other than SQL and click the Install Packages button on the toolbar. That opens a terminal window in ADS where we change to the correct directory and give instructions on how to pip install"

and it works :-)

Upvotes: 3

Related Questions