Closed juz4karen closed 4 years ago
Hi
Have you defined the PYTHONPATH
variable ?
https://www.ibm.com/support/knowledgecenter/SSSA5P_12.8.0/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/set_up/Python_setup.html
Hi, I'm sorry but how do I do that? I'm new to this, not familiar with the command...
hi, you can have a look at https://docs.python.org/3.6/using/mac.html could be useful (you can select the python version you want)
Hi,
I suspect that the version of python you have is not supported by CPLEX.
@juz4karen what is the output of:
$ python --version
in your shell ?
Hi @vlkong ,
The output is
Python 3.7.6
So the problem is that you are trying to install cplex 2.7, 3.5 or 3.6 in python 3.7, which cannot work.
If I remember correctly, you are using miniconda with python 3.7
Please refer to the conda environment refman: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
To use cplex on python 3.6, please create a python 3.6 environment:
(base) $ conda create -n python36env python=3.6
(feel free to provide any packages you need next to python=3.6
)
Then you activate the environment you just created with:
(base) $ conda activate python36env
And then you can proceed with:
(base) $ cd /applications/CPLEX_Studio128/cplex/python/3.6/x86-64_osx
(python36env) $ python setup.py install
Of course, if you need python 2.7 or 3.5, replace the version accordingly
Hi, yes I'm using miniconda with python 3.7.
I created conda python 3.6 environment and successful to set up Cplex 12.8 python API.
However I still have problem on using Carveme, saying Solver cplex not available.
I guess it's the compatibility issue again, I'll ask Carveme support team again.
Thanks for the help and suggestion. Appreciate much
For your reference, attached herewith my output. Output .txt
Your output says that cplex is installed in /Users/karenchung/miniconda3/envs/myenv/lib/python3.6/site-packages
(which is what you want). But the trace from CarveMe says:
Traceback (most recent call last):
File "/Users/karenchung/miniconda3/bin/carve", line 4, in <module>
from carveme import config, project_dir
File "/Users/karenchung/miniconda3/lib/python3.7/site-packages/carveme/__init__.py", line 14, in <module>
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))
So CarveMe is running with python3.7 - I believe that you don't want carveMe to be installed in your miniconda base (and thus, using python 3.7) but only in your myenv
?
Yes yes, you're right. And that's what I confused. I have miniconda python 3.7, cplex 12.7, 12.8, 12.10 and CarveMe all installed in my system. I need to run CarveMe with cplex 12.8 in python 3.6 env. Thus I generate conda python 3.6 env.
Hence my question is how to run CarveMe in myenv?
Perhaps maybe I should uninstall all the other version of cplex (those not needed which not compatible with CarveMe) first?
The problem is that you probably installed CarveMe with pip install carveme
in your base environment, hence the
path to CarveMe is /Users/karenchung/miniconda3/bin/carve
.
If you want to use CarveMe in your env myenv
, you want to:
(base) $ conda activate myenv
(myenv) $ pip install carveme
The path to carve
(command which carve
) should be something like /Users/karenchung/miniconda3/envs/myenv/bin/carve
The other installations of cplex are not in the picture, they are just ignored. This is not a cplex problem, you should be able to solve your problem by following an anaconda 101 course (there are plenty online)
Hi vlkong, thank you so much for the suggestion. I had done some read up on the basic of anaconda/conda/miniconda.
Here what I did:
conda create --name py3.6 python=3.6 conda activate py3.6 pip install carveme 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
I'm still having error. probably it is from carveme again.
Hi @juz4karen,
If you look at the error message: it is loading carveme from python 3.7 environment, so it looks like carveme is using that python3.7 whatever the current environment.
I'm not familiar with carveme
but you can try the following:
carveme
is a shell script.
Maybe you can do something like:
$ which carveme
carveme
with your favorite editor. I believe that when you install that script, it hardcodes the python executable in that script.
1st few lines should look like:
#!/Users/karenchung/miniconda3/bin/python
from future import print_function from future import standard_library
The first line tells the shell where to find the python executable to execute the script.
Replace that with your python 3.6, then it should work, something like (please use the actual path with `which python` in your env:
Hi @vlkong ,
I'm so excited to tell that finally it works for me. I realised that diamond (one of the external dependancies of CarveMe is not in my python3.6 env). Hence I install diamond and re-initiate CarveMe, suddenly it works!
It no longer prompt cplex error.
Thank you so much for the advises and help! Appreciate so much!
Hi there, I downloaded Cplex 12.8 because it is needed with my other software which support Cplex 12.8.
However when I tried to fix environment with Python 2.7, 3.5 and 3.6, they all showed
CPLEX 12.8.0.0 is not compatible with this version of Python.
Please help me with the issue. Attached herewith the full output.
Python setup output.txt