Skip to content

The environment yml file misses mdtraj package #1265

@iGulitch

Description

@iGulitch

Built a Singularity container with the latest versions of mbuild, foyer, and gmso. Used the environment combined of all the environment.yml files of all the three apps. Ran mbuild.load and got the following message :

###########################################################

The code at conversion.py:454 requires the "mdtraj" package
mdtraj can be installed using:
# conda install -c conda-forge mdtraj
or
# pip install mdtraj

###########################################################
Traceback (most recent call last):
  File "/opt/conda/envs/mosdef/lib/python3.13/site-packages/mbuild/utils/io.py", line 209, in import_
    return importlib.import_module(module)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/opt/conda/envs/mosdef/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'mdtraj'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/<path to run script>/<run script>", line 242, in <module>
    main()
    ~~~~^^
  File "/<path to run script>/<run script>", line 239, in main
    <function>(<argument>)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/<path to run script>/<run script>", line 148, in <function>
    ...
  File "/<path to run script>/<run script>", line 172, in <function>
    mol = mbuild.load(<input>)
  File "/opt/conda/envs/mosdef/lib/python3.13/site-packages/mbuild/conversion.py", line 126, in load
    return load_file(
        filename=filename_or_object,
    ...<5 lines>...
        **kwargs,
    )
  File "/opt/conda/envs/mosdef/lib/python3.13/site-packages/mbuild/conversion.py", line 454, in load_file
    md = import_("mdtraj")
  File "/opt/conda/envs/mosdef/lib/python3.13/site-packages/mbuild/utils/io.py", line 242, in import_
    raise DelayImportError(m)
mbuild.utils.io.DelayImportError: 
The code at conversion.py:454 requires the "mdtraj" package
mdtraj can be installed using:
# conda install -c conda-forge mdtraj
or
# pip install mdtraj

Inclusion of mdtraj in the environment file solves the issue. Perhaps, you may want to include mdtraj in the standard environment file of mbuild?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions