Hello,

I am picking up an old code that used chimera and updating it to use ChimeraX.
Our code writes a python script file that looks like :

import chimera
from chimera import runCommand
runCommand("open ../4ZKC_H_reduce.pdb")
runCommand("swapaa LYS #0:11.B&:LYS lib dynameomics")
runCommand("swapaa TRP #0:51.B&:TRP lib dynameomics")
runCommand("write #0 ../4ZKC_H_reduce.pdb")

and executes

chimera --nogui --nostatus --script python_script.py

I installed ChimeraX on Ubuntu 22.01 with the .deb from your website and "sudo apt install chimerax.deb"
When i execute ChimeraX with my script, i get :

available bundle cache has not been initialized yet
Executing: runscript chim_4ZKC_H_reduce.py
Traceback (most recent call last):
  File "chim_4ZKC_H_reduce.py", line 2, in <module>
    from chimera import runCommand
ModuleNotFoundError: No module named 'chimera'

Traceback (most recent call last):
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 84, in open_python_script
    _exec_python(session, code, argv)
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 61, in _exec_python
    exec(code, sandbox.__dict__)
  File "chim_4ZKC_H_reduce.py", line 2, in <module>
    from chimera import runCommand
ModuleNotFoundError: No module named 'chimera'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/__main__.py", line 747, in init
    run(sess, 'runscript %s' % script)
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/run.py", line 38, in run
    results = command.run(text, log=log, return_json=return_json)
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/cli.py", line 2897, in run
    result = ci.function(session, **kw_args)
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/runscript.py", line 38, in runscript
    open_python_script(session, open(script_file, 'rb'), script_file, argv=argv)
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 90, in open_python_script
    raise UserError('Error opening python file %s' % stream.name)
chimerax.core.errors.UserError: Error opening python file chim_4ZKC_H_reduce.py


I tried installing chimera using pip but it installs Chimera (the one in python 2.7) and crashes during the installation.
Any ideas on how to fix this? Did i do something wrong somewhere?

Thanks you very much for your help,

Bar Collignon