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

ImportError: dlopen(/Users/glennjocher/.cache/pre-commit/repofadve4nf/py_env-python3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so, 0x0002) #267

Closed
glenn-jocher opened this issue Oct 15, 2023 · 4 comments
Labels
S: feedback Open but need feedback from OP to proceed with solution

Comments

@glenn-jocher
Copy link

The issue seems related to a mismatch in the architecture of the compiled Python package and the architecture of your system. Your system is running on arm64, but the charset_normalizer package appears to have been compiled for x86_64.

fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
check for case conflicts.................................................Passed
check docstring is first.................................................Passed
fix double quoted strings................................................Passed
detect private key.......................................................Passed
Upgrade code.............................................................Passed
Sort imports.............................................................Passed
YAPF formatting..........................................................Passed
MD formatting........................................(no files to check)Skipped
PEP8.....................................................................Passed
codespell................................................................Passed
docformatter.............................................................Failed
- hook id: docformatter
- exit code: 1
Traceback (most recent call last):
  File "/Users/glennjocher/.cache/pre-commit/repofadve4nf/py_env-python3.11/bin/docformatter", line 5, in <module>
    from docformatter.__main__ import main
  File "/Users/glennjocher/.cache/pre-commit/repofadve4nf/py_env-python3.11/lib/python3.11/site-packages/docformatter/__init__.py", line 36, in <module>
    from .encode import Encoder  # isort: skip # noqa F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/glennjocher/.cache/pre-commit/repofadve4nf/py_env-python3.11/lib/python3.11/site-packages/docformatter/encode.py", line 33, in <module>
    from charset_normalizer import from_path  # pylint: disable=import-error
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/glennjocher/.cache/pre-commit/repofadve4nf/py_env-python3.11/lib/python3.11/site-packages/charset_normalizer/__init__.py", line 24, in <module>
    from .api import from_bytes, from_fp, from_path, is_binary
  File "/Users/glennjocher/.cache/pre-commit/repofadve4nf/py_env-python3.11/lib/python3.11/site-packages/charset_normalizer/api.py", line 5, in <module>
    from .cd import (
  File "/Users/glennjocher/.cache/pre-commit/repofadve4nf/py_env-python3.11/lib/python3.11/site-packages/charset_normalizer/cd.py", line 14, in <module>
    from .md import is_suspiciously_successive_range
ImportError: dlopen(/Users/glennjocher/.cache/pre-commit/repofadve4nf/py_env-python3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so, 0x0002): tried: '/Users/glennjocher/.cache/pre-commit/repofadve4nf/py_env-python3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/glennjocher/.cache/pre-commit/repofadve4nf/py_env-python3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so' (no such file), '/Users/glennjocher/.cache/pre-commit/repofadve4nf/py_env-python3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

Environment

Ultralytics YOLOv8.0.198 🚀 Python-3.11.2 torch-2.1.0 CPU (Apple M2)
Setup complete ✅ (8 CPUs, 16.0 GB RAM, 250.8/460.4 GB disk)

OS                  macOS-14.0-arm64-arm-64bit
Environment         Darwin
Python              3.11.2
Install             git
RAM                 16.00 GB
CPU                 Apple M2
CUDA                None

matplotlib          ✅ 3.8.0>=3.3.0
numpy               ✅ 1.26.1>=1.22.2
opencv-python       ✅ 4.8.1.78>=4.6.0
pillow              ✅ 10.0.1>=7.1.2
pyyaml              ✅ 6.0.1>=5.3.1
requests            ✅ 2.31.0>=2.23.0
scipy               ✅ 1.11.3>=1.4.1
torch               ✅ 2.1.0>=1.8.0
torchvision         ✅ 0.16.0>=0.9.0
tqdm                ✅ 4.66.1>=4.64.0
pandas              ✅ 2.1.1>=1.1.4
seaborn             ✅ 0.13.0>=0.11.0
psutil              ✅ 5.9.6
py-cpuinfo          ✅ 9.0.0
thop                ✅ 0.1.1-2209072238>=0.1.1

Reproduce

Clone the https://github.com/ultralytics/ultralytics repo in PyCharm, run pip install -e '.[dev]' and then run push to your branch using PyCharm, and the error will appear.

@github-actions github-actions bot added the fresh This is a new issue label Oct 15, 2023
@glenn-jocher glenn-jocher changed the title Docformatter failing on M2 macOS ImportError: dlopen(/Users/glennjocher/.cache/pre-commit/repofadve4nf/py_env-python3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so, 0x0002) Oct 15, 2023
@weibullguy
Copy link
Member

I can't reproduce the problem. This is likely any issue with your environment or pypi, but unlikely a docformatter issue.

@weibullguy weibullguy added S: feedback Open but need feedback from OP to proceed with solution and removed fresh This is a new issue labels Oct 15, 2023
@PaulWestenthanner
Copy link

I just ran into the same problem (I think).

I installed docformatter via pip into a conda environment using python 3.11 on an Ubuntu 20.4 LTS machine.

(orca_new) westentp@rpeuwprlc0013:~/projects/orca$ docformatter --help
Traceback (most recent call last):
  File "/home/users/westentp/anaconda3/envs/orca_new/bin/docformatter", line 5, in <module>
    from docformatter.__main__ import main
  File "/home/users/westentp/anaconda3/envs/orca_new/lib/python3.11/site-packages/docformatter/__init__.py", line 36, in <module>
    from .encode import Encoder  # isort: skip # noqa F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/users/westentp/anaconda3/envs/orca_new/lib/python3.11/site-packages/docformatter/encode.py", line 33, in <module>
    from charset_normalizer import from_path  # pylint: disable=import-error
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/users/westentp/anaconda3/envs/orca_new/lib/python3.11/site-packages/charset_normalizer/__init__.py", line 23, in <module>
    from charset_normalizer.api import from_fp, from_path, from_bytes, normalize
  File "/home/users/westentp/anaconda3/envs/orca_new/lib/python3.11/site-packages/charset_normalizer/api.py", line 10, in <module>
    from charset_normalizer.md import mess_ratio
  File "charset_normalizer/md.py", line 5, in <module>
ImportError: cannot import name 'COMMON_SAFE_ASCII_CHARACTERS' from 'charset_normalizer.constant' (/home/users/westentp/anaconda3/envs/orca_new/lib/python3.11/site-packages/charset_normalizer/constant.py)

@PaulWestenthanner
Copy link

Update:

conda install -c conda-forge charset-normalizer solved it for me as suggested here: https://stackoverflow.com/questions/74535380/importerror-cannot-import-name-common-safe-ascii-characters-from-charset-nor

@glenn-jocher
Copy link
Author

Closing as I'm not longer receiving this error.

@PyCQA PyCQA locked and limited conversation to collaborators Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S: feedback Open but need feedback from OP to proceed with solution
Projects
None yet
Development

No branches or pull requests

3 participants