Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CyLP can't detect CBC obtained from conda-forge "coin-or-cbc" #118

Closed
rileyjmurray opened this issue Mar 15, 2021 · 6 comments
Closed

CyLP can't detect CBC obtained from conda-forge "coin-or-cbc" #118

rileyjmurray opened this issue Mar 15, 2021 · 6 comments

Comments

@rileyjmurray
Copy link

rileyjmurray commented Mar 15, 2021

Per an exchange with @tkralphs, this issue is just to make note of some installation trouble I've had with CyLP.

Several months ago I tried installing CyLP on my macbook with no success. At the time I tried CBC from source, but if I remember correctly the process of compiling CBC failed (likely due to missing or badly-linked libraries on my mac).

I also tried installing CyLP a few days ago on a linux box (Ubuntu 20.04, Conda 4.9.2). I was able to install CBC and other packages through conda's "coin-or-cbc" package, but pip install cylp still fails. Terminal logging for both installation steps is given below. It's hard for me to figure out how to follow the directions in the error message from pip install cylp since I'm not sure where the relevant files live inside riley/acaconda3/envs/cbc38/....

Installing coin-or-cbc

(cbc38) riley@borneophant:~$ conda install -c conda-forge coin-or-cbc -y
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/riley/anaconda3/envs/cbc38

  added / updated specs:
    - coin-or-cbc


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    coin-or-clp-1.17.6         |       h59210d1_1         1.2 MB  conda-forge
    coin-or-utils-2.11.4       |       hd28eb2d_1         740 KB  conda-forge
    libcblas-3.9.0             |3_h893e4fe_netlib          54 KB  conda-forge
    liblapacke-3.9.0           |3_h893e4fe_netlib         649 KB  conda-forge
    ------------------------------------------------------------
                                           Total:         2.6 MB

The following NEW packages will be INSTALLED:

  bzip2              conda-forge/linux-64::bzip2-1.0.8-h516909a_3
  coin-or-cbc        conda-forge/linux-64::coin-or-cbc-2.10.5-h04ab381_0
  coin-or-cgl        conda-forge/linux-64::coin-or-cgl-0.60.3-h9dddf35_0
  coin-or-clp        conda-forge/linux-64::coin-or-clp-1.17.6-h59210d1_1
  coin-or-osi        conda-forge/linux-64::coin-or-osi-0.108.6-h7181961_0
  coin-or-utils      conda-forge/linux-64::coin-or-utils-2.11.4-hd28eb2d_1
  openblas           conda-forge/linux-64::openblas-0.3.3-h9ac9557_1001
  python_abi         conda-forge/linux-64::python_abi-3.8-1_cp38

The following packages will be UPDATED:

  ca-certificates    anaconda::ca-certificates-2020.10.14-0 --> conda-forge::ca-certificates-2020.12.5-ha878542_0
  certifi                anaconda::certifi-2020.6.20-py38_0 --> conda-forge::certifi-2020.12.5-py38h578d9bd_1

The following packages will be SUPERSEDED by a higher-priority channel:

  libopenblas        conda-forge::libopenblas-0.3.12-pthre~ --> anaconda::libopenblas-0.3.10-h5a2b251_0

The following packages will be DOWNGRADED:

  blas                                         2.3-openblas --> 1.1-openblas
  libblas                                  3.9.0-3_openblas --> 3.9.0-1_h6e990d7_netlib
  libcblas                                 3.9.0-3_openblas --> 3.9.0-3_h893e4fe_netlib
  liblapack                                3.9.0-3_openblas --> 3.9.0-3_h893e4fe_netlib
  liblapacke                               3.9.0-3_openblas --> 3.9.0-3_h893e4fe_netlib



Downloading and Extracting Packages
libcblas-3.9.0       | 54 KB     | ####################################################### | 100% 
coin-or-utils-2.11.4 | 740 KB    | ####################################################### | 100% 
coin-or-clp-1.17.6   | 1.2 MB    | ####################################################### | 100% 
liblapacke-3.9.0     | 649 KB    | ####################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

pip install cylp

(cbc38) riley@borneophant:~$ pip install cylp
Collecting cylp
  Using cached cylp-0.91.2.tar.gz (1.4 MB)
    ERROR: Command errored out with exit status 1:
     command: /home/riley/anaconda3/envs/cbc38/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-670rnw22/cylp/setup.py'"'"'; __file__='"'"'/tmp/pip-install-670rnw22/cylp/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-bp38udmy
         cwd: /tmp/pip-install-670rnw22/cylp/
    Complete output (29 lines):
    Package cbc was not found in the pkg-config search path.
    Perhaps you should add the directory containing `cbc.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'cbc' found
    Traceback (most recent call last):
      File "/tmp/pip-install-670rnw22/cylp/setup.py", line 58, in get_libs
        flags = (check_output(['pkg-config', '--libs', 'cbc'])
      File "/home/riley/anaconda3/envs/cbc38/lib/python3.8/subprocess.py", line 411, in check_output
        return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
      File "/home/riley/anaconda3/envs/cbc38/lib/python3.8/subprocess.py", line 512, in run
        raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['pkg-config', '--libs', 'cbc']' returned non-zero exit status 1.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-670rnw22/cylp/setup.py", line 114, in <module>
        libs, libDirs, incDirs = get_libs()
      File "/tmp/pip-install-670rnw22/cylp/setup.py", line 87, in get_libs
        raise Exception('''
    Exception:
                Could not find location of COIN installation.
                Please ensure that either
                * COIN_INSTALL_DIR is set to the location of the installation,
                * PKG_CONFIG_PATH points to the location of the .pc files, or
                * The cbc executable is in your executable path and is installed
                at the same location as the libraries.
    
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
@rileyjmurray rileyjmurray changed the title CyLP can't detect CBC installation obtained from conda-forge "coin-or-cbc CyLP can't detect CBC obtained from conda-forge "coin-or-cbc" Mar 15, 2021
@rileyjmurray
Copy link
Author

Possibly related to #85, #77, #65.

@tkralphs
Copy link
Member

I believe this should be fixed now in release 0.91.3. There was a small bug that escaped detection and prevented detecting a Cbc installed by Conda. Can you try it?

@rileyjmurray
Copy link
Author

@tkralphs it works now! I successfully installed ran this example on the repo landing page: https://github.com/coin-or/CyLP#modeling-example.

If anyone has trouble with the install then I recommend they run pip install cylp --no-cache-dir, to make sure they get the most recent version.

@tkralphs
Copy link
Member

Great, thanks for testing and letting me know. In the meantime, I ended up making a second release 0.91.4 because one of the changes I made didn't work with Cbc 2.9, which is still the default version in some Ubuntu distros.

@tkralphs
Copy link
Member

@rileyjmurray I wanted to add that I realized the "right" way to do this would have been to use a conda installed version of pkg-config, which nicely finds conda installed libraries with pkg-config files. If you just conda install pkg-config, everything works nicely.

@rileyjmurray
Copy link
Author

@tkralphs thanks for the update! To be honest this is the first I've heard of pkg-config. Looking at the Wikipedia page I'm amazed that I've gone this long without using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants