imgaug icon indicating copy to clipboard operation
imgaug copied to clipboard

AttributeError: module 'numpy.random' has no attribute 'bit_generator'

Open cqray1990 opened this issue 4 years ago • 9 comments

the imgaug raise AttributeError: module 'numpy.random' has no attribute 'bit_generator' ? i don't know what errors is? can you help me,thank you

cqray1990 avatar Dec 25 '19 08:12 cqray1990

That's an error introduced by numpy 1.18 that was released two days ago. They moved an interface to a different location without deprecating the old name. The problem is already fixed in master, so just install directly from github (or use numpy 1.17 for now).

aleju avatar Dec 25 '19 09:12 aleju

@aleju Hi,I also meet this problem,and I installed imgaug from github directly, just as the follow git clone https://github.com/aleju/imgaug cd imgaug && python setup.py install However,the problem is still occured.

FanShuixing avatar Dec 30 '19 12:12 FanShuixing

Put these lines at the top of your file:

import numpy
numpy.random.bit_generator = numpy.random._bit_generator

chitholian avatar Dec 31 '19 07:12 chitholian

@aleju Hi,I also meet this problem,and I installed imgaug from github directly, just as the follow git clone https://github.com/aleju/imgaug cd imgaug && python setup.py install However,the problem is still occured.

Sounds to me like it is using for some reason an older version of the library and not actually the one from master. You could also try import imgaug.augmenters as iaa; print(iaa.Cartoon()). That augmenter doesn't exist yet in the last pypi release, so you will probably get an error for that command too.

Try pip uninstall imgaug; pip install git+https://github.com/aleju/imgaug -- if you initially installed via pip and not conda. If you installed via conda you first have to run conda remove imgaug. Also make sure that there is no folder imgaug in your current working directory that might be unintentionally imported. You can try running your script after uninstall to make sure that you get an import error for imgaug, i.e. that it is really uninstalled.

aleju avatar Dec 31 '19 09:12 aleju

Thank you @chitholian your method works on my code. I recommend it.

Violet-XiaoWeiHuang avatar Jan 10 '20 03:01 Violet-XiaoWeiHuang

AttributeError: 'numpy.random._generator.Generator' object has no attribute 'uniformInt' I am getting this error

shaikfat avatar Dec 01 '20 17:12 shaikfat

PLEASE how do i resolve this 'AttributeError: module 'numpy.random' has no attribute '_bit_generator' ?

promiseve avatar Oct 14 '21 08:10 promiseve

I solved it by doing

import numpy
numpy.random.BitGenerator = numpy.random.bit_generator.BitGenerator

towardsautonomy avatar Mar 11 '22 00:03 towardsautonomy

sudo pip3 --update numpy

JianerCong avatar Mar 13 '22 20:03 JianerCong