cdanielmachado / carveme

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

Version issues and Solver 'cplex' not available #160

Closed bananabenana closed 2 years ago

bananabenana commented 2 years ago

Hi,

Really love the tool. I wanted to raise that I had significant issues getting this to work, due to the lack of documentation regarding versions of CPLEX and python and the Solver 'cplex' not available error. In my case, this was due to incorrect versions of CPLEX and python being used.

For anyone who is having trouble installing this, try using python 3.8 with CPLEX version 20.10.

  1. Run the following:
# Create env with py3.8
conda create -y --name carveme_env python=3.8

# Activate env
conda activate carveme_env

# Install carveme via pip
pip install carveme

# Install diamond
conda install -y -c bioconda diamond
  1. Download 20.1.0 CPLEX here

    • Log in/register via academic institution
    • Scroll down till you see the Software link, then click
    • Click on the ILOG CPLEX Optimization Studio tile
    • Click Download
    • Under Search Options, change header from Part number to Text
    • Type in CPLEX
    • Find IBM ILOG CPLEX Optimization Studio V20.1.0 eAssembly (eAssembly CJ8GXML)
    • Download for your appropriate environment (Win/OSX/Linux)
  2. Run the following on your downloaded installer:

    
    # Grant yourself execution permissions to run the installer
    chmod u+x ILOG_COS_20.10_LINUX_X86_64.bin

Run the installer

./ILOG_COS_20.10_LINUX_X86_64.bin

Once this is complete, run the standard python installer

python /YOUR/PATH/HERE/CPLEX/python/setup.py install

4. Test CarveMe

carve -h

LiZhihua1982 commented 1 year ago

(carveme) lizhihua@lizhihua-T640:/media/lizhihua/software/metaGEM/envs/metagem/opt/ibm/ILOG/CPLEX_Studio128/cplex/python/3.6/x86-64_linux$ sudo python3 setup.py install [sudo] password for lizhihua: running install running build running build_py creating build/lib creating build/lib/cplex copying cplex/aborter.py -> build/lib/cplex copying cplex/callbacks.py -> build/lib/cplex copying cplex/six.py -> build/lib/cplex copying cplex/init.py -> build/lib/cplex creating build/lib/cplex/_internal copying cplex/_internal/_anno.py -> build/lib/cplex/_internal copying cplex/_internal/_aux_functions.py -> build/lib/cplex/_internal copying cplex/_internal/_callbackinfoenum.py -> build/lib/cplex/_internal copying cplex/_internal/_constants.py -> build/lib/cplex/_internal copying cplex/_internal/_constantsenum.py -> build/lib/cplex/_internal copying cplex/_internal/_list_array_utils.py -> build/lib/cplex/_internal copying cplex/_internal/_matrices.py -> build/lib/cplex/_internal copying cplex/_internal/_ostream.py -> build/lib/cplex/_internal copying cplex/_internal/_parameters_auto.py -> build/lib/cplex/_internal copying cplex/_internal/_parameter_classes.py -> build/lib/cplex/_internal copying cplex/_internal/_parameter_hierarchy.py -> build/lib/cplex/_internal copying cplex/_internal/_procedural.py -> build/lib/cplex/_internal copying cplex/_internal/_pwl.py -> build/lib/cplex/_internal copying cplex/_internal/_pycplex.py -> build/lib/cplex/_internal copying cplex/_internal/_pycplex_platform.py -> build/lib/cplex/_internal copying cplex/_internal/_solutionstrategyenum.py -> build/lib/cplex/_internal copying cplex/_internal/_subinterfaces.py -> build/lib/cplex/_internal copying cplex/_internal/init.py -> build/lib/cplex/_internal creating build/lib/cplex/exceptions copying cplex/exceptions/errors.py -> build/lib/cplex/exceptions copying cplex/exceptions/error_codes.py -> build/lib/cplex/exceptions copying cplex/exceptions/init.py -> build/lib/cplex/exceptions copying cplex/_internal/py36_cplex1280.so -> build/lib/cplex/_internal running install_lib creating /usr/local/lib/python3.6/dist-packages/cplex copying build/lib/cplex/aborter.py -> /usr/local/lib/python3.6/dist-packages/cplex copying build/lib/cplex/callbacks.py -> /usr/local/lib/python3.6/dist-packages/cplex copying build/lib/cplex/six.py -> /usr/local/lib/python3.6/dist-packages/cplex copying build/lib/cplex/init.py -> /usr/local/lib/python3.6/dist-packages/cplex creating /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_anno.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_aux_functions.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_callbackinfoenum.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_constants.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_constantsenum.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_list_array_utils.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_matrices.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_ostream.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_parameters_auto.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_parameter_classes.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_parameter_hierarchy.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_procedural.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_pwl.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_pycplex.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_pycplex_platform.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_solutionstrategyenum.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/_subinterfaces.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/init.py -> /usr/local/lib/python3.6/dist-packages/cplex/_internal copying build/lib/cplex/_internal/py36_cplex1280.so -> /usr/local/lib/python3.6/dist-packages/cplex/_internal creating /usr/local/lib/python3.6/dist-packages/cplex/exceptions copying build/lib/cplex/exceptions/errors.py -> /usr/local/lib/python3.6/dist-packages/cplex/exceptions copying build/lib/cplex/exceptions/error_codes.py -> /usr/local/lib/python3.6/dist-packages/cplex/exceptions copying build/lib/cplex/exceptions/init.py -> /usr/local/lib/python3.6/dist-packages/cplex/exceptions byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/aborter.py to aborter.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/callbacks.py to callbacks.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/six.py to six.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/init.py to init.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_anno.py to _anno.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_aux_functions.py to _aux_functions.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_callbackinfoenum.py to _callbackinfoenum.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_constants.py to _constants.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_constantsenum.py to _constantsenum.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_list_array_utils.py to _list_array_utils.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_matrices.py to _matrices.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_ostream.py to _ostream.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_parameters_auto.py to _parameters_auto.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_parameter_classes.py to _parameter_classes.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_parameter_hierarchy.py to _parameter_hierarchy.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_procedural.py to _procedural.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_pwl.py to _pwl.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_pycplex.py to _pycplex.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_pycplex_platform.py to _pycplex_platform.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_solutionstrategyenum.py to _solutionstrategyenum.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/_subinterfaces.py to _subinterfaces.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/_internal/init.py to init.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/exceptions/errors.py to errors.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/exceptions/error_codes.py to error_codes.cpython-36.pyc byte-compiling /usr/local/lib/python3.6/dist-packages/cplex/exceptions/init.py to init.cpython-36.pyc running install_egg_info Writing /usr/local/lib/python3.6/dist-packages/cplex-12.8.0.0.egg-info (carveme) lizhihua@lizhihua-T640:/media/lizhihua/software/metaGEM/envs/metagem/opt/ibm/ILOG/CPLEX_Studio128/cplex/python/3.6/x86-64_linux$ carve -h Traceback (most recent call last): File "/home/lizhihua/miniconda3/envs/mamba/envs/carveme/bin/carve", line 6, in from carveme.cli.carve import main File "/home/lizhihua/miniconda3/envs/mamba/envs/carveme/lib/python3.6/site-packages/carveme/init.py", line 14, in set_default_solver(config.get('solver', 'default_solver')) File "/home/lizhihua/miniconda3/envs/mamba/envs/carveme/lib/python3.6/site-packages/reframed/solvers/init.py", line 60, in set_default_solver raise RuntimeError(f"Solver {solvername} not available.") RuntimeError: Solver cplex not available.

