pythonjupyter-notebookcondageospatialpysqlite

segment-geospatial installation breaks jupyter lab in Ubuntu


I would like to install jupyter inside a conda environment and then install segment-geospatial, a python library from samgeo.

However installing segment-geospatial breaks something that causes jupyter notebooks to stop working. Jupyter lab works before I install the package. After I install it, I receive the following error when I try to start jupyter lab:

ModuleNotFoundError: No module named 'pysqlite2'

Any ideas on how to fix this?

Here's the steps I took:

conda create -c conda-forge -n MY_ENV_NAME python pandas jupyter ipykernel

conda activate MY_ENV_NAME
jupyter lab
# jupyter lab opens fine

conda install segment-geospatial
#install completes fine

jupyter lab
# jupyter lab does not open, I receive the error:

ModuleNotFoundError: No module named 'pysqlite2'

I'm using Ubuntu 22.04


Solution

  • Try installing segment-geospatial following documentation for samgeo on their Installation page, then installing jupyter inside your environment.

    These steps worked for me to avoid breaking jupyter lab or jupyter notebooks.

    conda create -n MY_ENV_NAME python
    conda activate MY_ENV_NAME
    conda install -c conda-forge mamba
    mamba install -c conda-forge segment-geospatial
    
    #install optional dependencies
    mamba install -c conda-forge groundingdino-py segment-anything-fast
    
    #install jupyter last
    conda install jupyter
    
    #open jupyter lab
    jupyter lab
    

    With this installation order, jupyter lab installs fine and I can use segment-geospatial inside my jupyter notebooks.