Skip to content

Error messages

This page lists the messages that layerbn reports, their cause and how to resolve them, grouped by the file or step they relate to. To find a message, use the search box at the top of the page.

Run a check first

layerbn check my-study

This command reads the files and the data without fitting a model and reports the problem. If a message is unclear, layerbn --traceback check my-study shows the full Python error. Include this output in a bug report.

variables.xlsx

unknown column 'lable'. ... Did you mean 'label'?

A column header is misspelled. Headers are not case-sensitive, but must be spelled as in the reference. For a column with your own notes, use the header note or comment. These columns are ignored.

variable 'X' is in layer 'Exposure', which is not on the 'layers' sheet. Did you mean 'Exposures'?

The layer name on the variables sheet differs from the name on the layers sheet. Select the layer from the dropdown list in the layer column, which only contains names from the layers sheet. In a CSV file, copy the name instead of typing it.

variable 'X' is listed twice (first on row 2)

Each variable can have only one row and one layer. For a repeated layer, list the variable once, without the time point.

the layer(s) ['Scores'] are marked as repeated, but there is no 'timepoints' sheet

A repeated layer is expanded over the time points listed on the timepoints sheet. Add this sheet with the columns time and label, or set repeated to no.

repeated layers must follow each other without a layer in between

Repeated layers are expanded together, with one block per time point, so they must be adjacent on the layers sheet. Move the layer that is between them, or mark it as repeated if it was measured at each time point.

'T9' is not on the 'timepoints' sheet

The times column of a variable contains a time point that is not on the timepoints sheet. Use the values in the time column of that sheet, separated by semicolons.

variable 'X' has 'times' set, but its layer 'Y' is not repeated

times can only be used for variables in repeated layers. Clear the cell, or mark the layer as repeated.

give either 'bins' or 'cutpoints', not both and a categorical variable is not binned

A variable can be binned in only one way. cutpoints specifies the cut-off values, bins specifies the number of bins, and categorical variables are not binned.

'x' is not a colour

In the colour column, use a colour name such as steelblue or a hex code such as #2166ac.

the label 'X' appears more than once after the time points are expanded

Two variables have the same label. Labels, column names and layer names must be unique. For a repeated layer, the label of the time point is appended automatically.

'X' is the column of one variable and the label of another

Each name must refer to one variable. Change the label.

layer 'X' has no variables

A layer on the layers sheet has no variables on the variables sheet. Remove the layer or add variables to it. This error is often caused by a layer name that is spelled differently on the two sheets.

no variables found

The variables sheet is empty. This occurs when a project created with layerbn init --blank has not been filled in yet.

settings.yml

bootstrap.resample: unknown setting. ... Did you mean 'resamples'?

The setting does not exist. Unknown settings result in an error, so that misspelled settings are not ignored. The message lists the allowed settings for the block.

learning.score: 'K3' is not allowed. Choose one of ['K2', 'BIC', 'BDeu']

The value is not allowed. The message lists the allowed values.

this is a version 2 spec ... layerbn migrate spec.yml

The file uses the version 2 format. Convert it with layerbn migrate spec.yml. See Upgrading from version 2.

the file is not valid YAML

The file contains a syntax error. Common causes are a tab instead of spaces (YAML only allows spaces for indentation), a colon in an unquoted text value, and a missing bracket or quotation mark. Indentation defines the structure: all lines in a block must start with the same number of spaces.

A category named Yes or No in a profile

YAML reads the unquoted values yes, no, true, false, on and off as true or false. layerbn matches these values to a category named Yes, No, Ja, Nee, True, False, 1 or 0 in the data, so OUTCOME: No works. For other categories that resemble these words, use quotation marks, for example GROUP: "off".

Settings and variables

constraints.forbid[0].from: 'AGEE' is not a variable in the design. Did you mean 'AGE'?

A variable or layer in the settings does not exist in the variables table. Variables can be referred to by column name or label. Layers can be referred to by their name on the layers sheet (all time points), or for a repeated layer by the expanded name, such as Scores (Second visit).

... runs against the layer order

A required arc points from a later layer to an earlier layer. Rules can only restrict the arcs allowed by the layer order; they cannot allow an arc that conflicts with it. If the arc should be possible, move a variable to another layer or change the order of the layers.

... is both required and forbidden

