FRED-2 / OptiType

Precision HLA typing from next-generation sequencing data
BSD 3-Clause "New" or "Revised" License
188 stars 75 forks source link

AttributeError: type object 'PluginGlobals' has no attribute 'add_env' #14

Closed SNRNS closed 9 years ago

SNRNS commented 9 years ago

Dear all,

To my knowledge, I have installed OptiType and the required softwares and libraries, however I got the following error:

C02NQ30CG3QT:OptiType-master jimene01$ python OptiTypePipeline.py --help
Error loading 'pyutilib.component' entry points: 'type object 'PluginGlobals' has no attribute     'add_env''
Traceback (most recent call last):
  File "OptiTypePipeline.py", line 108, in <module>
    from model import OptiType
  File "/Users/jimene01/Documents/ResearchPlacement/Project/OptiType/OptiType-master/model.py", line 15, in <module>
    import coopr.environ
  File "/Users/jimene01/anaconda/lib/python2.7/site-packages/coopr/environ/__init__.py", line 48, in   <module>
    import_packages()
  File "/Users/jimene01/anaconda/lib/python2.7/site-packages/coopr/environ/__init__.py", line 38, in import_packages
    do_import(pname)
  File "/Users/jimene01/anaconda/lib/python2.7/site-packages/coopr/environ/__init__.py", line 20, in do_import
    __import__(pname, globals(), locals(), [], -1)
  File "/Users/jimene01/anaconda/lib/python2.7/site-packages/coopr/pyomo/__init__.py", line 16, in <module>
    from pyomo.environ import *
 File "/Users/jimene01/anaconda/lib/python2.7/site-packages/pyomo/environ/__init__.py", line 13, in <module>
    import pyomo.core
  File "/Users/jimene01/anaconda/lib/python2.7/site-packages/pyomo/core/__init__.py", line 10, in <module>
    from pyomo.util.plugin import PluginGlobals
  File "/Users/jimene01/anaconda/lib/python2.7/site-packages/pyomo/util/__init__.py", line 10, in <module>
    from pyomo.util._task import pyomo_api, PyomoAPIData, PyomoAPIFactory
  File "/Users/jimene01/anaconda/lib/python2.7/site-packages/pyomo/util/_task.py", line 26, in   <module>
    plugin.PluginGlobals.add_env("pyomo")
AttributeError: type object 'PluginGlobals' has no attribute 'add_env'

I would highly appreciate if you would not mind helping me troubleshooting my installation, since I noticed that I have the softwares but for many of them the version is different from the one you have put in the requirements, and I do not know if that affects OptiType.

Moreover, I am not quite sure if Razers3 and Cbc works correctly... To be honest, this is the first time I install something that needs other many programs and I am not quite sure everything works correctly together.

I would highly appreciate any help that may be provided, Alejandro

andras86 commented 9 years ago

Dear Alejandro,

I suggest that you check out the branch pysam and follow the instructions. It works with the most recent version of every dependency. I have just tested it from absolute scratch, built all the software and modules with their current versions and I had no issues.

The situation we have on our hand is plain dependency hell, modules breaking compatibility left and right every other week and we just haven't adapted the requirement list on the master readme. Consider it stale.

The pysam branch works right now. We will merge it back to master very soon.

As for RazerS3 and CBC not working, I don't know if I can help you with them but I'll try. What's wrong there, what makes you unsure whether they work or not?

SNRNS commented 9 years ago

Hi, Many thanks for your response. I will try the pysam branch from scratch on a virtual machine and see if it works. I will let you know if I have any troubles or if it works fine at the end. Best, Alejandro

SNRNS commented 9 years ago

Hello, I have installed everything on OS X 10.9.5 following the instructions and I have made sure that each software works, and the new Environment variables work fine. However, when I type: python OptiTypePipeline.py --help I get the following error:

objc[8183]: Class TKApplication is implemented in both   /Users/jimene01/anaconda/envs/OptiType/lib/libtk8.5.dylib and    /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is   undefined.
objc[8183]: Class TKMenu is implemented in both   /Users/jimene01/anaconda/envs/OptiType/lib/libtk8.5.dylib and   /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is  undefined.
objc[8183]: Class TKContentView is implemented in both /Users/jimene01/anaconda/envs/OptiType/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
objc[8183]: Class TKWindow is implemented in both /Users/jimene01/anaconda/envs/OptiType/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
Traceback (most recent call last):
  File "OptiTypePipeline.py", line 108, in <module>
    from model import OptiType
  File "/Users/jimene01/Documents/PhD/Project/Optitype/OptiType-master/model.py", line 15, in   <module>
    import coopr.environ
  File "/Users/jimene01/anaconda/envs/OptiType/lib/python2.7/site- packages/coopr/environ/__init__.py", line 48, in <module>
    import_packages()
  File "/Users/jimene01/anaconda/envs/OptiType/lib/python2.7/site- packages/coopr/environ/__init__.py", line 40, in import_packages
    raise ImportError("Failed to import %s" % pname)
