Error installing pip pyicu

后端 未结 8 1918
独厮守ぢ
独厮守ぢ 2020-12-24 13:51

I have been trying to install musicbrainz server on my mac and there is a step where I have to install pip pyicu. I keep getting this error:

Collecting pyicu         


        
相关标签:
8条回答
  • 2020-12-24 14:26

    It seems like the current version of icu4c packaged for brew does not link the icu-config file properly.

    Running brew link icu4c --force gives you the necessary information to address this, but fails to link it automatically.

    $ brew link --force icu4c
    Warning: Refusing to link macOS-provided software: icu4c
    If you need to have icu4c first in your PATH run:
      echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
      echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile
    
    For compilers to find icu4c you may need to set:
      export LDFLAGS="-L/usr/local/opt/icu4c/lib"
      export CPPFLAGS="-I/usr/local/opt/icu4c/include"
    
    For pkg-config to find icu4c you may need to set:
      export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"
    

    You need to run the following after installing icu4c through brew to get icu-config into your path (assuming you're running bash as your shell):

    echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
    echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
    source ~/.bash_profile
    

    After that, you should be able to install pyicu without any additional environment variables:

    $ pip install --no-cache-dir pyicu
    Collecting pyicu
      Downloading https://files.pythonhosted.org/packages/c2/15/0af20b540c828943b6ffea5677c86e908dcac108813b522adebb75c827c1/PyICU-2.2.tar.gz (211kB)
        100% |████████████████████████████████| 215kB 4.9MB/s 
    Installing collected packages: pyicu
      Running setup.py install for pyicu ... done
    Successfully installed pyicu-2.2
    

    In summary, here's a complete list of commands i ran to make this work:

    brew install icu4c
    brew link icu4c --force
    echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
    echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
    source ~/.bash_profile
    pip install --no-cache-dir pyicu
    

    (As an aside, many of the solutions i came across do not use the --no-cache-dir option with pip install. I think some of them may have cached built version of pyicu. I did for a while, which masked the issue. It wasn't until i tried this option that i was able to reproduce and fix appropriately.)

    0 讨论(0)
  • 2020-12-24 14:28

    On macOS 10.14.2 simply adding the directory containing icu-config to the PATH did the trick for me:

    brew install icu4c
    export PATH="/usr/local/opt/icu4c/bin:$PATH"
    pip install pyicu
    

    In fact, this is suggested by brew info icu4c:

    ==> Caveats
    icu4c is keg-only, which means it was not symlinked into /usr/local,
    because macOS provides libicucore.dylib (but nothing else).
    
    If you need to have icu4c first in your PATH run:
      echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
      echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
    
    For compilers to find icu4c you may need to set:
      export LDFLAGS="-L/usr/local/opt/icu4c/lib"
      export CPPFLAGS="-I/usr/local/opt/icu4c/include"
    
    For pkg-config to find icu4c you may need to set:
      export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"
    
    0 讨论(0)
  • 2020-12-24 14:29

    for me to get it works:

    1) install icu4c with brew:

    brew install icu4c
    brew link icu4c --force
    

    2) check the version:

    ls /usr/local/Cellar/icu4c/
    

    it prompts something like: 64.2

    3) execute bellow commands with substitution of proper version from previous step (first line only integer part, second and third line with decimal part):

    export ICU_VERSION=64
    export PYICU_INCLUDES=/usr/local/Cellar/icu4c/64.2/include
    export PYICU_LFLAGS=-L/usr/local/Cellar/icu4c/64.2/lib
    

    4) finally install python package for pyicu:

    pip install pyicu --upgrade
    

    IF YOU FAIL with above (happen already to me on OS X 10.15) you may need:

    brew install pkg-config
    
    export PYICU_CFLAGS=-std=c++11:-DPYICU_VER='"2.3.1"'
    
    0 讨论(0)
  • 2020-12-24 14:39

    I faced this issue on ubuntu 14.04 and 16.04. To fix this issue, install libicu-dev then try installing again. I did

    $sudo apt install libicu-dev
    $pip install pyicu
    
    0 讨论(0)
  • 2020-12-24 14:41

    Following solution worked for me on OSX:

    # Install ucu4c via Brew
    brew install icu4c
    
    # Create relative symlinks for icu4c
    brew link --force icu4c
    
    # Install pyicu via pip
    # Make sure ICU_VERSION matches the one you just installed
    sudo ICU_VERSION=60.2 pip install pyicu
    
    0 讨论(0)
  • 2020-12-24 14:46

    Below solution is for MAC OSX only-

    try installing pyICU using brew:

    brew install icu4c
    

    if it says that it's already installed and just need to be linked, then try this:

    brew link icu4c
    

    This create relative symlinks in "/usr/local/Cellar/icu4c/..."

    0 讨论(0)
提交回复
热议问题