QAOAKit / QAOAKit

A Toolkit for Reproducible Study, Application and Verification of QAOA
BSD 2-Clause "Simplified" License
49 stars 9 forks source link

Conflicting dependencies Error #59

Open Syed-Affan-Hussain opened 1 year ago

Syed-Affan-Hussain commented 1 year ago

I am receiving the error below while installing QAOAKit in a conda environment, I also tried installing pynauty==1.0.0 separately but that didn't happen either. ERROR: Could not find a version that satisfies the requirement pynauty==1.0.0 (from versions: 1.0.2, 1.1.1, 1.1.2, 2.8.6) ERROR: No matching distribution found for pynauty==1.0.0 ERROR: Cannot install qaoakit==0.1.10, qaoakit==0.1.11, qaoakit==0.1.12, qaoakit==0.1.13, qaoakit==0.1.7, qaoakit==0.1.8 and qaoakit==0.1.9 because these package versions have conflicting dependencies.

The conflict is caused by: qaoakit 0.1.13 depends on pynauty==1.0.0 qaoakit 0.1.12 depends on pynauty==1.0.0 qaoakit 0.1.11 depends on pynauty==1.0.0 qaoakit 0.1.10 depends on pynauty==1.0.0 qaoakit 0.1.9 depends on pynauty==1.0.0 qaoakit 0.1.8 depends on pynauty==1.0.0 qaoakit 0.1.7 depends on pynauty==1.0.0

rsln-s commented 1 year ago

Thanks for reminding me to update the pypi version :) pynauty version has been unpinned on GitHub, but the updated release has not been pushed to Pypi.

In the meanwhile, install from source should work:

conda create -n qaoa python=3
conda activate qaoa
git clone https://github.com/QAOAKit/QAOAKit.git
cd QAOAKit
pip install .
python -m QAOAKit.build_tables
hillmich commented 9 months ago

Hi, I just tried to install from source on Ubuntu 22.04 (on WSL) with Python 3.10.12 in a fresh virtual environment and it does not compile.

The output is way to long to copy it here, but the last couple lines are

