You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
We need to upgrade all systems to TRAPI 2.0 in dev #2904
The requirements.txt in commit 5975cec doesn't work from a fresh pip install -r requirements.txt, because the catrax-xcrg package (based on the current pinned commit) pulls a catrax-xcrg pyproject.toml file that specifies a version for opentelemetry-api, 1.17.0, that is inconsistent with (and much older than) the pinned dependency (1.45.0) for opentelemetry-api that is specified in the latest ARAX requirements.txt. Noting it here because, I think, we will need to fix this before attempting to auto-deploy to cicd.rtx.ai via the fantastic ARAX auto-deploy system developed by @bazarkua . @edeutsch showed me how to hack around this to get the fastapi server working in the meantime, so this is not blocking work on fork_mode.
To get the trapi2.0 branch working locally on your development machine, in addition to following the steps in the ARAX Maintenance SOP document, for now, you will need to do the following updated steps:
in requirements.txt, comment out fastapi and uvicorn, and change the opentelemetry-api to 1.17.0
in a fresh python3.12 virtualenv, install the requirements.txt using pip install -r requirements.txt
install fastapi using pip install --upgrade fastapi
install uvicorn using pip install --upgrade uvicorn
when you run the fastapi application server, need to use your web browser to open RTX/code/UI/interactive/index.html and then click on "Settings' and change the ARAX_QUERY_URL string to: http://localhost:5001/devED/api/arax/v2.0/query.
change flask_config.json to app_server_config.json (put in RTX/code/UI/OpenAPI/python-flask-server/openapi_server); as of commit 722f0f3
h/t to @edeutsch for the pip install --upgrade workaround.
So, I have ARAX working locally on my MBP, without fork_mode (getting same error seen on arax.ncats.io/devED):
first thing: pytest dont even start on my MBP locally on trapi2.0, conftest fails on import
env: fresh python 3.12 venv, pip install -r requirements.txt from trapi2.0 (scipy bumped to 1.16.3 locally bc 1.15.3 wheel dont load on macOS 27, not related to this error)
$ python --version
Python 3.12.11
$ cd code/ARAX/test
$ python -m pytest --collect-only -q -p no:cacheprovider
ImportError while loading conftest '/Users/bazarkua/Work/RTX/code/ARAX/test/conftest.py'.
conftest.py:11: in <module>
from kp_info_cacher import KPInfoCacher
../ARAXQuery/Expand/kp_info_cacher.py:20: in <module>
from ARAX_response import ARAXResponse
../ARAXQuery/ARAX_response.py:8: in <module>
from openapi_server.models.log_entry import LogEntry
E ModuleNotFoundError: No module named 'openapi_server'
same error when importing only this module:
$ cd ../ARAXQuery
$ python -c 'import ARAX_response'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/bazarkua/Work/RTX/code/ARAX/ARAXQuery/ARAX_response.py", line 8, in <module>
from openapi_server.models.log_entry import LogEntry
ModuleNotFoundError: No module named 'openapi_server'
why server on arax.ncats.io /beta and /devED still works: start script does cd python-flask-server and runs python3 -m openapi_server, so python finds openapi_server from current dir. pytest runs from code/ARAX/test, from there it cant find it
$ cd code/ARAX/ARAXQuery
$ python -c 'import ARAX_response' && echo "import ok"
import ok
and kp_info_cacher.py CLI works again:
$ cd Expand
$ python kp_info_cacher.py
The process with process ID 49968 has STARTED refreshing the KP info caches
- Getting meta info from infores:retriever
The process with process ID 49968 has FINISHED refreshing the KP info caches
pytest now loads conftest and goes further, openapi_server error is gone:
other options i looked at: pythonpath in pytest.ini fixes only pytest, CLI scripts like kp_info_cacher.py stay broken (CI also runs it in "Build KP info cache" step), and tests would hide the problem. proper packaging (pyproject, absolute imports) is real long term fix but its refactor of whole repo, probably not for this TRAPI 2.0 migration
after the openapi_server fix pytest stops on No module named 'flask'. and its not only pytest, the server itself dont start in fresh env (local app_server_config.json: port 5001, db check and background tasker off)
$ cd code/UI/OpenAPI/python-flask-server
$ python -m openapi_server
Loaded config file /Users/bazarkua/Work/RTX/code/UI/OpenAPI/python-flask-server/openapi_server/app_server_config.json
2026-10-14T03:50:34.121983: DEBUG: In BiolinkHelper init
2026-10-14T03:50:34.122572: DEBUG: Loading pickle file: /Users/bazarkua/Work/RTX/code/ARAX/BiolinkHelper/biolink_model_4.2.5.yaml
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/bazarkua/Work/RTX/code/UI/OpenAPI/python-flask-server/openapi_server/__main__.py", line 325, in <module>
main()
File "/Users/bazarkua/Work/RTX/code/UI/OpenAPI/python-flask-server/openapi_server/__main__.py", line 269, in main
from openapi_server.apis.entity_api import router as EntityApiRouter
File "/Users/bazarkua/Work/RTX/code/UI/OpenAPI/python-flask-server/openapi_server/apis/entity_api.py", line 36, in <module>
importlib.import_module(name)
File "/Users/bazarkua/.pyenv/versions/3.12.11/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bazarkua/Work/RTX/code/UI/OpenAPI/python-flask-server/openapi_server/impl/query_api_impl.py", line 59, in <module>
import ARAX_query # pylint: disable=import-outside-toplevel,import-error,wrong-import-position
^^^^^^^^^^^^^^^^^
File "/Users/bazarkua/Work/RTX/code/ARAX/ARAXQuery/ARAX_query.py", line 42, in <module>
from response_cache import ResponseCache #noqa: E402
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bazarkua/Work/RTX/code/ARAX/ResponseCache/response_cache.py", line 20, in <module>
from flask import Flask,redirect
ModuleNotFoundError: No module named 'flask'
flask is not installed bc Flask==2.2.5 was removed from requirements.txt in 5975cec with the move to FastAPI:
$ pip show flask
WARNING: Package(s) not found: flask
and this import is not used, Flask and redirect dont appear anywhere else in the file:
why arax.ncats.io /beta and /devED still run: probably system python on the host still has Flask from master requirements (master still has Flask==2.2.5), i did not check the host. but any fresh install from trapi2.0 requirements (new venv, docker build, CI) would hit this
pytest collects all tests now, no collection errors:
$ cd ../../../ARAX/test
$ python -m pytest --collect-only -q -p no:cacheprovider 2>&1 | tail -1
335 tests collected in 2.61s
why this fix and not adding Flask back to requirements.txt: ARAX dont use Flask anymore after the move to FastAPI, Flask and redirect were not used in this file, so adding Flask back only to keep a dead import alive makes no sense
only import flask left is in old connexion controllers/ (asyncquery_controller.py, query_controller.py), FastAPI server dont load them, thats why it starts without flask. can clean them up later
79 test cases fail in ARAXQuery.query() on the same line. it calls .to_dict() on query['message'], so looks like it expects pydantic Message object here, but tests pass message as plain dict (34) or dont have message key at all (45)
> araxq.query(query)
test_ARAX_query.py:21:
> query_dict['message'] = query['message'].to_dict()
E AttributeError: 'dict' object has no attribute 'to_dict'
../ARAXQuery/ARAX_query.py:364: AttributeError
> [response, message] = _do_arax_query(query)
test_ARAX_workflows.py:84:
test_ARAX_workflows.py:21: in _do_arax_query
> query_dict['message'] = query['message'].to_dict()
E KeyError: 'message'
../ARAXQuery/ARAX_query.py:364: KeyError
2 test cases fail in ARAX_messenger.add_qedge: it creates empty QEdge() first, but 2.0 model requires subject and object
> messenger.add_qedge(response, parameters['parameters'])
test_ARAX_messenger.py:207:
> qedge = QEdge()
E pydantic_core._pydantic_core.ValidationError: 2 validation errors for QEdge
E subject
E Field required [type=missing, input_value={}, input_type=dict]
E object
E Field required [type=missing, input_value={}, input_type=dict]
../ARAXQuery/ARAX_messenger.py:477: ValidationError
32 test cases fail on test data still in TRAPI 1.6 shape, 2.0 models validate it now:
Node without categories (9), or categories/ids given as string instead of list (7 Node, 2 QNode)
mocked xCRG response with 1.6 node_bindings lists (3)
xCRG query graph routing (2), see below
> kg_nodes = _create_nodes(kg_node_info)
test_ARAX_resultify.py:276:
> node = Node(categories=kg_node.get("categories"),
E pydantic_core._pydantic_core.ValidationError: 1 validation error for Node
E categories
E Input should be a valid list [type=list_type, input_value='protein', input_type=str]
test_ARAX_resultify.py:51: ValidationError
xCRG routing: interpreter builds expand() plan instead of connect(action=xcrg)
looks like the reason is the test query graph. is_xcrg_mvp2_query() from xcrg package validates it with strict TRAPI 2.0 model (translator_tom), and test QG still has 1.6 qualifier_constraints plus auxiliary_graphs: {}, 2.0 dont allow it empty. when i convert both to 2.0 by hand it returns True. ARAX own envelope dont set auxiliary_graphs, so looks like test only
1 flaky: test_issue_2678 failed this run in query tracker (sqlalchemy.orm.exc.ObjectDeletedError in ARAX_query_tracker.check_ongoing_queries), in previous run same test failed in query() like the others. not checked
I just confirmed that requirements.txt in the trapi2.0 branch installs cleanly in a fresh python3.12 virtualenv, with pip install -r requirements.txt. Thank you to whomever fixed it.
Activity
Starting TRAPI 2.0 impl #2904
TRAPI 2.0: Partial removal of PathfinderAnalysis. #2904
Update to TRAPI 2.0 #2904
Partial update to TRAPI 2.0 #2904
Add a simple format to metaKG #2904
Remove unneeded models #2904
Update models to FastAPI and TRAPI 2.0 #2904
Add new autogen API controllers #2904
Add new controller implementations #2904
Add new models for TRAPI 2.0 #2904
Updated requirements for FastAPI #2904
saramsey commentedon Oct 7, 2026
The
requirements.txtin commit 5975cec doesn't work from a freshpip install -r requirements.txt, because thecatrax-xcrgpackage (based on the current pinned commit) pulls acatrax-xcrgpyproject.toml file that specifies a version foropentelemetry-api, 1.17.0, that is inconsistent with (and much older than) the pinned dependency (1.45.0) foropentelemetry-apithat is specified in the latest ARAXrequirements.txt. Noting it here because, I think, we will need to fix this before attempting to auto-deploy tocicd.rtx.aivia the fantastic ARAX auto-deploy system developed by @bazarkua . @edeutsch showed me how to hack around this to get the fastapi server working in the meantime, so this is not blocking work onfork_mode.saramsey commentedon Oct 7, 2026
To get the
trapi2.0branch working locally on your development machine, in addition to following the steps in the ARAX Maintenance SOP document, for now, you will need to do the following updated steps:requirements.txt, comment outfastapianduvicorn, and change theopentelemetry-apito 1.17.0requirements.txtusingpip install -r requirements.txtpip install --upgrade fastapipip install --upgrade uvicornRTX/code/UI/interactive/index.htmland then click on "Settings' and change theARAX_QUERY_URLstring to:http://localhost:5001/devED/api/arax/v2.0/query.flask_config.jsontoapp_server_config.json(put inRTX/code/UI/OpenAPI/python-flask-server/openapi_server); as of commit 722f0f3h/t to @edeutsch for the
pip install --upgradeworkaround.So, I have ARAX working locally on my MBP, without fork_mode (getting same error seen on
arax.ncats.io/devED):Remove old Flasks tests never really used #2904
saramsey commentedon Oct 7, 2026
I have done the renaming of
flask_config.jsontoapp_server_config.json, locally. Pushing the commit shortly.53 remaining items
Remove endpoints migrated to 2.0. Fix #2904
found a combination that seems to work. Fix #2904
Skip Jaeger for the moment. Fix #2904
#2904 merge master into trapi2.0
bazarkua commentedon Oct 14, 2026
first thing: pytest dont even start on my MBP locally on
trapi2.0, conftest fails on importenv: fresh python 3.12 venv,
pip install -r requirements.txtfromtrapi2.0(scipy bumped to 1.16.3 locally bc 1.15.3 wheel dont load on macOS 27, not related to this error)same error when importing only this module:
reason:
LogEntryimport was added in 6799b2cbut
ARAX_response.pydont addpython-flask-server/tosys.pathbefore it:RTX/code/ARAX/ARAXQuery/ARAX_response.py
Lines 5 to 8 in 744e574
like
ARAX_messenger.pydoes:RTX/code/ARAX/ARAXQuery/ARAX_messenger.py
Lines 23 to 24 in 744e574
why server on arax.ncats.io
/betaand/devEDstill works: start script doescd python-flask-serverand runspython3 -m openapi_server, so python findsopenapi_serverfrom current dir. pytest runs fromcode/ARAX/test, from there it cant find itRTX/code/UI/OpenAPI/python-flask-server/RTX_OpenAPI.start
Lines 18 to 23 in 744e574
#2904 add python-flask-server to sys.path in ARAX_response
bazarkua commentedon Oct 14, 2026
fixed, one line in
ARAX_response.py, samesys.path.appendas other ARAX modules use:RTX/code/ARAX/ARAXQuery/ARAX_response.py
Lines 7 to 8 in ef5679f
now
ARAX_responseimports fine:and
kp_info_cacher.pyCLI works again:pytest now loads conftest and goes further,
openapi_servererror is gone:but it stops on next import error, same one for all 15 test modules (output trimmed):
this flask one is next
why this fix: ARAX modules already add their paths with
sys.path.appendeverywhere, this is how imports work in ARAX nowand after fix no other module (outside tests) imports
openapi_serverwithout addingpython-flask-server/to path, this prints nothing:other options i looked at:
pythonpathinpytest.inifixes only pytest, CLI scripts likekp_info_cacher.pystay broken (CI also runs it in "Build KP info cache" step), and tests would hide the problem. proper packaging (pyproject, absolute imports) is real long term fix but its refactor of whole repo, probably not for this TRAPI 2.0 migrationbazarkua commentedon Oct 14, 2026
after the
openapi_serverfix pytest stops onNo module named 'flask'. and its not only pytest, the server itself dont start in fresh env (localapp_server_config.json: port 5001, db check and background tasker off)flask is not installed bc
Flask==2.2.5was removed fromrequirements.txtin 5975cec with the move to FastAPI:and this import is not used,
Flaskandredirectdont appear anywhere else in the file:RTX/code/ARAX/ResponseCache/response_cache.py
Lines 18 to 22 in ef5679f
why arax.ncats.io
/betaand/devEDstill run: probably system python on the host still has Flask frommasterrequirements (masterstill hasFlask==2.2.5), i did not check the host. but any fresh install fromtrapi2.0requirements (new venv, docker build, CI) would hit this#2904 drop unused flask import from response_cache
bazarkua commentedon Oct 14, 2026
fixed, removed unused
from flask import Flask,redirectfromresponse_cache.py:RTX/code/ARAX/ResponseCache/response_cache.py
Lines 18 to 21 in d41de55
server now starts in fresh env:
and it answers (from other terminal):
pytest collects all tests now, no collection errors:
why this fix and not adding Flask back to
requirements.txt: ARAX dont use Flask anymore after the move to FastAPI,Flaskandredirectwere not used in this file, so adding Flask back only to keep a dead import alive makes no senseonly
import flaskleft is in old connexioncontrollers/(asyncquery_controller.py,query_controller.py), FastAPI server dont load them, thats why it starts without flask. can clean them up laternext I will try to run pytest locally on my MBP
bazarkua commentedon Oct 14, 2026
first full run of pytest suite on
trapi2.0locally on my MBP, after the two import fixes above. all DBs fromconfig_dbs.jsonare downloaded locally79 test cases fail in
ARAXQuery.query()on the same line. it calls.to_dict()onquery['message'], so looks like it expects pydanticMessageobject here, but tests passmessageas plain dict (34) or dont havemessagekey at all (45)RTX/code/ARAX/ARAXQuery/ARAX_query.py
Lines 362 to 366 in d41de55
2 test cases fail in
ARAX_messenger.add_qedge: it creates emptyQEdge()first, but 2.0 model requiressubjectandobject32 test cases fail on test data still in TRAPI 1.6 shape, 2.0 models validate it now:
Nodewithoutcategories(9), orcategories/idsgiven as string instead of list (7Node, 2QNode)Edgewithoutsources,knowledge_level,agent_type(9: 6 in the new Gandalf format update exposed a bug in blocklist filtering + xCRG ranking #2909 test from master, 3 intest_result_transformer.py)node_bindingslists (3)xCRG routing: interpreter builds
expand()plan instead ofconnect(action=xcrg)looks like the reason is the test query graph.
is_xcrg_mvp2_query()from xcrg package validates it with strict TRAPI 2.0 model (translator_tom), and test QG still has 1.6qualifier_constraintsplusauxiliary_graphs: {}, 2.0 dont allow it empty. when i convert both to 2.0 by hand it returnsTrue. ARAX own envelope dont setauxiliary_graphs, so looks like test only1 flaky:
test_issue_2678failed this run in query tracker (sqlalchemy.orm.exc.ObjectDeletedErrorinARAX_query_tracker.check_ongoing_queries), in previous run same test failed inquery()like the others. not checkedSupport for Pathfinder TRAPI 2.0 #2904
saramsey commentedon Oct 21, 2026
I just confirmed that
requirements.txtin thetrapi2.0branch installs cleanly in a freshpython3.12virtualenv, withpip install -r requirements.txt. Thank you to whomever fixed it.edeutsch commentedon Oct 21, 2026
Great, thanks for confirming. I last fiddled with it after adding reasoner-validator 7.0.0 and seemed to get it into a good state.
Fix TRAPI 2.0 model errors breaking /query and creative mode #2904