Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 2.6 compatibility #20

Closed
cbenzer opened this issue Nov 4, 2013 · 4 comments
Closed

Python 2.6 compatibility #20

cbenzer opened this issue Nov 4, 2013 · 4 comments

Comments

@cbenzer
Copy link

cbenzer commented Nov 4, 2013

We are running all our scientific Linux boxes under CentOS 6 which means the default Python installation is 2.6. I ran into the following compatibility issues:

Issue 1 : ordereddict not available in Python 2.6. This could be resolved by installing the backport of ordereddict into Python 2.6 using "pip install ordereddict". Pip (python-pip) is available in EPEL repository. After that I had to change the line "from collections import OrderedDict" to "from ordereddict import OrderedDict" in the file openmm.

Issue 2: argparse not available in Python 2.6. This could be resolved by installing argparse into Python 2.6 using "pip install argparse".

After resolving issues 1 and 2 I was able to run "open-mm -h". Subsequently I tried running a simple test using the input.pdb file from the OpenMM 5.2 example folder.

Issue 3: Several warnings on TypeErrror:

Traceback (most recent call last):
  File "/usr/lib64/python2.6/logging/__init__.py", line 776, in emit
    msg = self.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 654, in format
    return fmt.format(record)
  File "/usr/lib/python2.6/site-packages/openmm-0.1-py2.6.egg/ipcfg/openmmapplication.py", line 88, in format
    return super(LevelFormatter, self).format(record)
TypeError: super() argument 1 must be type, not classobj

This is probably related to this issue http://stackoverflow.com/questions/1713038/super-fails-with-error-typeerror-argument-1-must-be-type-not-classobj and is somehow masked by being default in Python 3.X but the need to be declared explicitly in version below 3.0

Issue 4: Not researched so far ... :-)

Traceback (most recent call last):
  File "/usr/bin/openmm", line 5, in <module>
    pkg_resources.run_script('openmm==0.1', 'openmm')
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 461, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1194, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/lib/python2.6/site-packages/openmm-0.1-py2.6.egg/EGG-INFO/scripts/openmm", line 1077, in <module>
    openmm.start()
  File "/usr/lib/python2.6/site-packages/openmm-0.1-py2.6.egg/EGG-INFO/scripts/openmm", line 926, in start
    force_reporters(simulation)
  File "/usr/lib/python2.6/site-packages/openmm-0.1-py2.6.egg/EGG-INFO/scripts/openmm", line 1071, in force_reporters
    reporter.report(simulation, state)
  File "/usr/lib/python2.6/site-packages/openmm-0.1-py2.6.egg/ipcfg/restartreporter.py", line 190, in report
    with bz2.BZ2File(tmp_fn, 'w') as f:
AttributeError: 'bz2.BZ2File' object has no attribute '__exit__'

I would be grateful if you could work on the Python 2.6 compatibility and make life a little bit easier for all the RHEL and CentOS users.

Thanks a lot!

@rmcgibbo
Copy link
Owner

rmcgibbo commented Nov 4, 2013

The argparse backport will probably be required, but I can fix the other problems. Thanks for the heads up!

@cbenzer
Copy link
Author

cbenzer commented Nov 4, 2013

Great. Looking forward to give the tool a test run, especially the restarting options as I need to break my simulations into smaller chunks.

@rmcgibbo rmcgibbo mentioned this issue Nov 4, 2013
Merged
@rmcgibbo
Copy link
Owner

rmcgibbo commented Nov 4, 2013

I merged fixes for the issues you identified. With my python2.6.8 installation, everything is humming smoothly. Let me know if you have any issues.

@cbenzer
Copy link
Author

cbenzer commented Nov 5, 2013

Installed the updated code and first test run succeeded out of the box.

@cbenzer cbenzer closed this as completed Nov 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants