cdanielmachado / carveme

CarveMe: genome-scale metabolic model reconstruction
Other
147 stars 50 forks source link

Solver 'cplex' not available #87

Closed juz4karen closed 3 years ago

juz4karen commented 3 years ago

HI there,

I read that, the current stable version of CarveMe supports CPLEX 12.7 with Python 3.6.

I created env python=3.6, setting up the script setup.py in Cplex 12.8. However when I init carveme, it showed error.

OSError: Solver 'cplex' not available.

May I ask how could I solve this?

Attached herewith the command output.

Solver cplex not available.txt

juz4karen commented 3 years ago

Here what I did:

conda create --name py3.6 python=3.6 conda activate py3.6 pip install carveme pip install future cd /applications/Cplex_Studio128/cplex/python/3.6/x86-64_osx python3.6 setup.py install

and finally

(py3.6) Karens-MacBook-Air:x86-64_osx karenchung$ carveme_init Traceback (most recent call last): File "/Users/karenchung/miniconda3/bin/carveme_init", line 11, in from carveme import project_dir File "/Users/karenchung/miniconda3/lib/python3.7/site-packages/carveme/init.py", line 14, in set_default_solver(config.get('solver', 'default_solver')) File "/Users/karenchung/miniconda3/lib/python3.7/site-packages/framed/solvers/init.py", line 61, in set_default_solver raise EnvironmentError("Solver '{}' not available.".format(solvername)) OSError: Solver 'cplex' not available.

cdanielmachado commented 3 years ago

Could you please try this, and let me know the output ?

python -c 'import cplex; print(cplex.__version__)'

juz4karen commented 3 years ago

Hi, here's the ouput,

(py3.6) Karens-MacBook-Air:x86-64_osx karenchung$ python -c 'import cplex; print(cplex.version)' 12.8.0.0

cdanielmachado commented 3 years ago

There is something strange in your conda installation:

File "/Users/karenchung/miniconda3/lib/python3.7/site-packages/carveme/init.py", line 14, in

Why does it say python3.7 if you are running python3.6 ?

juz4karen commented 3 years ago

I'm not sure why...here what I tried again (below shown part of the output, for full output kindly refer to attached). When I tried to carve model, it showed error:Database was built with an older version of Diamond and is incompatible.

Failed to run Diamond.txt

conda activate py3.6

pip list carveme 1.2.2 cplex 12.8.0.0

pip show carveme Name: carveme Version: 1.2.2 Location: /Users/karenchung/miniconda3/envs/py3.6/lib/python3.6/site-packages

carve GCF_000364385.3_ASM36438v3_protein.faa --gapfill M9,LB -i M9 Error: Database was built with an older version of Diamond and is incompatible. Failed to run diamond.

cdanielmachado commented 3 years ago

You need to run carveme_init to re-build and update the internal protein database that diamond needs.

juz4karen commented 3 years ago

Hi, I'm so excited to tell that finally it works for me!

When I did,
conda update diamond PackageNotInstalledError: Package is not installed in prefix. prefix: /Users/karenchung/miniconda3/envs/py3.6 package name: diamond

Then I realised that diamond is not in my python3.6 env conda list.

Hence I conda install -c bioconda diamond conda update diamond carveme_init

then carve my model, and it works!

Thank you so much for all the advises and help!

cdanielmachado commented 3 years ago

Perfect! I am happy to know that it finally worked.

I will try to make installation easier in the next releases.

kunaljaani commented 2 years ago

Hi!

I could see the installed version of the cplex but still I am getting the "Solver cplex not available" error.

ubuntu@kv-metagenome:/DATA/janik/metaGEM$ python -c 'import cplex; print(cplex.version)' 20.1.0.0

Creating temporary directory /DATA/janik/metaGEM/SCRATCH/GEMs/M_bin.19.p ... Begin carving GEM ... Traceback (most recent call last): File "/home/ubuntu/.local/bin/carve", line 5, in from carveme.cli.carve import main File "/home/ubuntu/.local/lib/python3.8/site-packages/carveme/init.py", line 14, in set_default_solver(config.get('solver', 'default_solver')) File "/home/ubuntu/.local/lib/python3.8/site-packages/reframed/solvers/init.py", line 60, in set_default_solver raise RuntimeError(f"Solver {solvername} not available.") RuntimeError: Solver cplex not available.

UPDATE

It finally worked! After installing an academic version of CPLEX followed the steps for CPLEX python API.

ubuntu@#####:$ cd /opt/ibm/ILOG/CPLEX_Studio201/cplex/python/3.8/x86-64_linux/ ubuntu@#####:$ python setup.py install ubuntu@#####:$ python setup.py install --home /home/ubuntu/.local/lib/python3.8/site-packages/cplex ubuntu@#####:$ export PYTHONPATH=/opt/ibm/ILOG/CPLEX_Studio201/cplex/python/3.8/x86-64_linux

Thanks a lot.

NanYang90 commented 2 years ago

Hi,

Could I ask how to install cplex? I downloaded the .bin file like this: cplex_studio128.linux-x86-64.bin. But I tried many times in Mac terminal, I got an error: Preparing to install Extracting the JRE from the installer archive... Unpacking the JRE... Extracting the installation resources from the installer archive... Configuring the installer for this system's environment...

Launching installer...

JRE libraries are missing or not compatible.... Exiting....

Did I install a correct version of cplex? and how to fix this problem. Thanks a lot in advance!

kunaljaani commented 2 years ago

Hi

I downloaded the latest version of the CPLEX (academic version).

and was installed using the following steps--

ILOG_COS_20.10_LINUX_X86_64.bin chmod u+x ILOG_COS_20.10_LINUX_X86_64.bin ./ILOG_COS_20.10_LINUX_X86_64.bin LAX_VM /usr/bin/java ./ILOG_COS_20.10_LINUX_X86_64.bin

and later configured using CPLEX python API.

ubuntu@#####:$ cd /opt/ibm/ILOG/CPLEX_Studio201/cplex/python/3.8/x86-64_linux/ ubuntu@#####:$ python setup.py install ubuntu@#####:$ python setup.py install --home /home/ubuntu/.local/lib/python3.8/site-packages/cplex ubuntu@#####:$ export PYTHONPATH=/opt/ibm/ILOG/CPLEX_Studio201/cplex/python/3.8/x86-64_linux