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
import dimod
fails on Python 3.7.10 with dimod 0.10.0
#901
Comments
import dimod
fails on Python 3.7 with dimod 0.10.0import dimod
fails on Python 3.7.10 with dimod 0.10.0
Hi @j-i-k-o, thanks for bringing this up. What version of numpy are you using? If it’s 1.21, I believe the error is coming directly from numpy: see numpy/numpy#19310. This problem should be fixed by 1.21.1 (see numpy/numpy#19311). As a temporary fix, you could try downgrading your numpy (should work with 1.20), or try a python >= 3.8. Hope this helps! |
HI @hhtong, thanks for the comment! ❯ python -m pip show numpy
Name: numpy
Version: 1.21.0
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: /home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages
Requires:
Required-by: dimod Yes, The version of numpy is 1.21.0. |
I upgraded numpy and dimod to 1.21.1 and 0.10.2, respectively, which still has a similar error. ❯ python --version
Python 3.7.10
~
❯ python -m pip show dimod
Name: dimod
Version: 0.10.2
Summary: A shared API for binary quadratic model samplers.
Home-page: https://github.com/dwavesystems/dimod
Author: D-Wave Systems Inc.
Author-email: tools@dwavesys.com
License: Apache 2.0
Location: /home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages
Requires: numpy
Required-by:
~
❯ python -m pip show numpy
Name: numpy
Version: 1.21.1
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: /home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages
Requires:
Required-by: dimod
~
❯ python
Python 3.7.10 (default, Jul 16 2021, 19:59:05)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dimod
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages/dimod/__init__.py", line 18, in <module>
from dimod.bqm import *
File "/home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages/dimod/bqm/__init__.py", line 15, in <module>
from dimod.bqm.adjvectorbqm import AdjVectorBQM
File "dimod/bqm/adjvectorbqm.pyx", line 38, in init dimod.bqm.adjvectorbqm
File "/home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages/dimod/core/__init__.py", line 15, in <module>
from dimod.core.composite import Composite, ComposedSampler
File "/home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages/dimod/core/composite.py", line 67, in <module>
from dimod.core.sampler import Sampler
File "/home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages/dimod/core/sampler.py", line 110, in <module>
from dimod.binary_quadratic_model import BinaryQuadraticModel
File "/home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages/dimod/binary_quadratic_model.py", line 17, in <module>
from dimod.binary.binary_quadratic_model import BinaryQuadraticModel, BQM
File "/home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages/dimod/binary/__init__.py", line 15, in <module>
from dimod.binary.binary_quadratic_model import *
File "/home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages/dimod/binary/binary_quadratic_model.py", line 30, in <module>
from numpy.typing import ArrayLike, DTypeLike
File "/home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages/numpy/typing/__init__.py", line 316, in <module>
from ._dtype_like import (
File "/home/jiko/.pyenv/versions/3.7.10/lib/python3.7/site-packages/numpy/typing/_dtype_like.py", line 95, in <module>
class _SupportsDType(Generic[_DType_co]):
NameError: name '_DType_co' is not defined
>>> I suppose the current quick solution is to install ❯ python -m pip install typing_extensions
Collecting typing_extensions
Using cached typing_extensions-3.10.0.0-py3-none-any.whl (26 kB)
Installing collected packages: typing-extensions
Successfully installed typing-extensions-3.10.0.0
WARNING: You are using pip version 20.1.1; however, version 21.1.3 is available.
You should consider upgrading via the '/home/jiko/.pyenv/versions/3.7.10/bin/python -m pip install --upgrade pip' command.
❯ python
Python 3.7.10 (default, Jul 16 2021, 19:59:05)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dimod
>>>
|
I've opened an issue on numpy here: numpy/numpy#19521 |
Closing since NumPy 1.21.2+ is now deployed. |
Description
import dimod
on Python 3.7.10 causes aTypeError
exception.Steps To Reproduce
dimod-0.10.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
)import dimod
Expected Behavior
Environment
The text was updated successfully, but these errors were encountered: