sqlite3.OperationalError:
Hi I,
was trying to use the pylandsat for the first time.
When I try to search in the catalogue, I get the error:
Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.1.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1448, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.1.2\plugins\python-ce\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "E:/___SVN/COP4EE-2/Landcover/Code/gis/Python/landsatdownloader2.py", line 35, in
sensors=['LC08', ] File "E:___SVN\COP4EE-2\Landcover\Code\venv\lib\site-packages\pylandsat\catalog.py", line 99, in search params=(geom, begin, end, maxcloud, sensors, tiers, geom)) File "E:___SVN\COP4EE-2\Landcover\Code\venv\lib\site-packages\pylandsat\database.py", line 67, in query conn = self.connect() File "E:___SVN\COP4EE-2\Landcover\Code\venv\lib\site-packages\pylandsat\database.py", line 62, in connect conn.execute("SELECT load_extension('mod_spatialite');") sqlite3.OperationalError: Eine DLL-Initialisierungsroutine ist fehlgeschlagen.
(a DLL-intialisationroutine failed)
The code: I used for the example is:
from datetime import datetime
from calendar import monthrange
import argparse
from pylandsat import Catalog, Product
from pathlib import Path
import geopandas as gpd
parser = argparse.ArgumentParser("Downloading Landsat 8 for the given COP2EE-2 bounding box from 2018/10/01"
" to 2019/03/30.")
parser.add_argument("vector_path", type=str, help="path to the vector file, for the shape to find the data.")
parser.add_argument("save_path", type=str, help="General save path for Landsat.")
args = parser.parse_args()
observation_period = [(2019, 10), (2019, 11), (2020, 2), (2020, 4), (2020, 5), (2020, 7)]
geom = gpd.read_file(args.vector_path).to_crs(4326).geometry.values[0]
catalog = Catalog()
for year, month in observation_period:
# Request
begin = datetime(year, month, 1)
end = datetime(year, month, monthrange(year, month)[1])
scenes = catalog.search(
begin=begin,
end=end,
geom=geom,
sensors=['LC08', ]
)
scenes = scenes.sort_values(by='cloud_cover', ascending=True)
product_id = scenes.index[0]
The vector file includes an Polygon.
I am using Python 3.7 with virtualenv on windows10.
I encountered the same issue when trying with the search command in command line. Did you solve the issue?
You need to install a library with your systems package manager. For Ubuntu it was:
sudo apt update
sudo apt upgrade
sudo apt install libsqlite3-mod-spatialite