0

Scenario:

1.I am using Machine learning studio for creating machine learning pipeline and when I am trying to call the .py file which has below code:

import os
os.system(f"pip install pandas")
os.system(f"pip install scikit-learn")
os.system(f"pip install pyodbc")
os.system(f"pip install SQLAlchemy")

import glob
import json
import pandas as pd
from sklearn import preprocessing
import logging
import os
import sys
import pyodbc
import urllib
from sqlalchemy.pool import NullPool
import sqlalchemy

and when I am trying to create and run pipeline from note book getting error:

    Collecting pyodbc
    Downloading pyodbc-4.0.32.tar.gz (280 kB)
    Building wheels for collected packages: pyodbc
    Building wheel for pyodbc (setup.py): started
    Building wheel for pyodbc (setup.py): finished with status 'error
.....
....
....
...
ModuleNotFoundError: No module named 'pyodbc'
Rahul
  • 21
  • 7

1 Answers1

0

Below are the following workarounds that you can try to resolve the error:

Solution 1:

  1. Install the Microsoft ODBC Driver for SQL Server on Windows, from installing microsoft pyodbc driver for SQL server.
  2. Open the cmd.exe as an administrator
  3. Navigate to the python scripts folder that contains pip
  4. Type: pip install pyodbc

Also, refer this Configure development environment for pyodbc Python development document.

Solution 2:
Also if you have already had the pyodbc module installed , and if you are trying to reference it from another environment.

  1. Right click the Python Environments in the Solution Explorer window.
  2. select add/remove
  3. Select the Python interpreter you want to use.

Refer this MSFT document for more information.

Solution 3:
Also to solve your problem you may try simply uninstalling and reinstalling pyodbc.
Use pip uninstall pyodb and confirm by Y to uninstall and then pip install pyodbc to reinstall.

References:

1 .SO import pyodbc leads to No module named pyodbc
2. Github No module named 'pyodbc'