Two rules conflict. A rule for a layer applies to all variables in the layer, so a forbid rule for a layer can conflict with a require rule for one of its variables. Remove one of the rules, or specify individual variables.

... is inside layer 'X', which has arcs_within set to no

A required arc connects two variables in a layer that does not allow arcs within it. Change arcs_within for the layer, or change the rule.

... must have the parent X but is also listed under no_parents

A variable is required to have a parent and is also listed as having no parents. Remove it from one of the two rules.

network 'x' has 1 variable(s) after the exclusions. A network needs at least two.

After the exclusions in networks:, fewer than two variables remain. Check exclude_layers and exclude_variables.

there is no network named 'x'. The networks are [...]

A network in analyses: or in --network is not defined in networks:.

the variable that is moved across its states cannot also be held fixed

In analyses: sweep:, remove the varied variable from fixed:.

Data

N variable(s) in the design table are not columns of the data file

The message lists the variables, with a suggestion if a similar column exists. Column names must match exactly. Common causes:

  • The case or spaces differ (Age and AGE).
  • For repeated measurements, the data column does not follow the pattern. With the default pattern, SCORE at time point T1 is read from the column SCORE_T1. Check the time column on the timepoints sheet and data: column_pattern:.
  • The variable is not in the data file.

A variable has an unexpected category, or a bin that starts at -99

The data use a code such as -99 or 999 for missing values, which layerbn reads as a value. Replace these codes with empty cells. Then choose how to handle the missing values; see Missing values.

All variables are reported as missing from the data, and the data have one column

The CSV file uses a separator that is not recognised. layerbn recognises commas, semicolons (with decimal commas, as written by Excel with Dutch or German regional settings) and tabs, based on the first line. Check that the first line contains the column names, separated by one of these characters.

The data has missing values in N variable(s)

Choose how to handle missing values, for all variables in settings.yml (data: missing:) or per variable in the missing column of variables.xlsx. category models them as a state Missing; drop_rows excludes the participants concerned, which can bias the results. You can also impute the values beforehand. See Missing values.

These variables have only one value in the data

A variable with a single value contains no information. Remove it from the variables table.

type is 'continuous' but the column is not numeric

The column contains text, for example numbers with units, or numbers with a decimal comma stored as text. Convert the column to numbers before the analysis, or set type to categorical.

data file not found

A relative path in data: file: is relative to the folder that contains settings.yml, not to the working folder of the terminal. Use a full path, or use --data.

cannot read '.xyz' files

Supported formats are .csv, .tsv, .xlsx, .xls, .parquet, .feather, .sav and .dta. Parquet requires pip install pyarrow, and SPSS requires pip install pyreadstat.

A numeric column is treated as categorical, or the reverse

A numeric column with at most categorical_max_levels (default 10) distinct values is not binned. Set type to continuous to bin it, or to categorical to treat a column with many values as categories (for example, a diagnosis coded 1 to 15). The bins table shows how each variable was treated.

Notes during a run

The following notes are shown during the run and listed in the report. They are not errors.

N column(s) of the data file are not in the design table and are not used

The data contain columns that are not in the variables table, such as an identifier. These columns are not used. If one of them is a variable for the analysis, add it to the variables table.

N of M bootstrap fits failed

Some resamples could not be fitted. A few failures out of several hundred resamples are not a problem. Frequencies are divided by the requested number of resamples, so failures lower the frequencies slightly. If many fits fail, there are too few data for the settings. Reduce the number of bins (discretisation: bins) or parents (learning: max_parents), or remove a layer.

group: placed in bins: AGE: 65 -> 63.4 to < 69

This note shows the bin that a value was assigned to. If you intended a narrower group, set cutpoints for the variable.

group: NOT USED: SEX='F' (no such state; states are ['Female', 'Male'])

A value in a profile could not be assigned, so the variable is not part of the profile. The message lists the available states. The note not in network means that the variable is not in this network, for example because its layer was excluded.

No value of the profile(s) [...] could be used

None of the values in the profile could be assigned, so no evidence can be set.

sweep: [...] lie downstream of X in the learned network

A fixed variable in the sweep is between the varied variable and the targets, and blocks part of the association. The curves can be flat as a result. Fix only variables that precede the varied variable in the layer order.

The profile analysis was skipped / The sweep was skipped

The rest of the run continues, and the note gives the reason. Correct the settings and run the analysis again.

Results

An expected arc is missing

