#πŸ”’ How To Fix "ModuleNotFoundError: No module named '_sqlite3"?

15 messages Β· Page 1 of 1 (latest)

jade gorge
#

so i have a Linux server that i am renting (no root access but i can install stuff to it if i build from source) and it has sqlite and sqlite3 installed on it (can use them easily when typing "sqlite" and "sqlite3" in the cli when i ssh into the server) yet whenever i try to run a script that i am using that scrapes images from websites it always errors out with "ModuleNotFoundError: No module named '_sqlite3'" anyway i can fix this? is python not wanting to read the sqlite programs i have or are those something completely different?

inner fractalBOT
#

@jade gorge

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

prime oasis
#

is it a Debian-based distro, like Ubuntu?

#

I dimly recall that on Ubuntu Focal (which is pretty old) I had to build my own python in order to get sqlite 😦

tidal coral
prime oasis
#

oh indeed, pyenv is the way to go

#

[I've just now installed a bare focal box, and the ancient built-in python indeed seems to have sqlite support, so I don't know why I thought it didn't]

jade gorge
# tidal coral iirc you need the libsqlite3-dev headers (or similar for whatever distro you use...

update i had build it and installed it to my users local directory but i think i found my issue as when i ran the following commands to set the environment variables before installing python i did this

export LDFLAGS="-L$HOME/.local/lib"
export CPPFLAGS="-I$HOME/.local/include"
export PKG_CONFIG_PATH="$HOME/.local/lib/pkgconfig"

instead of this:

export LDFLAGS="-L$HOME/local/lib"
export CPPFLAGS="-I$HOME/local/include"
export PKG_CONFIG_PATH="$HOME/local/lib/pkgconfig"

.local instead of local just before i downloaded python using pyenv lol.

tidal coral
#

huh, i thought .local/ was the conventional name for that directory

jade gorge
#

now that i think about it i do have a .local folder when i ibuilt and installed sqlite the first time although i was still getting that sqlite3 error, when i build it a second time i must've did local instaead of .local anyway somehow it didn't want to read the files in .local and only read the stuff in local instead. anyway at least i have it fixed and can use my script lol

#

although not sure how long i have until these errors come bite me in the butt lol.

inner fractalBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

πŸ”’ How To Fix "ModuleNotFoundError: No module named '_sqlite3"?