Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Databases with peewee ORM

Everytime I type sqlite3 with the name of my database in my command line I'm getting this error: "sqlite3 : The term 'sqlite3' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • sqlite3 diary.db
  • ~~~~~~~
    • CategoryInfo : ObjectNotFound: (sqlite3:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException" Which I don't understand because I thought SQLite itself was already installed in python. I'm not sure if this matters but I am using Visual Studio Code as my IDE. Can someone please tell me what I'm doing wrong???

Yes

Megan Amendola
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Megan Amendola
Treehouse Teacher

There are a few extra steps to getting it working locally on windows (compared to mac). Give me a few minutes to test it out on my other computer to remember what those steps are.

Ok!

3 Answers

Megan Amendola
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Megan Amendola
Treehouse Teacher

I had the same issue when I tried to run this command on my windows computer for the first time during a livestream. I talk about it in this video starting at about 4:20.

I'll also try to this out the steps here as best as I can:

1) Download SQLite - Select Precompiled Binaries for Windows choose either the 32 or 64 bit one.

2) Unzip the folder - it will download as a zip file, so you will need to unzip it.

3) Create a folder on your computer called sqlite - mine is inside of my docmuents

4) Move the unzipped folder you downloaded into this new folder called sqlite

5) Now you need to add this location to PATH - I followed these directions NOTE when you get to the step where he says to click new and type in your location, click browse instead. This way you can navigate to the folder and save it to PATH that way. I think it is a lot easier than trying to remember how to type its location.

6) Restart/reopen the terminal

7) Then you should be able to run sqlite3.exe diary.db to open your db in the sqlite shell

Jabr Abumaali
seal-mask
.a{fill-rule:evenodd;}techdegree
Jabr Abumaali
Data Analysis Techdegree Student 4,750 Points

I had accidentally downloaded the DLL instead of the "bundle of command-line tools for managing SQLite database files," but I finally got it working! Thank you all!

Thank you so much!!

Hi. Megan, or anyone else...

I followed all these steps, and then restarted my system. I'm still getting the same error code Jayda quoted above.

If I run C:\>echo %PATH% it shows up and seems to be installed correctly.
Any other thoughts about what might be going on?

Okay, all.

Heavily edited from first comment. Please re-read if you were working from first comment. I THINK I have this working now...

After quite a bit of searching, I found this article, and it worked for me. After I ran everything on this page, I had to go back to the environmental variables and add it to the path, following the directions from the linked page above. Basically, it just requires you to download a different package than listed above.

Just a reminder for people like me, who don't do this every day .... make sure you put the file someplace logical, in the system files if you want any user on the computer to be able to use it. Sqlite will throw an error for any and all spaces in file names, so I decided to install it directly in the C:\ directory.

2nd note, when the zip drive unzips, it creates a new folder, so don't create folder and then have it double-nested. For example, if you want it in the C:\ drive, just select that folder when you browse for a location to unzip. Don't create a file in the C:\ drive, and then select it - it will be double nested.

3rd note - the folder it creates when it unzips has an awful name you'll never want to type again. Make sure to change this immediately, before opening the control panel or the command shell.

4th note - Once it is added to the PATH system variables (see Megan's answer, above), restart the entire system. On most laptops, using restart will be more likely to process the change than shut down. I ended up restarting mine three times before it all started working.

5th note - It is supposed to receive a full file path to open a file, but I haven't gotten this to work. exC:\sqlitecmd> sqlite3 C:/sqlitecmd/sqlitedb/users.db If I use my \cd command to go the file where I the database is stored, and then type just the file name with extension (users.db), it works. ex. C:\sqlitecmd\sqlitedb>sqlite3 users.db Note - once this is added to the PATH, you should be able to access it from anywhere - I just happen to be in the same folder.

6th note - this installation will run with >squlite3 or >sqlite3.exe. My computer doesn't seem to care.

7th note - I don't know why, but mine doesn't seem to run correctly unless the first command I type once I'm in sqlite is .databases. sqlite>.databases. If I figure out why, or a way around this, I'll post back.

https://www.sqlitetutorial.net/download-install-sqlite/

This video was also helpful. https://www.youtube.com/watch?v=wXEZZ2JT3-k