Check the following, in this order:

  1. Is the arc allowed by the layer order? Arcs from a later layer to an earlier layer are never learned.
  2. Is the arc excluded by a forbid rule or by arcs_within: no?
  3. Is the arc in the arc stability table (tables/arcs_<network>.csv) with a moderate frequency? An arc learned in 40% of the resamples is not necessarily in the network learned from the complete data.
  4. Are both variables divided into enough bins to show the association (see the bins figure)? Is the sample large enough for the number of parents and bins?
  5. Does a correlated variable explain the same association? Look for an arc from that variable to the same child.

In network and the frequency disagree

The two values measure different things. In network shows whether the arc is in the network learned from the complete data, and the frequency shows how often the arc is learned in the resamples. Report the frequency.

The network has very few arcs

Possible causes are a small sample for the number of variables and bins, a low value of max_parents, or the BIC score, which results in sparser networks. Reduce the number of bins and variables, or use K2.

The sweep is flat

Possible causes, in this order: a fixed variable lies between the varied variable and the target (a note reports this); the variable is not associated with the target in the model, which is a valid result; or the bins of the variable are too wide (see the bins figure).

The mutual information of a variable is NaN

The computation failed for that variable. The value is shown as missing, so that the gap is visible in the table. Report this as a bug, with the output of --traceback.

Figures differ between computers

Figures use Arial if it is installed, and DejaVu Sans otherwise. The results do not depend on the font.

Installation and run time

Failed to build scikit-learn, or requires a different Python: 3.15

layerbn supports Python 3.11 to 3.14. On Python 3.15, pip cannot find a ready-made package of the scikit-learn version that layerbn requires and tries to build it from source, which fails. Install Python 3.14 next to your current version and install layerbn with it. See Install.

ERROR: Package 'layerbn' requires a different Python: 3.9.6 not in '>=3.11'

The pip command belongs to an older Python installation, often the Python 3.9 included with Apple's developer tools. Install with python3 -m pip install ... instead of pip install ... (on Windows, python -m pip). See Install.

layerbn: command not found or not recognized

The folder where pip installs commands is not on your PATH. The installation output then contains the warning The script layerbn is installed in '...' which is not on PATH. Use python3 -m layerbn instead of layerbn (on Windows, python -m layerbn), or add the folder to your PATH as described in Install.

error: externally-managed-environment during installation

This Python installation does not allow packages to be installed directly. This is common with Homebrew Python on macOS and on Linux. Install layerbn in a virtual environment, as described in Install.

layerbn: error: the following arguments are required: command

layerbn was started without a command, for example because the line was cut off or --help was changed when it was copied from an e-mail or document. Type the command by hand, for example layerbn --help. From version 3.0.1, layerbn shows the help in this case.

can't open file '.../layerbn': [Errno 2] No such file or directory

The -m is missing from the command. python3 layerbn looks for a file named layerbn in the working folder. Use python3 -m layerbn, for example python3 -m layerbn init my-study (with Python 3.14: python3.14 -m layerbn init my-study).

python: command not found, or the Microsoft Store opens

Python is not installed or is not on your PATH. Install Python from python.org. On Windows, select "Add python.exe to PATH" in the installer. On macOS, use python3 instead of python.

No such file or directory after cd

The folder name is misspelled, or it contains spaces and is not enclosed in quotes. Type cd and drag the folder into the terminal window. See Terminal basics.

ModuleNotFoundError: No module named 'pyarrow' (or openpyxl, pyreadstat)

Install the package, for example pip install pyarrow. openpyxl is installed with layerbn. pyarrow is required for Parquet files and pyreadstat for SPSS files.

PermissionError when reading or writing a file

On Windows, a file that is open in Excel cannot be written and sometimes cannot be read. Close variables.xlsx and results/tables/tables.xlsx, and run the command again.

The run takes too long

The run time is approximately proportional to the number of bootstrap resamples. Use --fast or bootstrap: resamples: 20 while you set up the analysis, and the full number of resamples for the final run. learning: search: greedy is faster but searches less thoroughly. Fewer variables, bins and parents also reduce the run time. During the run, the terminal shows an estimate of the remaining time.

These warnings come from libraries that layerbn uses and do not affect the results. scikit-learn is restricted to versions below 1.9, because version 1.9 changes the computation of quantile bin edges, which would change all results. The test suite checks the bin edges for this reason.