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

Numpy deprecated operations #29

Closed
klorophyl opened this issue Mar 7, 2018 · 3 comments
Closed

Numpy deprecated operations #29

klorophyl opened this issue Mar 7, 2018 · 3 comments

Comments

@klorophyl
Copy link

Awesome project. You should add your dependencies as numpy has deprecated some of your operators

@goncalopp
Copy link
Owner

Thanks Gabriel,
Would you mind providing a log of the numpy errors you're seeing?
I haven't used this project in a while, so I don't have a updated dependencies list I can dump, but I'll look into fixing the root issue

@RedFantom
Copy link
Contributor

@goncalopp I can reproduce the issues with numpy==1.14.0. The specific error traceback is:

Traceback (most recent call last):
  File "/home/.../Source/simple-ocr-opencv/tests/test_grounding.py", line 14, in setUp
    self.segments = ContourSegmenter().process(self.img.image)
  File "/home/.../Source/simple-ocr-opencv/simpleocr/processor.py", line 100, in process
    output = self._process(arguments)
  File "/home/.../Source/simple-ocr-opencv/simpleocr/processor.py", line 149, in _process
    arguments = p.process(arguments)
  File "/home/.../Source/simple-ocr-opencv/simpleocr/processor.py", line 100, in process
    output = self._process(arguments)
  File "/home/.../Source/simple-ocr-opencv/simpleocr/segmentation_filters.py", line 34, in _process
    good = self._good_segments(segments)
  File "/home/.../Source/simple-ocr-opencv/simpleocr/segmentation_filters.py", line 75, in _good_segments
    return (True - numpy.max(m, axis=1))
TypeError: numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead.

I went back a few versions of numpy, but the issue occurs in all of them. I think it might have been deprecated when they went to 1.0.0?

In any case, the issue can can be easily resolved by replacing the - in line 75 of simpleocr/segmentation_filters.py by a ^.

I pushed my fix to branch numpy. The issue occurs on my personal machine, Ubuntu 17.10 with Python 3.6 and Python 2.7.

@goncalopp
Copy link
Owner

Thanks for reproducing and fixiing this RedFantom! I've cherry-picked your fix :)
With the fix in there's no need to recommend specific dependency versions, everything should work with latest versions out-of-the-box

@goncalopp goncalopp changed the title Should add requirements.txt Numpy deprecated operations Mar 10, 2018
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

3 participants