Trouble Running txt2stix Locally on Windows — Circular Import & Module Path Issues

First of all, thank you for open-sourcing txt2stix — it’s an exciting project and I’m currently trying to run it locally on my Windows 10 machine for a controlled AI extraction experiment.

However, I’m encountering multiple issues when attempting to run the tool using the AI mode (--mode ai). Below is a summary of the environment setup and problems:


:white_check_mark: My Setup

  • OS: Windows 10 (x64)
  • Python: 3.10
  • Virtual environment created via python -m venv txt2stix-env
  • Cloned repo into D:\ML\txt2stix-project\
  • Installed dependencies via pip install -r requirements.txt
  • OpenAI API key configured in .env
  • Added stix2extensions via:
    git clone https://github.com/muchdogesec/stix2extensions in the same directory

:cross_mark: Issues Encountered

1. Circular import error

When running:

py txt2stix.py --mode ai --input_file my_report.txt ...

I get:

ImportError: cannot import name 'txt2stixBundler' from partially initialized module 'txt2stix.stix'

This seems to be caused by txt2stix.py and txt2stix/ folder having the same name, which confuses the Python import system.

2. Module import issues

Many modules like from txt2stix.retriever import STIXObjectRetriever throw red underlines in IDEs (and sometimes errors during execution), unless I manually set PYTHONPATH.


:white_check_mark: My Temporary Workaround

  • Renamed txt2stix.pymain.py

  • Set environment variable in PowerShell:

    $env:PYTHONPATH="D:\ML"
    
  • Ran via module entry point:

    py -m txt2stix --mode ai ...
    

This allowed me to generate bundle--xxx.json and data--xxx.json successfully.


:folded_hands: Suggestions or Questions

  • Could you consider renaming the entry script to avoid name conflict with the package folder?
  • Would it be possible to provide a Windows setup guide (including virtualenv, PYTHONPATH, stix2extensions)?
  • Are you planning to support pip/poetry installable versions in the future?

Thanks again for this great project — I’m happy to test and provide more feedback if needed.