urschrei / simplification

Very fast Python line simplification using either the RDP or Visvalingam-Whyatt algorithm implemented in Rust
Other
168 stars 18 forks source link

Simplification module for Apple silicone models (ARM) #17

Closed nka77 closed 2 years ago

nka77 commented 2 years ago

Please release module which is compatible to run with Apple M1 models. Or could you please guide how to build it from source code?

urschrei commented 2 years ago

Simplification 0.5.17 has been released to PyPI with support for Apple Silicon. Please try it!

gopalcb commented 2 years ago

@urschrei Thank you for the release with support for ARM M1. I have tried recently Simplification 0.5.19 & 0.5.17. I can install it on M1, but when I try to import (from simplification.cutil import simplify_coords), I get the following ImportError:

ImportError: dlopen(/Users/mac-user/miniconda3/envs/pd/lib/python3.9/site-packages/simplification/cutil.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_drop_float_array'

akash-y commented 2 years ago

@urschrei Thank you for the release with support for ARM M1. I have tried recently Simplification 0.5.19 & 0.5.17. I can install it on M1, but when I try to import (from simplification.cutil import simplify_coords), I get the following ImportError:

_ImportError: dlopen(/Users/mac-user/miniconda3/envs/pd/lib/python3.9/site-packages/simplification/cutil.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_drop_float_array'_

I have the same issue while importing on M1. Works fine when I have to import using anaconda but get that error in a miniforge environment

urschrei commented 2 years ago

I unfortunately don't use anaconda (and I don't know what miniforge is), so I don't know how they interact with PyPI or what kind of environments they provide, so you'll probably have to debug this yourself for the foreseeable future.

gopalcb commented 2 years ago

@akash-y Did you install simplification with conda command (conda install simplification)? I got the following error with the conda command:


PackagesNotFoundError: The following packages are not available from current channels:
  - simplification
Current channels:
  - https://repo.anaconda.com/pkgs/main/osx-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-64
  - https://repo.anaconda.com/pkgs/r/noarch
akash-y commented 2 years ago

I installed it using pip actually. Although I am not entirely sure about whats happening, I am guessing this has to do with interference between miniforge/conda and pip. I tried reinstalling in the environment that was able to import successfully but ended up getting the same error on import. Having this problem right after I installed miniforge and tensorflow on the mac M1

urschrei commented 2 years ago

Hi @nka77 @akash-y @gopalcb 0.5.22 has just been released, which I hope works correctly on M1: https://pypi.org/project/simplification/0.5.22

Please try it and let me know.

JYOuyang commented 2 years ago

@urschrei 0.5.22 working fine for me (using pip):

(toyenv) james@cross toy % pip list | grep simplif
simplification     0.5.22
(toyenv) james@cross toy % uname -a
Darwin cross.local 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T8101 arm64
(toyenv) james@cross toy % python
Python 3.8.9 (default, Oct 26 2021, 07:25:53) 
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from simplification.cutil import simplify_coords
>>> coords = [
...     [0.0, 0.0],
...     [5.0, 4.0],
...     [11.0, 5.5],
...     [17.3, 3.2],
...     [27.8, 0.1]
... ]
>>> simplified = simplify_coords(coords, 1.0)
>>> simplified
[[0.0, 0.0], [5.0, 4.0], [11.0, 5.5], [27.8, 0.1]]
>>> 

Thanks!