Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Potential project problems and how to approach them

How to use this page

When something fails, avoid changing several things at once.

A useful debugging sequence is:

What failed?
      ↓
Where did it fail?
      ↓
What did I expect?
      ↓
What object or value actually reached that step?
      ↓
What is the smallest check I can run?

Start with the error message and the line that failed. Then inspect inputs, assumptions and intermediate outputs.

For a fuller debugging workflow, see Troubleshooting.


Environment and package errors

SymptomLikely causeFirst checks
ModuleNotFoundErrorPackage is not installed in the active environmentCheck active environment and notebook kernel
Import works in Terminal but not JupyterTerminal and notebook use different Python environmentsInspect the selected Jupyter kernel
Package API differs from course exampleDifferent package versionCheck package version and current documentation
Environment creation failsDependency conflict or incomplete environment fileRead the complete solver/error output
GPU is not detectedHardware, CUDA or environment configuration differsCheck whether PyTorch detects CUDA and whether GPU use is actually required

Check the Python executable:

import sys

print(sys.executable)

Inspect a package version:

import geopandas as gpd

print(gpd.__version__)

Jupyter kernel errors

A Jupyter Kernel is the Python process that executes notebook code.

Wrong kernel

Symptoms:

Check:

import sys

sys.executable

Make sure it belongs to the expected SDS320 environment.

Stale notebook state

A notebook may depend on variables created by cells that are no longer visible or have been run in a different order.

Typical warning signs:

Run a Restart and Run All check regularly.

Kernel crash

Possible causes include:

Reduce the data or model size before assuming the notebook itself is broken.


Path and file errors

FileNotFoundError

First check:

from pathlib import Path

path = Path("data/image.tif")

print(path)
print(path.exists())

Then inspect:

Path.cwd()

Common causes include:

Absolute paths

An Absolute Path such as:

/Users/name/Documents/SDS320/data/image.tif

works only on a particular filesystem.

Prefer project-relative paths where possible:

data/image.tif

Permission errors

If the file exists but cannot be opened, check:

Do not solve ordinary project-path problems by broadly changing system permissions.


Vector data errors

CRS mismatch

Symptoms:

Check:

print(gdf1.crs)
print(gdf2.crs)

A Coordinate Reference System defines how coordinates relate to Earth.

Reproject deliberately when needed:

gdf2 = gdf2.to_crs(gdf1.crs)

Do not simply assign a new CRS to coordinates that are actually stored in another CRS.

Invalid geometries

Symptoms:

Inspect:

gdf.geometry.is_valid.value_counts()

Understand what makes the geometry invalid before applying an automated repair.

Missing attributes

Inspect the available columns:

gdf.columns

Common causes include:

Spatial join returns no matches

Check:

  1. both CRS,

  2. geographic overlap,

  3. geometry types,

  4. spatial predicate,

  5. a small map of both layers.


Raster data errors

Wrong band order

Symptoms:

Inspect the raster metadata and document the Band Order.

Do not infer band meaning only from the number of channels.

NoData treated as real data

A NoData Value may represent:

Check:

with rasterio.open(path) as src:
    print(src.nodata)

Raster and vector do not align

Check:

A correct CRS alone does not guarantee pixel-level alignment.

Memory errors

Avoid immediately loading a very large raster into memory.

Instead consider:

with rasterio.open(path) as src:
    print(src.width, src.height)
    print(src.count)
    print(src.dtypes)

Estimate the scale of the data before reading all bands.

Lost spatial metadata

A NumPy array contains pixel values but not automatically:

Preserve the input raster profile when writing geospatial outputs.


Machine learning workflow errors

Image-label shape mismatch

Symptoms:

Check several image-label pairs explicitly:

image width/height
mask width/height
number of channels
mask class values

For segmentation, visually overlay labels on imagery.

Data leakage

Data Leakage occurs when information from validation or test data influences training.

Common spatial causes include:

If validation performance appears surprisingly strong, inspect the split before tuning the model.

Class imbalance

A Class Imbalance problem occurs when some classes dominate the training data.

Symptoms can include:

Inspect class frequencies and class-specific metrics.

Overfitting

Overfitting occurs when training performance continues improving while performance on unseen data stops improving or deteriorates.

Possible responses include:

Do not automatically assume that more training will solve poor validation performance.

Training and inference configuration differ

Check that both stages use compatible:

Validation looks good but project predictions look poor

Possible explanations include:

This is a Model Generalization problem rather than necessarily a coding error.


Git and repository errors

Files are missing from the repository

Run:

git status

A file may be:

Large files are being tracked

Raw raster datasets and model outputs can make a repository difficult or impossible to push.

Check before committing:

git status

Keep large project data outside Git unless the course workflow explicitly requires otherwise.

Document how to obtain the data in the README.

Merge conflict

A Merge Conflict means Git cannot automatically combine two versions of a file.

Do not delete conflict markers blindly.

First identify:

<<<<<<<
=======
>>>>>>>

Then decide which content should remain, edit the file and test it before committing the resolution.

Repository works only on your computer

Check for:

Use the Reproducibility and Repository pages for the fuller project requirements.


Conceptual errors that look technical

Not every unexpected output is a software problem.

Examples include:

SymptomPossible conceptual cause
Buildings are consistently missedImage resolution may be too coarse
Change map highlights many unchanged areasSeasonal or radiometric differences
Segmentation boundaries are shiftedReference labels may be misaligned
Model works only in one regionWeak geographic generalization
Spatial join returns surprising matchesWrong spatial predicate
High accuracy but poor minority classClass imbalance
Visually smooth prediction but poor validationAttractive output is not necessarily accurate

Before changing code, ask whether the input data and method are capable of answering the intended question.


How to ask for help

When asking a tutor, classmate or AI assistant for help, provide enough information to reproduce the problem.

Use:

Page or task:
What I tried:
What I expected:
What happened:
Full error message:
Relevant code snippet or screenshot:
What I already checked:

For Python errors, include the complete traceback, especially the final lines.

A Small Reproducible Example is often the fastest way to turn a large project problem into something that can actually be diagnosed.


Key takeaways