Home > Net >  Import ERROR matplotlib in jupyter notebook on VSCODE
Import ERROR matplotlib in jupyter notebook on VSCODE

Time:01-11

I am very new to python and on stackoverflow, so please be indulgent with my questions. I had successfully installed matplotlib with the command pip install matplotlib without any errors and I tried to import it with the command:

import matplotlib

here is the text code error

and I also see this msg:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so, 2): Library not loaded: @loader_path/libXdmcp.6.dylib
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/.dylibs/libxcb.1.1.0.dylib
  Reason: no suitable image found.  Did find:
    /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/.dylibs/libXdmcp.6.dylib: cannot load 'libXdmcp.6.dylib' (load command 0x80000034 is unknown)
    /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/.dylibs/libXdmcp.6.dylib: cannot load 'libXdmcp.6.dylib' (load command 0x80000034 is unknown)

I expected to have no issues

For information : i am on macOS 10.14.6 (Mojave)

CodePudding user response:

cannot load 'libXdmcp.6.dylib' (load command 0x80000034 is unknown)

According to this case in github. This is an issue about pillow instead of matplotlib.

You can use the following way to install Pillow:

  1. download .zip file and extract it.
  2. use command cd path\you\download\file
  3. uninstall the current Pillow with python3 -m pip uninstall Pillow or python -m pip uninstall Pillow
  4. install from this new wheel with python3 -m pip install Pillow-9.4.0-1-cp310-cp310-macosx_10_10_x86_64.whl

You can also install .whl file directly then use command python3 -m pip install Pillow-9.4.0-1-cp310-cp310-macosx_10_10_x86_64.whl to install it.

  • Related