cdanielmachado / carveme

CarveMe: genome-scale metabolic model reconstruction
Other
153 stars 52 forks source link

TypeError: not a list #90

Closed SilasK closed 3 years ago

SilasK commented 4 years ago

I got this error when using recursive flag.

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/home/kiesers/scratch/miniconda3/envs/carveme/bin/carve", line 391, in f
    recursive_mode=True
  File "/home/kiesers/scratch/miniconda3/envs/carveme/bin/carve", line 198, in main
    debug_output=debug_output)
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/site-packages/carveme/reconstruction/carving.py", line 236, in carve_model
    ref_reactions=ref_reactions, ref_score=ref_score, debug_output=debug_output)
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/site-packages/carveme/reconstruction/carving.py", line 123, in minmax_reduction
    solver.update()
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/site-packages/framed/solvers/cplex_interface.py", line 206, in update
    self.add_variables(var_ids, lbs, ubs, vartypes)
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/site-packages/framed/solvers/cplex_interface.py", line 105, in add_variables
    self.problem.variables.add(names=var_ids, lb=lbs, ub=ubs, types=vartypes)
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/site-packages/cplex/_internal/_subinterfaces.py", line 456, in add
    obj, lb, ub, types, names, columns)
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/site-packages/cplex/_internal/_baseinterface.py", line 41, in _add_iter
    addfun(*args, **kwargs)
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/site-packages/cplex/_internal/_subinterfaces.py", line 378, in _add
    types, names)
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/site-packages/cplex/_internal/_procedural.py", line 967, in newcols
    xctype, colname)
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/site-packages/cplex/_internal/_pycplex.py", line 1785, in CPXXnewcols
    return _pycplex_platform.CPXXnewcols(env, lp, ccnt, py_obj, py_lb, py_ub, xctype, colname)
TypeError: not a list
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/kiesers/scratch/miniconda3/envs/carveme/bin/carve", line 395, in <module>
    p.map(f, args.input)
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/multiprocessing/pool.py", line 266, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/home/kiesers/scratch/miniconda3/envs/carveme/lib/python3.6/multiprocessing/pool.py", line 644, in get
    raise self._value
TypeError: not a list
cdanielmachado commented 4 years ago

Thats strange, this looks like a problem with CPLEX and not with the recursive mode. Are you sure it only happens in recursive mode?

SilasK commented 4 years ago

No I get the same error with only one genome.

I try to install carveme on python 2.7, well see if it helps.

cdanielmachado commented 4 years ago

I think this is a bug I have fixed in the development version, but is still not integrated into the latest stable version.

Can you please try:

pip uninstall carveme
pip install https://github.com/cdanielmachado/carveme/archive/master.zip

Also, please continue with Python 3.6 or 3.7. I have now dropped support for python 2.7.

mohammadsp commented 4 years ago

Had the same issue, installed the development version, but I am getting this error now:

Traceback (most recent call last): File "/home/ubuntu/.local/bin/carve", line 11, in <module> load_entry_point('carveme==1.3.0', 'console_scripts', 'carve')() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 480, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2693, in load_entry_point return ep.load() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2324, in load return self.resolve() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2330, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/home/ubuntu/.local/lib/python3.6/site-packages/carveme/cli/carve.py", line 3, in <module> from carveme.reconstruction.carving import carve_model, build_ensemble File "/home/ubuntu/.local/lib/python3.6/site-packages/carveme/reconstruction/carving.py", line 5, in <module> from reframed.cobra.ensemble import EnsembleModel, save_ensemble ModuleNotFoundError: No module named 'reframed.cobra.ensemble'

It is obviously related to reframed because when we tried the last commit before the switch to reframed, it worked fine (except for the "not a list" issue)

dotPiano commented 4 years ago

Had the same issue, installed the development version, but I am getting this error now:

Same problem for me. The ensemble module doesn't seem to exist in neither the pip or github versions.

While waiting for a fix, my temporary workaround was to locally delete the build_ensemble function and from reframed.cobra.ensemble import EnsembleModel, save_ensemble line from carveme/reconstruction/carving.py.

cdanielmachado commented 4 years ago

Dear all, sorry about that... since this was a development version it was not properly tested :)

I have now pushed the ensemble module to reframed on github.

Please do:

pip uninstall reframed
pip install https://github.com/cdanielmachado/reframed/archive/master.zip
dotPiano commented 4 years ago

That was quick! Works for me, thanks! :)

mohammadsp commented 4 years ago

Thank you for the fix. However, carveme_init now fails because of this commit (updated refseq and removed support for genbank) https://github.com/cdanielmachado/carveme/commit/032bfc718fb6b3e44efcad7edfea739d158e87e9

carveme_init.py is not updated to reflect changes. I updated refseq to refseq_release_201.tsv.gz and removed genbank entry and it is working fine now.

cdanielmachado commented 4 years ago

Oops :) Sorry it is hard to account for everything during development. I'll make sure all these changes are properly tested before the next stable release.