(.venv) $ pip install git+https://github.com/QAOAKit/QAOAKit.git
...
      [50/55] Cythonizing sklearn/utils/_readonly_array_wrapper.pyx
      [51/55] Cythonizing sklearn/utils/_seq_dataset.pyx
      [52/55] Cythonizing sklearn/utils/_weight_vector.pyx
      [53/55] Cythonizing sklearn/utils/arrayfuncs.pyx
      [54/55] Cythonizing sklearn/utils/murmurhash.pyx
      [55/55] Cythonizing sklearn/utils/sparsefuncs_fast.pyx
        File "/home/hillmich/repos/qaoa/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/hillmich/repos/qaoa/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 366, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 319, in <module>
        File "<string>", line 315, in setup_package
        File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/numpy/distutils/core.py", line 135, in setup
          config = configuration()
        File "<string>", line 201, in configuration
        File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 1014, in add_subpackage
          config_list = self.get_subpackage(subpackage_name, subpackage_path,
        File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 980, in get_subpackage
          config = self._get_configuration_from_setup_py(
        File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 922, in _get_configuration_from_setup_py
          config = setup_module.configuration(*args)
        File "/tmp/pip-install-iu8lc1my/scikit-learn_f37b283ed860496dade6d4685b9b2315/sklearn/setup.py", line 85, in configuration
          cythonize_extensions(top_path, config)
        File "/tmp/pip-install-iu8lc1my/scikit-learn_f37b283ed860496dade6d4685b9b2315/sklearn/_build_utils/__init__.py", line 73, in cythonize_extensions
          config.ext_modules = cythonize(
        File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1145, in cythonize
          result.get(99999)  # seconds
        File "/usr/lib/python3.10/multiprocessing/pool.py", line 774, in get
          raise self._value
      Cython.Compiler.Errors.CompileError: sklearn/ensemble/_hist_gradient_boosting/splitting.pyx

So it looks like something is off with cython. I also tried after pip install pynauty==1.0.2 but this does not make a difference.

Any idea what to do?

nbcongmingdan commented 9 months ago

I have the same problem with pynauty historical versions. It's really nauty

XU

Stefan Hillmich @.***> 于2024年1月30日周二 13:22写道:

Hi, I just tried to install from source on Ubuntu 22.04 (on WSL) with Python 3.10.12 in a fresh virtual environment and it does not compile.

The output is way to long to copy it here, but the last couple lines are

(.venv) $ pip install git+https://github.com/QAOAKit/QAOAKit.git ... [50/55] Cythonizing sklearn/utils/_readonly_array_wrapper.pyx [51/55] Cythonizing sklearn/utils/_seq_dataset.pyx [52/55] Cythonizing sklearn/utils/_weight_vector.pyx [53/55] Cythonizing sklearn/utils/arrayfuncs.pyx [54/55] Cythonizing sklearn/utils/murmurhash.pyx [55/55] Cythonizing sklearn/utils/sparsefuncs_fast.pyx File "/home/hillmich/repos/qaoa/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(*hook_input['kwargs']) File "/home/hillmich/repos/qaoa/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel return hook(metadata_directory, config_settings) File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 366, in prepare_metadata_for_build_wheel self.run_setup() File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 480, in run_setup super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script) File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup exec(code, locals()) File "", line 319, in File "", line 315, in setup_package File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/numpy/distutils/core.py", line 135, in setup config = configuration() File "", line 201, in configuration File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 1014, in add_subpackage config_list = self.get_subpackage(subpackage_name, subpackage_path, File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 980, in get_subpackage config = self._get_configuration_from_setup_py( File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 922, in _get_configuration_from_setup_py config = setup_module.configuration(args) File "/tmp/pip-install-iu8lc1my/scikit-learn_f37b283ed860496dade6d4685b9b2315/sklearn/setup.py", line 85, in configuration cythonize_extensions(top_path, config) File "/tmp/pip-install-iu8lc1my/scikit-learn_f37b283ed860496dade6d4685b9b2315/sklearn/_build_utils/init.py", line 73, in cythonize_extensions config.ext_modules = cythonize( File "/tmp/pip-build-env-3t5w3sb4/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1145, in cythonize result.get(99999) # seconds File "/usr/lib/python3.10/multiprocessing/pool.py", line 774, in get raise self._value Cython.Compiler.Errors.CompileError: sklearn/ensemble/_hist_gradient_boosting/splitting.pyx

So it looks like something is off with cython. I also tried after pip install pynauty==1.0.2 but this does not make a difference.

Any idea what to do?

— Reply to this email directly, view it on GitHub https://github.com/QAOAKit/QAOAKit/issues/59#issuecomment-1916728090, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS5UCQGKNIVEDVZA2ZFTVNDYRDQX5AVCNFSM6AAAAAAXVZ34F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJWG4ZDQMBZGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

shubhamkaushal765 commented 8 months ago

I was also facing these same issues, finally solved the installation, so here it goes:

Install the dependencies separately

from setup.py install these with different versions

pip install qiskit==1.0.2 qiskit-aer==0.13.3 scikit-learn==1.4.1.post1 pynauty==1.1.2

Install the other installations using the pip command

pip install qiskit-opmitization numpy pandas networkx pytest tqdm cvxgraphalgs cvxopt notebook matplotlib seaborn

Then install QAOA without any dependencies by running the command

pip install --no-deps QAOAKit

After this, while importing the QAOAKit, qaoa.py and utils.py files in the library fail. The path will be somewhat like .../env/lib/python3.11/site-packages/QAOAKit/qaoa.py and .../env/lib/python3.11/site-packages/QAOAKit/utils.py respectively.

change this to from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister and change this line to from qiskit_aer import AerSimulator

I have tested the example given in the README of this repo. That is working without any problem!!

Note: There might still be some Qiskit imports that might need rerouting. Otherwise it works fine.

rsln-s commented 8 months ago

@shubhamkaushal765 thank you for the very detailed solution! If you have time, it would be great if you could open a PR with the fixes you suggest in your comment.

shubhamkaushal765 commented 7 months ago

Hi @rsln-s, I have made the changes and opened a PR #62. I must say it's great work to have collected and made this library for QAOA simulation and experimentation. It's brilliant!

In your previous comment, @hillmich The cythonizing error of scikit-learn is coming with lots of package-versions. I was facing it even when I used 1.4.0. In the PR I am using 1.4.1.post1.

@rsln-s I believe there is some bug in build_tables.py as well. After running it, graph2pynauty_large_9.p is not saved, and hence full_qaoa_dataset_table.p is not getting created here. So the all test cases which call the get_full_qaoa_dataset_table function fails. Will fix it in a different PR later. Other than these, the test cases are working fine.

Thanks!