ImportError: Failed to import coopr.opt.plugins
(OptiType)C02NQ30CG3QT:OptiType-master jimene01$ 
(OptiType)C02NQ30CG3QT:OptiType-master jimene01$ python OptiTypePipeline.py --help
objc[8803]: Class TKApplication is implemented in both   /Users/jimene01/anaconda/envs/OptiType/lib/libtk8.5.dylib and  /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is  undefined.
objc[8803]: Class TKMenu is implemented in both   /Users/jimene01/anaconda/envs/OptiType/lib/libtk8.5.dylib and  /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is  undefined.
objc[8803]: Class TKContentView is implemented in both  /Users/jimene01/anaconda/envs/OptiType/lib/libtk8.5.dylib and  /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is  undefined.
objc[8803]: Class TKWindow is implemented in both   /Users/jimene01/anaconda/envs/OptiType/lib/libtk8.5.dylib and  /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is  undefined.
Traceback (most recent call last):
  File "OptiTypePipeline.py", line 108, in <module>
    from model import OptiType
  File "/Users/jimene01/Documents/PhD/Project/Optitype/OptiType-master/model.py", line 15, in  <module>
    import coopr.environ
  File "/Users/jimene01/anaconda/envs/OptiType/lib/python2.7/site- packages/coopr/environ/__init__.py", line 48, in <module>
    import_packages()
  File "/Users/jimene01/anaconda/envs/OptiType/lib/python2.7/site-  packages/coopr/environ/__init__.py", line 40, in import_packages
    raise ImportError("Failed to import %s" % pname)
ImportError: Failed to import coopr.opt.plugins

Before I got this error, I had to install coopr.environ and biopython in addition to what is listed, since I was getting errors. If I write pip install coopr.opt.plugins I get:

Collecting coopr.opt.plugins
  Could not find a version that satisfies the requirement coopr.opt.plugins (from versions: )
No matching distribution found for coopr.opt.plugins

Also, I had to use conda instead of virtualenv to create the Python virtual environment because I am using the Anaconda Python distribution.

Thank you very much for your help, Alejandro

andras86 commented 9 years ago

Hi Alejandro,

I see it in the few lines of code that the traceback shows that you're using an older version of OptiType, and since some of our dependencies have changed their APIs they won't work. Update it to the current one. Checkout the current version and follow the instructions. You shouldn't have to install any more things than you see in the readme.

andras86 commented 9 years ago

One more note. While it may well work on OS X, we haven't tested it. And honestly, due to the fact that some steps may be pretty memory intensive (depending on your data) I don't really recommend running OptiType on a laptop or desktop.

SNRNS commented 9 years ago

OK, I see. Thanks, I'll consider it then and I'll get back to you again soon.

SNRNS commented 9 years ago

Great, it seems that now it works, at least python OptoTypePipeline.py -h works. However, when I try the Test examples I get the following ValueError:

Traceback (most recent call last):
  File "./OptiTypePipeline.py", line 208, in <module>
    unpaired_weight = config.getfloat('behavior', 'unpaired_weight')
  File "/Users/jimene01/anaconda/envs/OptiType/lib/python2.7/ConfigParser.py", line 362, in getfloat
    return self._get(section, float, option)
  File "/Users/jimene01/anaconda/envs/OptiType/lib/python2.7/ConfigParser.py", line 356, in _get
    return conv(self.get(section, option))
ValueError: invalid literal for float(): 0.2  # we'll enable this setting later

Is there something wrong?

Best, Alejandro

andras86 commented 9 years ago

Nothing major, just remove the comment and the spaces from after unpaired_weight=0.2 in your config file.

SNRNS commented 9 years ago

Hello again, After that last change to the config file, the test examples worked fine. Thank you very much. I was waiting to see if I got another error or something but so far I haven't and now I am transforming the bam files into fastq files. Then I will run Optitype on the fastq files. I hope everything will be OK. Many thanks for your help! Alejandro

andras86 commented 9 years ago

Good to hear, best of luck!

messersc commented 8 years ago

Just a note: If you run into

AttributeError: type object 'PluginGlobals' has no attribute 'add_env' 

check your Pyomo version.

Error went away for me on CentOS, when I switched from COOPR 3.5 to Pyomo 4.2