Hi QuantConnect Team & Community,

I'm encountering a persistent issue when trying to use QuantBook within the local research environment launched by lean research . on my Windows machine. My goal is to run several research notebooks locally (using lean-cli and Docker) that utilize QuantBook to read data/ObjectStore and save results to local files.

Problem:

When I run lean research . and attempt to execute any code that initializes QuantBook (i.e., qb = QuantBook()), the cell execution fails with a System.NullReferenceException. This happens both when trying to run notebooks programmatically via a master notebook (using nbconvert.ExecutePreprocessor) and also when running the notebooks manually cell-by-cell within the Jupyter Lab interface launched by lean research .. Even a minimal test case in a brand new notebook containing only qb = QuantBook() fails with the same error.

Error Details:

The primary error during qb = QuantBook() initialization is:

Code snippet

System.NullReferenceException: Object reference not set to an instance of an object.

   at QuantConnect.Securities.SecurityDefinitionSymbolResolver..ctor(IDataProvider dataProvider, String securitiesDefinitionKey)

   at QuantConnect.Securities.SecurityDefinitionSymbolResolver.GetInstance(IDataProvider dataProvider, String securitiesDefinitionKey)

   at QuantConnect.Algorithm.QCAlgorithm..ctor()

   at QuantConnect.Research.QuantBook..ctor()

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)

   at System.Reflection.MethodBaseInvoker.InvokeConstructorWithoutAlloc(Object obj, Boolean wrapInTargetInvocationException)

Other potentially relevant log messages observed during startup/failure:

  • ERROR:: Initializer.Start(): System.ArgumentException: Unable to locate any exports matching the requested typeName: CompositeLogHandler. Type: QuantConnect.Logging.ILogHandler (Parameter 'typeName')
  • TRACE:: Extensions.IsDirectoryEmpty(): directory '../../../Data/symbol-properties' not found or empty

Environment:

  • Operating System: Windows [Windows 11 Pro 24H2]
  • lean-cli Version: [lean 1.0.217]
  • Docker Desktop Version: [Docker version 27.5.1, build 9f9e405]

Troubleshooting Steps Already Taken:

  1. Resolved initial jupyter command not found errors by fixing the system PATH.
  2. Ensured target notebooks are correctly formatted .ipynb (JSON) files, not plain Python scripts.
  3. Confirmed Docker Desktop is installed and running correctly (tested with docker ps).
  4. Encountered and resolved the Error: This is an old Lean CLI root folder... by: 
    • Creating a completely new workspace folder (MyNewLean).
    • Deleting the global configuration folders.
    • Uninstalling and reinstalling lean-cli (pip install --upgrade lean).
    • Running lean login successfully.
    • Running lean init successfully within the new workspace folder.
  5. Ensured the latest research Docker image was present (docker pull quantconnect/research:latest confirmed image is up-to-date).
  6. Attempted downloading sample data (lean data download --dataset-name equity-usa-minute --ticker SPY ...).
  7. Ran the minimal test case (from QuantConnect.Research import QuantBook; qb = QuantBook()) in a new notebook within the environment launched by lean research ., which still failed with the NullReferenceException.

Despite these steps, the fundamental QuantBook() initialization fails locally. Running the same notebooks in the QuantConnect Cloud Research environment works fine.

Could you please provide guidance on why QuantBook might be failing to initialize correctly in the local lean research environment on my machine?

Thank you for your help!