deepdiff icon indicating copy to clipboard operation
deepdiff copied to clipboard

Unable to import numpy in deepdiff/distance.py

Open terry-chiu-certn opened this issue 1 year ago • 1 comments
trafficstars

Describe the bug This is a build issue where importing deepdiff.DeepDiff results in:

...
    from deepdiff import DeepDiff
venv/lib/python3.11/site-packages/deepdiff/__init__.py:10: in <module>
    from .diff import DeepDiff
venv/lib/python3.11/site-packages/deepdiff/diff.py:30: in <module>
    from deepdiff.distance import DistanceMixin, logarithmic_similarity
venv/lib/python3.11/site-packages/deepdiff/distance.py:1: in <module>
    import numpy as np
E   ModuleNotFoundError: No module named 'numpy'

To Reproduce

  1. Launch a Python3 interpreter in a virtual env that has deepdiff set up.
  2. Run from deepdiff import DeepDiff

Expected behavior Import should run successfully.

OS, DeepDiff version and Python version (please complete the following information):

  • OS: MacOS
  • Version Sonoma 14.5
  • Python Version 3.11.8
  • DeepDiff Version 8.0.0

Additional context The breaking change is most likely this PR. This issue does not exist in the v.7.0.1 release.

terry-chiu-certn avatar Aug 27 '24 22:08 terry-chiu-certn

same from azure cli diff tool

AllyW avatar Aug 28 '24 04:08 AllyW

Seeing this too, broke my test pipelines :)

jonaswerme avatar Aug 28 '24 13:08 jonaswerme

Thanks for reporting. Let me fix it.

seperman avatar Aug 28 '24 19:08 seperman

@jonaswerme @AllyW @terry-chiu-certn @mellon85 DeepDiff 8.0.1 is released with a bugfix. There was an extra import of Numpy that was causing this issue.

seperman avatar Aug 28 '24 20:08 seperman

@seperman thank you so much for the fix! v8.0.1 works like a charm 👍

terry-chiu-certn avatar Aug 28 '24 21:08 terry-chiu-certn

You are welcome!

seperman avatar Aug 28 '24 21:08 seperman