yannforget / pylandsat

Search, download, and preprocess Landsat imagery 🛰️
MIT License
65 stars 18 forks source link

Error: 'sqlite3.Connection' object has no attribute 'enable_load_extension' #14

Open shanedoolane opened 2 years ago

shanedoolane commented 2 years ago

Trying to run

from datetime import datetime
from shapely.geometry import Point
from pylandsat import Catalog, Product

catalog = Catalog()

begin = datetime(2010, 1, 1)
end = datetime(2020, 1, 1)
geom = Point(4.34, 50.85)

# Results are returned as a list
scenes = catalog.search(
    begin=begin,
    end=end,
    geom=geom,
    sensors=['LE07', 'LC08']
)

product_id = scenes[0].get("product_id")

print(scenes)

but erroring out with sqllite3 problem. Anyone seen this issue? Running on pycharm installation

relativityhd commented 8 months ago

You need to install Python with some Feature flags. I deinstalled my python an reinstalled it with PyEnv. Before installing the python version I installed some other libraries which are then automaticly used by PyEnv for the install:

$ sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev libsqlite3-mod-spatialite curl \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
$  PYTHON_CONFIGURE_OPTS="--enable-loadable-sqlite-extensions --enable-optimizations" pyenv install 3.11

Hope this helps

tristannew commented 1 month ago

I have also been having the same issue appear.

I have tried @relativityhd solution without uninstalling python. I already use pyenv so I just set the local version to 3.11 using pyenv local 3.11.

I am still not having any luck though, I was wondering if anyone has solved the issue in the same or a different way?

relativityhd commented 1 month ago

I have also been having the same issue appear.

I have tried @relativityhd solution without uninstalling python. I already use pyenv so I just set the local version to 3.11 using pyenv local 3.11.

I am still not having any luck though, I was wondering if anyone has solved the issue in the same or a different way?

You need to reinstall the python version, so that the PyEnv building script can link the other dependencies to the Python installation. Without that my solution won't work, because the installed Python installation has not been linked to the dependencies.

tristannew commented 1 month ago

Thank you for the response!

I have tried uninstalling, reinstalling and setting the version using

pyenv uninstall 3.11
PYTHON_CONFIGURE_OPTS="--enable-loadable-sqlite-extensions --enable-optimizations" pyenv install 3.11
pyenv local 3.11

It still doesn't seem to be working for me. Would you mind sharing the commands that you would expect to work, please? As I think I am misunderstanding something.

relativityhd commented 1 month ago

Should be the right commands. What exactly is your error message? What other installations are on your system? pyenv versions