Open robooo opened 7 years ago
I'm experiencing this same issue:
Traceback (most recent call last):
File "/Users/brady/Desktop/LING 360/Final_Project/main.py", line 7, in
I'm on MacOSx Sierra, 10.12.1 with Anaconda experiencing the same issue.
@BradyHammond @robooo , I have a solution for all of us; On 11 Dec 2016, successfully installed polyglot on my Mac computer with Anaconda. My specs:
conda --version
in terminal to see your versionI made a Github Gist that automatically installs Polyglot on a Mac Computer running Anaconda. To run my gist just cut and paste this:
wget https://gist.githubusercontent.com/linwoodc3/8704bbf6d1c6130dda02bbc28967a9e6/raw/91d8e579c0fa66399ab1959c9aa94ea09c3eb539/polyglotOnMacOSX.sh -O polyglotOnMacOSX.sh && bash polyglotOnMacOSX.sh
I will also list the exact steps, but first, here are some important notes:
pyicu
merge request easy_install pyicu
and not pip install pyicu
pip install pyicu
always leads to Library not loaded...
error conda install -c ccordoba12 icu=54.1
icu 54.1.1
and not icu 58.1
or icu 54.1.0
. Just using conda install icu
will not work!! brew install icu4c
uses version 58.1
Library not loaded: libicui18n.54.dylib
Again, you can use my Github Gist to automatically test this on your machine. If you want to manually try the steps, they are
Fresh install of anaconda :
* rm -rf anaconda # removes existing Anaconda install
Command Line Installer for Python 3 OS X downloaded on 11 Dec 2016 from: https://repo.continuum.io/archive/Anaconda3-4.2.0-MacOSX-x86_64.sh
Now the steps after Anaconda is installed:
Or, you can use my gist to automatically test the install:
wget https://gist.githubusercontent.com/linwoodc3/8704bbf6d1c6130dda02bbc28967a9e6/raw/91d8e579c0fa66399ab1959c9aa94ea09c3eb539/polyglotOnMacOSX.sh -O polyglotOnMacOSX.sh && bash polyglotOnMacOSX.sh
looks good I could test on my mac (using yosemite) tomorrow. But what about 6th step? did you mean 'easy_install right'? without '!'?
Sorry for the confusion @robooo.
First, I think you could try this on your Yosemite comp; should work.
Step 6 is an artifact of running shell commands in ipython
. If you follow my steps above, step 5 will put you in the interactive ipython interpreter. Then, to run commands, you need to add the !
in front. Here's why:
You can access shell commands in ipython by just appending an !
to the command, as stated in the documentation. I should have made that more clear. But, just for future's sake, if you have ipython running, you can run normal terminal commands in this way:
!ls # will run the normal ls command in the ipython interpreter.
Woooooohooooooo!!!!!!!!!!!!! Just got polyglot working in Python 2.7.12 locally. I'll made a gist for this as well, but it will require pyicu
to accept a merge request (once I make one) and the original author of polyglot to maybe do something with an underlying dependency(https://github.com/aboSamoor/pycld2) for pip install
to work.
Challenge is now figuring out how to get this up for everyone to use. I'm writing my notes here so I don't forget what I did:
git clone git@github.com:linwoodc3/pyicu.git
cd pyicu
setup.cfg
filepython setup.py bdist_wheel --universal
from the pyicu
repositorypyicu
repository cd dist/
pip install PyICU-1.9.5-cp27-cp27m-macosx_10_6_x86_64.whl
git clone http://github.com/abosamoor/pycld2.git
cd pycld2/
./setup.py install
Referenced from: /Applications/anaconda/lib/python3.6/site-packages/_icu.cpython-36m-darwin.so Reason: image not found
@linwoodc3 I used your gist but still get that error message, you said Python 3.5, so I have Python 3.6, don't think that would influence that. Can you help me please, really need polyglot for uni.
@AAyse I'll give it a try.
I got it to work @AAyse . Remember, this is for a Mac. The main change is you need to change the version from 3.5 to 3.6 in my script.
sh
file.
wget https://gist.githubusercontent.com/linwoodc3/8704bbf6d1c6130dda02bbc28967a9e6/raw/786fc5074c811b3ec359135f2ce8d92d8413b33a/polyglotOnMacOSX35.sh
Now open and edit the sh
file on line 18 . You can open the file with Text Edit or anything.
conda create -n icutestenv python=3.6 --no-deps -y &&
Now just run the script, and it should work (I got it working on my machine)
bash polyglotOnMacOSX35.sh
When the script finishes, make sure to select no
to keep the environment
Now, just source into the new environment source icutestenv
Here's proof this is working on Python 3.6.
@linwoodc3 Thank you very much. It works for me also now. Great help. Xx
I tried to get things running on a Mac with:
brew install icu4c
brew link icu4c --force
with no joy, but then trying:
pip3 install pyicu
pip3 install pycld2
pip3 install morfessor
seemed to work. (I'm not sure if the brew
step was required?)
@linwoodc3 thanks for the answer, but by following step by step your protocol, I got this error:
from polyglot.text import Text, Word
Traceback (most recent call last):
File "
I'm working with 3.6.4 |Anaconda custom (64-bit). Any ideas on what's going on?
OK. Actually pip3 install PyICU solved all my issues
@audreyqvial did you try this https://github.com/aboSamoor/polyglot/issues/80#issuecomment-321953257
If you are still struggling to install, this is a solution worth trying.
Anaconda makes this easy! Install Anaconda for your system, and then run this single line to have polyglot
working on your system (python 3 or python 2 on Mac):
conda install -c conda-forge pyicu morfessor icu -y && pip install pycld2 polyglot
You must add the -c conda forge
command as pyicu
is only in that channel. If you do not want to install Anaconda, good luck. Life will be much harder or you will need to use that bash script I posted up above which may or may not work with tweaking.
>>> import icu
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/andi/Projects/vs/bookingstreet/vs-django-cms/bs/lib/python2.7/site-packages/icu/__init__.py", line 42, in <module>
from docs import *
File "/Users/andi/Projects/vs/bookingstreet/vs-django-cms/bs/lib/python2.7/site-packages/icu/docs.py", line 23, in <module>
from _icu import *
ImportError: dlopen(/Users/andi/Projects/vs/bookingstreet/vs-django-cms/bs/lib/python2.7/site-packages/_icu.so, 2): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.59.dylib
Referenced from: /Users/andi/Projects/vs/bookingstreet/vs-django-cms/bs/lib/python2.7/site-packages/_icu.so
Reason: image not found
I ended up here because have my homebrew linked wrong version of pyciu4c
so I link specific installed version by brew switch
command e.g I have icu4c
both in version 59.1
and 62.1
and want use as major older one so I
brew switch icu4c 59.1
For me, the error "Library not loaded: libicui18n.54.dylib" was saying that it was expecting a previous version of icu4c, only for my it was version 60, and not 54. I finally found success getting polyglot to work by installing a previous version of icu4u -- nothing else seemed to work.
This tutorial was very useful for me:
http://hanxue-it.blogspot.com/2018/08/macos-homebrew-installing-older-version-of-software.html
The steps I followed are taken from this tutorial:
$ cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
I had to get a fuller history to find commits further back with this command:
git log -m -oneline -full-history --follow icu4c.rb
With the results, I found the exact commit that I needed for version 60.2 for the next command (in the blank space).
git checkout -b icu4c-60.2_______________
From there:
brew reinstall ./icu4c.rb
brew switch icu4c 60.2
This got it to work for me. I also found this stackoverflow discussion to be helpful: https://stackoverflow.com/questions/43780207/installing-node-with-brew-fails-on-mac-os-sierra/43784397
I tried to use
from polyglot.text import Text
in my source code and end with thisI installed before
brew install icu4c
then
pip install polyglot
tried tooCFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib pip install polyglot
I tried remove anaconda too but then I get:
but icu4c is installed
after installing pyicu
Could you help me somehow? I need polyglot.text for my project but can't import it on mac