dwave setup problem for python
Hi there!
Trying to use DWAVE first time to explore a power of QC.
Created a virtual environment ocean like it's described here: https://docs.ocean.dwavesys.com/en/stable/overview/install.html
doing
dwave setup
and got the next error:
(ocean) fire@note-4:~/py_projects/QUBO_dwave_first_try/dwave-ocean-sdk$ dwave install --help
/home/fire/py_projects/QUBO_dwave_first_try/ocean/lib/python3.10/site-packages/pydantic-2.0a4-py3.10.egg/pydantic/_internal/_config.py:233: UserWarning: Valid config keys have changed in V2:
* 'json_encoders' has been removed
warnings.warn(message, UserWarning)
Traceback (most recent call last):
File "/home/fire/py_projects/QUBO_dwave_first_try/ocean/bin/dwave", line 33, in <module>
sys.exit(load_entry_point('dwave-cloud-client==0.10.4', 'console_scripts', 'dwave')())
File "/home/fire/py_projects/QUBO_dwave_first_try/ocean/bin/dwave", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/fire/py_projects/QUBO_dwave_first_try/ocean/lib/python3.10/site-packages/dwave_cloud_client-0.10.4-py3.10.egg/dwave/cloud/__init__.py", line 21, in <module>
from dwave.cloud.client import Client
File "/home/fire/py_projects/QUBO_dwave_first_try/ocean/lib/python3.10/site-packages/dwave_cloud_client-0.10.4-py3.10.egg/dwave/cloud/client/__init__.py", line 17, in <module>
from dwave.cloud.client.base import Client
File "/home/fire/py_projects/QUBO_dwave_first_try/ocean/lib/python3.10/site-packages/dwave_cloud_client-0.10.4-py3.10.egg/dwave/cloud/client/base.py", line 69, in <module>
from dwave.cloud import api
File "/home/fire/py_projects/QUBO_dwave_first_try/ocean/lib/python3.10/site-packages/dwave_cloud_client-0.10.4-py3.10.egg/dwave/cloud/api/__init__.py", line 21, in <module>
import dwave.cloud.api.models
File "/home/fire/py_projects/QUBO_dwave_first_try/ocean/lib/python3.10/site-packages/dwave_cloud_client-0.10.4-py3.10.egg/dwave/cloud/api/models.py", line 70, in <module>
class ProblemAnswer(BaseModel):
File "/home/fire/py_projects/QUBO_dwave_first_try/ocean/lib/python3.10/site-packages/pydantic-2.0a4-py3.10.egg/pydantic/main.py", line 96, in __new__
private_attributes = _model_construction.inspect_namespace(
File "/home/fire/py_projects/QUBO_dwave_first_try/ocean/lib/python3.10/site-packages/pydantic-2.0a4-py3.10.egg/pydantic/_internal/_model_construction.py", line 77, in inspect_namespace
raise TypeError(
TypeError: __root__ models are no longer supported in v2; a migration guide will be added in the near future
Something went wrong and I can't use dwave because of that?
How to solve that issue?
when I am trying to list all installed packages, I got next:
pip list
Package Version
------------------- ---------
annotated-types 0.5.0
blinker 1.6.2
certifi 2023.5.7
charset-normalizer 3.1.0
click 8.1.3
Deprecated 1.2.14
dimod 0.12.3
diskcache 5.6.1
dwave-cloud-client 0.10.4
dwave-greedy 0.3.0
dwave-hybrid 0.6.10
dwave-inspector 0.4.1
dwave-neal 0.6.0
dwave-networkx 0.8.13
dwave-ocean-sdk 6.3.0
dwave-preprocessing 0.5.4
dwave-samplers 1.0.0
dwave-system 1.18.0
dwave-tabu 0.5.0
dwavebinarycsp 0.2.0
fasteners 0.18
Flask 2.3.2
homebase 1.0.1
idna 3.4
itsdangerous 2.1.2
Jinja2 3.1.2
MarkupSafe 2.1.2
minorminer 0.2.11
networkx 2.8.8
numpy 1.25.0rc1
penaltymodel 1.0.2
pip 23.1.2
plucky 0.4.3
pydantic 2.0a4
pydantic_core 0.30.0
pyqubo 1.4.0
PySocks 1.7.1
python-dateutil 2.8.2
rectangle-packer 2.0.1
requests 2.31.0
scipy 1.11.0rc1
setuptools 67.7.2
six 1.16.0
typing_extensions 4.6.2
urllib3 2.0.2
Werkzeug 2.3.4
wheel 0.40.0
wrapt 1.15.0
I am working under Ubuntu, WSL
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
Comments
Oleksii,
Since the errors are related to pydantic-2.0a4, which is a pre-release version of pydantic-2.0, and its release was fairly recent (April 25, 2023), if it were me with this error, I would try switching to a version 1 release of pydantic. The requirements.txt file for the dwave-cloud-client only requires a version of pydantic >=1.7.3 .
Since you are in a virtual environment and using pip, it should be safe to try (NOTE: I do not work for D-Wave, so I don't have an official, tested answer). You may want to try something like:
pip install --upgrade pydantic==xxxx for a version 1 release.
Good luck.
Ed
Ed C you are right, I have tried to do this and it worked.
I mean I changed the pydantic version to appropriate.
now I need to solve first toy-problem - to show the "proof of concept" that we can use QC for our optimization problems. And really don't know how to start :)
I mean you have installed dwave-sdk - but anyway you need to use leap to try?
Is there a step by step guide for start?
My toy-problem explanation is here.
First, before I forget again, welcome to the Leap Discussion forum.
I'm glad you were able to get up and running.
This page is a good starting point for learning to code for the the D-Wave Quantum Annealer:
https://docs.ocean.dwavesys.com/en/stable/getting_started.html
You can run the examples from your local machine or if you want to try code out without needing to set it up locally, you can login into Leap and use a browser based environment through the IDE Workspaces option. I use this option to pull down examples from D-Wave's github example site to try out new ideas.
As you get more specific questions, you can ask them here in the forum.
Ed
Please sign in to leave a comment.