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

AttributeError: 'numpy.random._generator.Generator' object has no attribute 'rand' #10

Open
SuhasSrinivasan opened this issue May 29, 2022 · 1 comment

Comments

@SuhasSrinivasan
Copy link

This issue occurred when running python run_framework.py -f numpy -p L

OS: Ubuntu 20.04.4 LTS
Python: 3.7.13
numpy: 1.19.5

***** Testing NumPy with spmv on the L dataset *****
Process Process-46:
Traceback (most recent call last):
  File "/opt/miniconda3/envs/chrombpnet/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/opt/miniconda3/envs/chrombpnet/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "run_framework.py", line 18, in run_benchmark
    test.run(preset, validate, repeat, timeout)
  File "/root/npbench/npbench/infrastructure/test.py", line 66, in run
    bdata = self.bench.get_data(preset)
  File "/root/npbench/npbench/infrastructure/benchmark.py", line 68, in get_data
    exec(init_str, data)
  File "<string>", line 1, in <module>
  File "/root/npbench/npbench/benchmarks/spmv/spmv.py", line 19, in initialize
    random_state=rng)
  File "/opt/miniconda3/envs/chrombpnet/lib/python3.7/site-packages/scipy/sparse/construct.py", line 786, in random
    data_rvs = random_state.rand
AttributeError: 'numpy.random._generator.Generator' object has no attribute 'rand'
@tbennun
Copy link
Collaborator

tbennun commented Jun 6, 2022

@SuhasSrinivasan thank you for reporting. The issue is caused by a mismatch between the scipy version and numpy version. I was able to reproduce the issue when using scipy 1.3 with numpy 1.19.5. The issue does not occur with scipy 1.7.3, and can be resolved by running pip install --upgrade scipy.

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