简体   繁体   中英

Unable to Install mysqlclient on mac Pycharm Terminal

Below mentioned is the error: I am facing when trying to install mysqlclient using pycharm Terminal.

I want add one piece of information here that I am able to install using Mac's default terminal but not using pycharm terminal.

Tried many things to resolve this issue but fails. I will very happy if it gets sorted.

Below mentioned is the error: I am facing when trying to install mysqlclient using pycharm Terminal.

Collecting mysqlclient
  Using cached mysqlclient-2.0.3.tar.gz (88 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/naushadahmad/PycharmProjects/NaushadFinancialConsultant/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/rx/2k6304sj2k5dr7ggj0jwf95c0000gn/T/pip-install-6wl3pvv8/mysqlclient_3a94a7b3a3234499aef702b8eb109a44/setup.py'"'"'; __file__='"'"'/private/var/folders/rx/2k6304sj2k5dr7ggj0jwf95c0000gn/T/pip-install-6wl3pvv8/mysqlclient_3a94a7b3a3234499aef702b8eb109a44/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/rx/2k6304sj2k5dr7ggj0jwf95c0000gn/T/pip-wheel-wsaoy4xx
       cwd: /private/var/folders/rx/2k6304sj2k5dr7ggj0jwf95c0000gn/T/pip-install-6wl3pvv8/mysqlclient_3a94a7b3a3234499aef702b8eb109a44/
  Complete output (43 lines):
  mysql_config --version
  ['8.0.25']
  mysql_config --libs
  ['-L/opt/homebrew/Cellar/mysql-client/8.0.25/lib', '-lmysqlclient', '-lz', '-lzstd', '-lssl', '-lcrypto', '-lresolv']
  mysql_config --cflags
  ['-I/opt/homebrew/Cellar/mysql-client/8.0.25/include/mysql']
  ext_options:
    library_dirs: ['/opt/homebrew/Cellar/mysql-client/8.0.25/lib']
    libraries: ['mysqlclient', 'zstd', 'resolv']
    extra_compile_args: ['-std=c99']
    extra_link_args: []
    include_dirs: ['/opt/homebrew/Cellar/mysql-client/8.0.25/include/mysql']
    extra_objects: []
    define_macros: [('version_info', "(2,0,3,'final',0)"), ('__version__', '2.0.3')]
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.9
  creating build/lib.macosx-10.9-x86_64-3.9/MySQLdb
  copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
  copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
  copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
  copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
  copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
  copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
  copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
  creating build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
  running build_ext
  building 'MySQLdb._mysql' extension
  creating build/temp.macosx-10.9-x86_64-3.9
  creating build/temp.macosx-10.9-x86_64-3.9/MySQLdb
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -Dversion_info=(2,0,3,'final',0) -D__version__=2.0.3 -I/opt/homebrew/Cellar/mysql-client/8.0.25/include/mysql -I/Users/naushadahmad/PycharmProjects/NaushadFinancialConsultant/venv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-x86_64-3.9/MySQLdb/_mysql.o -std=c99
  gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.9/MySQLdb/_mysql.o -L/opt/homebrew/Cellar/mysql-client/8.0.25/lib -lmysqlclient -lzstd -lresolv -o build/lib.macosx-10.9-x86_64-3.9/MySQLdb/_mysql.cpython-39-darwin.so
  ld: library not found for -lzstd
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for mysqlclient
  Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
    Running setup.py install for mysqlclient ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/naushadahmad/PycharmProjects/NaushadFinancialConsultant/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/rx/2k6304sj2k5dr7ggj0jwf95c0000gn/T/pip-install-6wl3pvv8/mysqlclient_3a94a7b3a3234499aef702b8eb109a44/setup.py'"'"'; __file__='"'"'/private/var/folders/rx/2k6304sj2k5dr7ggj0jwf95c0000gn/T/pip-install-6wl3pvv8/mysqlclient_3a94a7b3a3234499aef702b8eb109a44/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/rx/2k6304sj2k5dr7ggj0jwf95c0000gn/T/pip-record-_j3flk52/install-record.txt --single-version-externally-managed --compile --install-headers /Users/naushadahmad/PycharmProjects/NaushadFinancialConsultant/venv/include/site/python3.9/mysqlclient
         cwd: /private/var/folders/rx/2k6304sj2k5dr7ggj0jwf95c0000gn/T/pip-install-6wl3pvv8/mysqlclient_3a94a7b3a3234499aef702b8eb109a44/
    Complete output (43 lines):
    mysql_config --version
    ['8.0.25']
    mysql_config --libs
    ['-L/opt/homebrew/Cellar/mysql-client/8.0.25/lib', '-lmysqlclient', '-lz', '-lzstd', '-lssl', '-lcrypto', '-lresolv']
    mysql_config --cflags
    ['-I/opt/homebrew/Cellar/mysql-client/8.0.25/include/mysql']
    ext_options:
      library_dirs: ['/opt/homebrew/Cellar/mysql-client/8.0.25/lib']
      libraries: ['mysqlclient', 'zstd', 'resolv']
      extra_compile_args: ['-std=c99']
      extra_link_args: []
      include_dirs: ['/opt/homebrew/Cellar/mysql-client/8.0.25/include/mysql']
      extra_objects: []
      define_macros: [('version_info', "(2,0,3,'final',0)"), ('__version__', '2.0.3')]
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.9
    creating build/lib.macosx-10.9-x86_64-3.9/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
    copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
    copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
    copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
    copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
    copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
    creating build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
    running build_ext
    building 'MySQLdb._mysql' extension
    creating build/temp.macosx-10.9-x86_64-3.9
    creating build/temp.macosx-10.9-x86_64-3.9/MySQLdb
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -Dversion_info=(2,0,3,'final',0) -D__version__=2.0.3 -I/opt/homebrew/Cellar/mysql-client/8.0.25/include/mysql -I/Users/naushadahmad/PycharmProjects/NaushadFinancialConsultant/venv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-x86_64-3.9/MySQLdb/_mysql.o -std=c99
    gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.9/MySQLdb/_mysql.o -L/opt/homebrew/Cellar/mysql-client/8.0.25/lib -lmysqlclient -lzstd -lresolv -o build/lib.macosx-10.9-x86_64-3.9/MySQLdb/_mysql.cpython-39-darwin.so
    ld: library not found for -lzstd
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/naushadahmad/PycharmProjects/NaushadFinancialConsultant/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/rx/2k6304sj2k5dr7ggj0jwf95c0000gn/T/pip-install-6wl3pvv8/mysqlclient_3a94a7b3a3234499aef702b8eb109a44/setup.py'"'"'; __file__='"'"'/private/var/folders/rx/2k6304sj2k5dr7ggj0jwf95c0000gn/T/pip-install-6wl3pvv8/mysqlclient_3a94a7b3a3234499aef702b8eb109a44/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/rx/2k6304sj2k5dr7ggj0jwf95c0000gn/T/pip-record-_j3flk52/install-record.txt --single-version-externally-managed --compile --install-headers /Users/naushadahmad/PycharmProjects/NaushadFinancialConsultant/venv/include/site/python3.9/mysqlclient Check the logs for full command output. ```

Error message showed that

ld: library not found for -lzstd

It is possible that zstd library is not installed which is one of the requirements for this compilation.

Try installing it from the terminal -

brew install zstd

And then try installing mysqlclient

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM