mdtraj icon indicating copy to clipboard operation
mdtraj copied to clipboard

Errors Installing mdtraj from source

Open jeremyleung521 opened this issue 1 year ago • 0 comments

I was trying to test my mdtraj branch more efficiently but kept encountering significant issues with installing mdtraj from source. I've been able to replicate the same errors on two computers and three different conda installation environments (macos-x86_64 under Rosetta/ macos-arm64/ ubuntu 22.04 on x86_64). I've tried using python 3.9/3.10/3.11/3.12 environments.

  1. Trying to install in editable mode (python -m pip install -e .) always results in the following error. Since it failed out, mdtraj is not installed.
        File "/private/var/folders/06/29rlbptd5jq_rfl__96vd2qh0000gn/T/pip-build-env-kdg7kr2f/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/private/var/folders/06/29rlbptd5jq_rfl__96vd2qh0000gn/T/pip-build-env-kdg7kr2f/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "/Users/user/Documents/Important/Pitt/git/mdtraj/basesetup.py", line 302, in build_extension
          self.build_static_extension(ext)
        File "/Users/user/Documents/Important/Pitt/git/mdtraj/basesetup.py", line 359, in build_static_extension
          src_tree_output_dir = re.match('build.*(mdtraj.*)', output_dir).group(1)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: 'NoneType' object has no attribute 'group'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building editable for mdtraj
Failed to build mdtraj
ERROR: Could not build wheels for mdtraj, which is required to install pyproject.toml-based projects
  1. Installing in non-editable mode (python -m pip install .) would be successful, but I would always end up with this error during import mdtraj. Oddly, this no longer happens if I try it from a new console (i.e., start a new terminal window). I SOMETIMES get the same error if I install from PyPI source (python -m pip install mdtraj).
(mdtraj-test2) mc-wifi-10-215-109-101:mdtraj user$ python
Python 3.11.7 | packaged by conda-forge | (main, Dec 23 2023, 14:38:07) [Clang 16.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mdtraj
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/user/Documents/Important/Pitt/git/mdtraj/mdtraj/__init__.py", line 30, in <module>
    from .formats.registry import FormatRegistry
  File "/Users/user/Documents/Important/Pitt/git/mdtraj/mdtraj/formats/__init__.py", line 4, in <module>
    from .dcd import DCDTrajectoryFile
ImportError: cannot import name 'DCDTrajectoryFile' from 'mdtraj.formats.dcd' (unknown location)

The closest PR I could find is https://github.com/mdtraj/mdtraj/issues/1608 but that's a different issue I think. Not sure if the two errors I brought up are related, but it's quite frustrating during testing because I would constantly need to reinstall and relaunch terminals.

Thanks!

jeremyleung521 avatar Jan 24 '24 18:01 jeremyleung521