amueller / word_cloud

A little word cloud generator in Python
https://amueller.github.io/word_cloud
MIT License
10.19k stars 2.32k forks source link

Wordcloud from .query_integral_image import query_integral_image error on Mac M1 chip #712

Closed rebecca-foreflight closed 1 year ago

rebecca-foreflight commented 1 year ago

Description

Generate Wordcloud in the Browser

Steps/Code to Reproduce

I'm launching a web app, so I run ./setup (which is just a bash script installing all dependencies) and python manage.py runserver to launch the app.

Expected Results

No error pip installing or importing wordcloud

My packages for virtual environment show wordcloud==1.8.1, but when I try to import in python/ipython console I get the following error...

$ python

>>> import wordcloud

(marketing_py3) 
rebecca@AUS-RIF-MBPM1:
$ python
Python 3.9.7 (default, Apr 20 2022, 13:45:00) 
[Clang 13.1.6 (clang-1316.0.21.2.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wordcloud
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/rebecca/venv/marketing_py3/lib/python3.9/site-packages/wordcloud/__init__.py", line 1, in <module>
    from .wordcloud import (WordCloud, STOPWORDS, random_color_func,
  File "/Users/rebecca/venv/marketing_py3/lib/python3.9/site-packages/wordcloud/wordcloud.py", line 30, in <module>
    from .query_integral_image import query_integral_image
ImportError: dlopen(/Users/rebecca/venv/marketing_py3/lib/python3.9/site-packages/wordcloud/query_integral_image.cpython-39-darwin.so, 0x0002): tried: '/Users/rebecca/venv/marketing_py3/lib/python3.9/site-packages/wordcloud/query_integral_image.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/query_integral_image.cpython-39-darwin.so' (no such file), '/usr/lib/query_integral_image.cpython-39-darwin.so' (no such file)
image
(marketing_py3) 
rebecca@AUS-RIF-MBPM1:
$ pip freeze
analytics-python==1.4.0
appnope==0.1.3
asgiref==3.6.0
asttokens==2.2.1
backcall==0.2.0
backoff==1.10.0
beautifulsoup4==4.11.1
boto==2.49.0
boto3==1.24.45
boto3-stubs==1.24.44
botocore==1.27.45
botocore-stubs==1.27.45
certifi==2022.12.7
charset-normalizer==2.1.1
click==8.1.3
contourpy==1.0.7
cssselect2==0.7.0
cycler==0.11.0
decorator==5.1.1
Django==3.2.15
django-classy-tags==3.0.1
django-cms==3.11.0
django-codemod==1.11.4
django-debug-toolbar==3.0
django-filer==2.2.2
django-formtools==2.3
django-js-asset==2.0.0
django-mptt==0.13.4
django-polymorphic==3.1.0
django-reversion==5.0.1
django-sekizai==3.0.1
django-sendgrid-v5==1.2.1
django-storages==1.12.3
django-stubs==1.8.0
django-stubs-ext==0.2.0
django-treebeard==4.4
djangocms-admin-style==3.2.0
djangocms-attributes-field==2.1.0
djangocms-file==3.0.0
djangocms-link==3.0.0
djangocms-picture==4.0.0
djangocms-style==3.0.0
djangocms-text-ckeditor==5.1.1
djangocms-video==3.0.0
easy-thumbnails==2.8.2
et-xmlfile==1.1.0
executing==1.2.0
fonttools==4.38.0
future==0.18.3
gunicorn==20.1.0
html5lib==1.1
idna==3.4
importlib-resources==5.12.0
ipython==8.11.0
iso8601==1.0.2
isort==4.3.21
jedi==0.18.2
Jinja2==3.1.2
jmespath==1.0.1
joblib==1.2.0
kiwisolver==1.4.4
libcst==0.4.9
lxml==4.9.2
markdown-it-py==2.2.0
MarkupSafe==2.1.2
matplotlib==3.5.3
matplotlib-inline==0.1.6
mdurl==0.1.2
monotonic==1.6
mypy==0.910
mypy-extensions==0.4.4
nltk==3.8.1
numpy==1.21.6
openpyxl==3.0.9
packaging==23.0
pandas==1.5.3
parso==0.8.3
pathspec==0.11.0
pexpect==4.8.0
pickleshare==0.7.5
Pillow==9.2.0
prompt-toolkit==3.0.38
psycopg2==2.9.3
psycopg2-binary==2.9.3
ptyprocess==0.7.0
pure-eval==0.2.2
Pygments==2.14.0
pyparsing==3.0.9
pyspellchecker==0.6.3
python-dateutil==2.8.2
python-gnupg==0.5.0
python-http-client==3.3.7
pytz==2022.7.1
PyYAML==6.0
regex==2022.10.31
render==1.0.0
reportlab==3.6.11
requests==2.28.1
rich==13.3.1
rich-click==1.6.1
s3transfer==0.6.0
scikit-learn==1.2.1
scipy==1.10.1
sendgrid==6.9.7
six==1.16.0
soupsieve==2.4
sphinx-me==0.3
sqlparse==0.4.3
stack-data==0.6.2
starkbank-ecdsa==2.2.0
svglib==1.3.0
threadpoolctl==3.1.0
tinycss2==1.2.1
toml==0.10.2
tqdm==4.64.1
traitlets==5.9.0
types-awscrt==0.16.10
types-s3transfer==0.6.0.post5
typing-inspect==0.8.0
typing_extensions==4.5.0
Unidecode==1.1.2
urllib3==1.26.11
watchtower==3.0.0
wcwidth==0.2.6
webencodings==0.5.1
Whoosh==2.7.4
wordcloud==1.8.1
zipp==3.15.0

Actual Results

File "/Users/rebecca/apps/wordcloud/urls.py", line 3, in <module>
    from .views import DashboardView
  File "/Users/rebecca/apps/wordcloud/views.py", line 6, in <module>
    from .utils import WordCloudCreator
  File "/Users/rebecca/apps/wordcloud/utils.py", line 14, in <module>
    from wordcloud import WordCloud
  File "/Users/rebecca/venv/marketing_py3/lib/python3.9/site-packages/wordcloud/__init__.py", line 1, in <module>
    from .wordcloud import (WordCloud, STOPWORDS, random_color_func,
  File "/Users/rebecca/venv/marketing_py3/lib/python3.9/site-packages/wordcloud/wordcloud.py", line 30, in <module>
    from .query_integral_image import query_integral_image
ImportError: dlopen(/Users/rebecca/venv/marketing_py3/lib/python3.9/site-packages/wordcloud/query_integral_image.cpython-39-darwin.so, 0x0002): tried: '/Users/rebecca/venv/marketing_py3/lib/python3.9/site-packages/wordcloud/query_integral_image.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/query_integral_image.cpython-39-darwin.so' (no such file), '/usr/lib/query_integral_image.cpython-39-darwin.so' (no such file) 

Versions

>>> print("NumPy", numpy.__version__) NumPy 1.21.6 >>> print("matplotlib", matplotlib.__version__) matplotlib 3.5.3 $ arch i386 (Mac M1) $ which python /Users/rebecca/venv/marketing_py3/bin/python $ python --version Python 3.9.7 $ sw_vers
ProductName: macOS Monterrey ProductVersion: 12.2.1 BuildVersion: 21D62 Which IDE IntelliJ Framework Django

What I've tried

'/usr/lib/query_integral_image.cpython-39-darwin.so' (no such file)

^^^This file does exist.

$ pip uninstall lxml and ARCHFLAGS="-arch arm64" pip install lxml --compile --no-cache-dir. and $ pip uninstall lxml and $ pip install --no-binary lxml lxml according to this stackoverflow: https://apple.stackexchange.com/questions/436801/m1-mac-mach-o-file-but-is-an-incompatible-architecture-have-x86-64-need-a

amueller commented 1 year ago

please install word-cloud using "pip install wordcloud". It looks like you haven't run the installation?

amueller commented 1 year ago

closing as no reply. feel free to reopen with more details about how you installed.