LiZhihua1982 commented 1 year ago

(carveme) lizhihua@lizhihua-T640:/media/lizhihua/software/metaGEM/envs/metagem/opt/ibm/ILOG/CPLEX_Studio128/python$ sudo python3 setup.py install (carveme) lizhihua@lizhihua-T640:/media/lizhihua/software/metaGEM/envs/metagem/opt/ibm/ILOG/CPLEX_Studio128/python$ carve -h usage: carve [-h] [--dna | --egg | --refseq] [--diamond-args DIAMOND_ARGS] [-r] [-o OUTPUT] [-u UNIVERSE | --universe-file UNIVERSE_FILE] [--cobra | --fbc2] [-n ENSEMBLE] [-g GAPFILL] [-i INIT] [--mediadb MEDIADB] [-v] [-d] [--soft SOFT] [--hard HARD] [--reference REFERENCE] INPUT [INPUT ...]

Reconstruct a metabolic model using CarveMe

positional arguments: INPUT Input (protein fasta file by default, see other options for details). When used with -r an input pattern with wildcards can also be used. When used with --refseq an NCBI RefSeq assembly accession is expected.

optional arguments: -h, --help show this help message and exit --dna Build from DNA fasta file --egg Build from eggNOG-mapper output file --refseq Download genome from NCBI RefSeq and build --diamond-args DIAMOND_ARGS Additional arguments for running diamond -r, --recursive Bulk reconstruction from folder with genome files -o OUTPUT, --output OUTPUT SBML output file (or output folder if -r is used) -u UNIVERSE, --universe UNIVERSE Pre-built universe model (default: bacteria) --universe-file UNIVERSE_FILE Reaction universe file (SBML format) --cobra Output SBML in old cobra format --fbc2 Output SBML in sbml-fbc2 format -n ENSEMBLE, --ensemble ENSEMBLE Build model ensemble with N models -g GAPFILL, --gapfill GAPFILL Gap fill model for given media -i INIT, --init INIT Initialize model with given medium --mediadb MEDIADB Media database file -v, --verbose Switch to verbose mode -d, --debug Debug mode: writes intermediate results into output files --soft SOFT Soft constraints file --hard HARD Hard constraints file --reference REFERENCE Manually curated model of a close reference species.