Beginner: Python can't find 'pyodbc' package?

python for beginners
python tutorial
python programming for the absolute beginner
python basics
learn python
python for dummies
python download
codecademy python

I am very new to the Python language and have a small program. It had been working but something change and now I can't get it to run. It's having a problem with finding 'pyodbc'. I installed the 'pyodbc' package so I don't understand why there error. I am using Python 3.7.6. Thank you for your help!

pip install pyodbc

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Requirement already satisfied: pyodbc in c:\users\c113850\appdata\roaming\python\python37\site-packages (4.0.28)

Code:

import requests
import pyodbc
from bs4 import BeautifulSoup
from datetime import datetime
import pytz 
import time
import azure.functions

page = requests.get("https://samplepage.html")

if page.status_code == 200:
    print(page.status_code)
    #print(page.content)

    soup = BeautifulSoup(page.content, 'html.parser')
    print(soup.title)
    rows = soup.find_all('tr')
    # for row in rows:          # Print all occurrences
    #    print(row.get_text())
    print(rows[0])
    print(rows[7])
    pjmtime = rows[0].td.get_text()
    print("PJM = ",pjmtime)

    #dt_string = "Tue Jan 21 18:00:00 EST 2020"
    dt_object = datetime.strptime(pjmtime, "%a %b %d %H:%M:%S EST %Y")
    print("Timestamp =", dt_object)

    eastern=pytz.timezone('US/Eastern')
    date_eastern=eastern.localize(dt_object,is_dst=None)
    date_utc=date_eastern.astimezone(pytz.utc)
    print("UTC =", date_utc)

    row = soup.find(text='PRICE').parent.parent
    name = row.select('td')[0].get_text()
    typed = row.select('td')[1].get_text()
    weighted = row.select('td')[2].get_text()
    hourly = row.select('td')[3].get_text()

    server = 'db.database.windows.net'
    database = '...'
    username = '...'
    password = '...'
    driver = '{ODBC Driver 17 for SQL Server}'

    cnxn = pyodbc.connect('DRIVER='+driver+';SERVER='+server+';PORT=1433;DATABASE='+database+';UID='+username+';PWD='+ password)
    cursor = cnxn.cursor()
    print("insert into [PJMLocationalMarginalPrice] ([Name],[Type],[WeightedAverage],[HourlyIntegrated],[TimeStamp]) values(?,?,?,?,?)",
               (name,typed,weighted,hourly,date_utc))
    cursor.execute("insert into [PJMLocationalMarginalPrice] ([Name],[Type],[WeightedAverage],[HourlyIntegrated],[TimeStamp]) values (?,?,?,?,?)",
               (name,typed,weighted,hourly,date_utc))
    cnxn.commit()
else:
    print("Error: page not open")

Error:

Traceback (most recent call last):
  File "c:/Users/C113850/PycharmProjects/Scraping101/Scraping.py", line 2, in <module>
    import pyodbc
ImportError: DLL load failed: The specified module could not be found.

Update: I was looking at the folders under site-packages and noticed that 'pyodbc' folder is not there but 'pyodbc-4.0.28.dist-info' folder is there.

The module was not properly installed.

Try reinstalling it:

pip uninstall pyodbc
pip install pyodbc

If that doesn't work, try using pip3:

pip uninstall pyodbc
pip3 install pyodbc

Beginner's Guide to Python - Python Wiki, This is the program that reads Python programs and carries out their instructions; you need it before you can do any Python programming. Mac� Almost anyone can use it, no matter what computer operating system they have. You can run pretty much any Python program on Windows, Mac, and Linux personal computers and from large servers through to tiny computers like the Raspberry Pi. You can even run Python programs on Android and iOS tablets.

Did you have an active Python Environment when you installed 'pyodbc'. If so, you will want to activate the environment prior to running your script as you wont have access to the package outside that environment.

If not, you may just need to uninstall and re-install.

pip uninstall pyodbc
pip install pyodbc

BeginnersGuide/NonProgrammers, Each of these books can be purchased online and is also available as a completely PythonTurtle A learning environment for Python suitable for beginners and� Python can be used to code a variety of arcade games, adventure games, and puzzle games that you can deploy within a few days. Classics like hangman, tic-tac-toe, ping-pong, and more are all doable with your newly acquired programming skills. The Pygame library makes it even easier to build your own games.

I found something on Github that there is a bug in pyodbc version 4.0.28 so I downgraded to 4.0.27 and that resolved my issue. For more info, click here.

11 Beginner Tips for Learning Python Programming – Real Python, You can save a lot of time if you write out which functions and classes you will need, as well as how they will interact. Tip #3: Go Interactive! Whether you are� Join 575,000 other learners and get started learning Python for data science today! Welcome. Welcome to the LearnPython.org interactive Python tutorial. Whether you are an experienced programmer or not, this website is intended for everyone who wishes to learn the Python programming language.

Learning Python — The Hitchhiker's Guide to Python, At Real Python you can learn all things Python from the ground up. Everything thepythonguru.com is a tutorial focused on beginner programmers. It covers� Yes , C is a type of language which we learn to Know the basic fundamental concept of programming. but in today era Python is best for a beginner or you can also say that first language to learn as a programmer.

Python Projects for Beginners (Massive 2020 Update), But it can be difficult to build Python projects for beginners. Where do you start? What makes a good project? What do you do when you get�

How to Learn Python (Step-by-Step) in 2020 — Dataquest, But even a few seemingly simple lines of code can be incredibly confusing. Dataquest – Python Programming: Beginner Course — I started�

Comments
  • Could be an issue with MVC++. Could you try to check what MVC++ you have installed on your end?
  • I am not sure what MVC++ is.
  • Sorry, I was just caught into the thread I was linking too. MVC++ == Microsoft Visual C++ Redist package
  • I tried un-installing / re-installing and got the same error. Not sure the purpose of 'active' environment. However, I went back to the instructions I was following on the internet and activated the venu and uninstalled/reinstall all my packages and now I get the error on 'requests'. What I did notice though was some package where installed under my user account 'c:\users\c113850\appdata\roaming\python...' and others under 'c:\program files\python37\lib\site-packages\...'