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

Aer is not compatible with Conan 2.0 API #1730

Open
hhorii opened this issue Feb 22, 2023 · 9 comments
Open

Aer is not compatible with Conan 2.0 API #1730

hhorii opened this issue Feb 22, 2023 · 9 comments
Labels
bug Something isn't working
Milestone

Comments

@hhorii
Copy link
Collaborator

hhorii commented Feb 22, 2023

Informations

  • Qiskit Aer version:
  • Python version:
  • Operating system:

What is the current behavior?

When Conan 2.0 is used to compile Aer, conan command fails with following message:

conan install: error: unrecognized arguments: -e=CONAN_CMAKE_PROGRAM=/tmp/pip-build-env-2heyx8vq/overlay/lib/python3.11/site-packages/cmake/data/bin/cmake

Steps to reproduce the problem

  1. Install the latest conan
  2. Build Aer

What is the expected behavior?

Install finishes without errors.

Suggested solutions

Migrate Conan from 1.X to 2.X.

@hhorii hhorii added the bug Something isn't working label Feb 22, 2023
@mdepasca
Copy link

Same issue here

@hhorii
Copy link
Collaborator Author

hhorii commented Feb 23, 2023

One of the reasons is an environment variable CONAN_CMAKE_PROGRAM is set here:

ENV CONAN_CMAKE_PROGRAM=${CMAKE_COMMAND}

CONAN_CMAKE_PROGRAM is not available in 2.0

@hhorii
Copy link
Collaborator Author

hhorii commented Feb 24, 2023

CONAN_CMAKE_PROGRAM was introduced here to solve compilation if cmake is not installed in the system and is installed on the fly.
#777

I'm guessing that this issue may be resolved with Conan 2.0. So, just taking CONAN_CMAKE_PROGRAM may resolve this issue.

This is related discussion: conan-io/conan#12701 (comment)

@kechen666
Copy link

Thank you for raising this issue.
Same issue I met today.

The environment is:

  • Qiskit Aer version: 0.12.0(/qiskit-aer/VERSION.txt)
  • python version: 3.8.16
  • Operating system: Windows 10

I run the python ./setup.py bdist_wheel to build the Aer, but get:

conan install: error: unrecognized arguments: -e=CONAN_CMAKE_PROGRAM=D:/anaconda/envs/ibm-qiskit/Lib/site-packages/cmake/data/bin/cmake.exe

Conan2.x did not find support for the conan install -e parameter.
Because I am not good at cmake and conan, I only can deal with it by installing the conan1.x:
pip uninstall conan
pip install conan==1.*

I hope someone can deal with it in cmake\conan_utils.cmake and update the CONTRIBUTING.md.

In addition, I also found that according to the current installation tutorial, the pybind11 library has not been installed and needs to be installed through pip install pybind11.

@JanLahmann
Copy link

Same issue, when installing Aer on Raspberry Pi. pip install qiskit breaks with

conan install: error: unrecognized arguments: -e=CONAN_CMAKE_PROGRAM=/tmp/pip-build-env-tojhgqm2/overlay/lib/python3.9/site-packages/cmake/data/bin/cmake

Building from current GitHub source (including #1729 ) works well.

The workaround mentioned above (#1730 (comment)) did not work to build Aer 0.11.2 on Raspberry Pi OS. Somehow the install procedure does not use the pre-installed Conan 1.x, but seems to force an install of Conan 2.x.
Is there a workaround to build current (0.11.2) and previous versions of Aer?

@kechen666
Copy link

I am sorry that I confuse you. The pip to install Conan means that you should do that.

If you use the pip install ., which means you will reinstall the conan by pyproject.toml.
Newer versions of pip will use the pyproject.toml file instead of set.py to build your environment.
If you want to understand more, you can get something from this Build System Interface.

I used the pip install conan==1.59.0 and changed the pyproject.toml file.

[build-system]
requires = [
  "setuptools",
  "wheel",
  "conan==1.59.0",
    .....
]

Then you will install the conan 1.59.0 instead of forcing an install of conan 2.x.
This is the easy way to deal with it.

@hhorii
Copy link
Collaborator Author

hhorii commented Mar 6, 2023

@JanLahmann
Current pyproject.toml is set as follows:

"conan<2.0.0",

I guess that your pip install qiskit downloadded source codes of qiskit-aer 0.11.2, which try to use latest of conan. Please install qiskit-aer from main branch with conan 1.X and then run pip install qiskit.

0.12.0 will be released in this week. After the release, I believe that, pip install qiskit will work with compilation of source codes of qiskit-aer 0.12.

@JanLahmann
Copy link

This thread was very helpful to me!

I actually implemented the solution you described and automated the Qiskit Aer install on Raspberry Pi (for Aer 0.11.2 and 0.11.0 so far).

This is the code snipped used:

# install current version of rust
curl -o get_rustup.sh -s https://sh.rustup.rs
sh ./get_rustup.sh -y
source $HOME/.cargo/env

# workaround to force conan v1.x
git clone https://github.com/Qiskit/qiskit-aer/ --branch 0.11.2
cd qiskit-aer
sed -i "s/conan>=1.40.0/conan<2.0.0/" pyproject.toml
pip install --prefer-binary . 

FYI, this is being used as part of the "RasQberry" project, which builds a functional model of IBM Quantum System One, running Qiskit (Aer) on a Raspberry Pi that is integrated into a 3D printed housing that is modelled after the IBM Quantum System One, see http://rasqberry.org and https://www.youtube.com/watch?v=LZZDI9oBFN8

@JanLahmann
Copy link

JanLahmann commented Mar 6, 2023

Please install qiskit-aer from main branch with conan 1.X and then run pip install qiskit.

0.12.0 will be released in this week. After the release, I believe that, pip install qiskit will work with compilation of source codes of qiskit-aer 0.12.

Yes, I tried that and it works well.
Good to hear that Aer 0.12.0 will be released soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants