"Unable to load library icui18n" & "cannot connect to X server": what do I have to do?

10,568 views
Skip to first unread message

Marco Ippolito

unread,
Sep 2, 2013, 4:10:35 AM9/2/13
to phan...@googlegroups.com
Hi all,

I describe what I did in order to ask you what I'm missing and what I have to do.

In my T1 micro Ubuntu AWS (Amazon) micro istance I created a directory "scrape".
In "scrape" I git cloned pjscrape, thus creating a directory "pjscrape".
In pjscrape I created a my_config.js follogin the instructions in http://nrabinowitz.github.io/pjscrape/#quickstart .
In "pjscrape", following the instructions in http://phantomjs.org/download.html, I downloaded the biz2 file of the binary code of phantomjs. Decompressing that file a directory "phantomjs-1.9.1-linux-x86_64" was created in "pjscrape".

Since phantomjs is in scrape/pjscrape/phantomjs-1.9.1-linux-x86_64/bin, in order to have phantomjs, pjscrape.js and my_config.js in the same directory, I sym-linked phantomjs in "scrape/pjscrape":
ubuntu@ip-10-164-57-85:~/scrape/pjscrape]$ls -a
.     .gitignore   VERSION.txt  lib           phantomjs-1.9.1-linux-x86_64  tests
..    LICENSE.txt  bin          my_config.js  pjscrape.js

In "scrape/pjscrape" I run the following phantomjs pjscrape/pjscrape.js my_config.js.

This is the result:
~/scrape/pjscrape]$phantomjs pjscrape/pjscrape.js my config.js
2013-09-01T08:48:09 [WARNING] Unable to load library icui18n "Cannot load library icui18n: (libicui18n.so.48: cannot open shared object file: No such file or directory)"
2013-09-01T08:48:09 [WARNING] phantomjs: cannot connect to X server

Tried to install icui18n:
~/scrape/pjscrape]$sudo apt-get install icui18n
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package icui18n

What did I miss?
What do you suggest me to do?

Thank you in advance for your suggestions.

Marco

Andrew Hamilton

unread,
Sep 3, 2013, 10:32:54 AM9/3/13
to phan...@googlegroups.com
That library is actually in the libicu48 package, so:

apt-get install libicu48

might fix it? Here's hoping.

Marco Ippolito

unread,
Sep 3, 2013, 10:44:53 AM9/3/13
to phan...@googlegroups.com
Dear Andrew,
thank you for your kind suggestion.

This is what I got:

~/scrape]$apt-get install libicu48
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Any new clues?
Kind regards,
Marco


2013/9/3 Andrew Hamilton <and...@gripmedia.com>

--
You received this message because you are subscribed to a topic in the Google Groups "phantomjs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phantomjs/DwZIi0j7oYc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phantomjs+...@googlegroups.com.
Visit this group at http://groups.google.com/group/phantomjs.
For more options, visit https://groups.google.com/groups/opt_out.

Andrew Hamilton

unread,
Sep 3, 2013, 10:51:01 AM9/3/13
to phan...@googlegroups.com
Your account doesn't have permission to update the system. Just try: 

sudo apt-get install libicu48

It'll ask for your password to verify you can make changes to the system, and it should install. 

Marco Ippolito

unread,
Sep 3, 2013, 10:54:00 AM9/3/13
to phan...@googlegroups.com

thank you very much Andrew
regards
Marco

Ariya Hidayat

unread,
Sep 3, 2013, 11:15:54 AM9/3/13
to phan...@googlegroups.com
> This is the result:
> ~/scrape/pjscrape]$phantomjs pjscrape/pjscrape.js my config.js
> 2013-09-01T08:48:09 [WARNING] Unable to load library icui18n "Cannot load
> library icui18n: (libicui18n.so.48: cannot open shared object file: No such
> file or directory)"
> 2013-09-01T08:48:09 [WARNING] phantomjs: cannot connect to X server

Most likely you got the wrong version. PhantomJS does not require X
anymore since early 2012.



--
Ariya Hidayat, http://ariya.ofilabs.com
http://twitter.com/ariyahidayat
http://gplus.to/ariyahidayat

Marco Ippolito

unread,
Sep 4, 2013, 11:02:54 AM9/4/13
to phan...@googlegroups.com
Dear Ariya and hi everybody,
sorry for keeping you asking help, but from what I read and from I get in www.phantomjs.org and in googlecode links I cannot get the solution.

From https://github.com/ariya/phantomjs/issues/11122 Nikita suggested to update  Phantomjs using sudo apt-get install phantomjs.

This is the result:
 
~/scrape/pjscrape]$sudo apt-get install phantomjs
Reading package lists... Done
Building dependency tree
Reading state information... Done
phantomjs is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 85 not upgraded.

In order to understand which version of Phantomjs I downloaded from www.phantomjs.org and installed on my AWS istance (amd64 server), I typed:
sudo apt-cache policy phantomjs
phantomjs:
  Installed: 1.4.0+dfsg-1
  Candidate: 1.4.0+dfsg-1
  Version table:
 *** 1.4.0+dfsg-1 0
        500 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
        100 /var/lib/dpkg/status

But in http://phantomjs.org/faq.html I read "Why do I get the error message phantomjs: cannot connect to X server?

A: In PhantomJS 1.4 or earlier, X server is still needed. The workaround is to use Xvfb. Starting with PhantomJS 1.5, it is pure headless and there is no need to run X11/Xvfb anymore."

So PhantomJS 1.4.0, which I downloaded from phantom.org through  phantomjs-1.9.1-linux-x86_64.tar.bz2, is not such newest one, despite of sudo apt-get install phantomjs says it's the newest version. Is it correct?

Anyway.....I searched the list of downloadable versions of phantomjs and found this:

before downloading anything, I removed the previous main directory and everything in it from my ubuntu istance.
- Released: Jun 05, 2013
downloaded and extracted in my ubuntu AWS istance (amd64 server).

The result is the same:
~/scrape/pjscrape]$phantomjs pjscrape/pjscrape.js my_config.js
2013-09-04T14:24:16 [WARNING] phantomjs: cannot connect to X server

~/scrape/pjscrape]$sudo apt-cache policy phantomjs
phantomjs:
  Installed: 1.4.0+dfsg-1
  Candidate: 1.4.0+dfsg-1
  Version table:
 *** 1.4.0+dfsg-1 0
        500 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
        100 /var/lib/dpkg/status

So....forgive me if I'm here again for asking you where to get the right links, from where to download the proper phantomjs version, which doesn't have this problem

Looking forward to your kind response.
Kind regards.
Marco
PS: please forgive me for being not a linux expert....I'm here to learn from all of you



You can get it from the download page. You may have downloaded the
latest one but you may run the wrong version. Teach yourself a bit
Unix and check the PATH etc.

Note: always use the mailing-list for question, I can't afford to
provide personalized support for PhantomJS.




On Tue, Sep 3, 2013 at 10:03 AM, Marco Ippolito
<ippolit...@gmail.com> wrote:
> Dear Ariya
> where can I get the last updated version of Phantom?
> Marco Ippolito


2013/9/3 Ariya Hidayat <ariya....@gmail.com>

Andrew Hamilton

unread,
Sep 4, 2013, 11:40:13 AM9/4/13
to phan...@googlegroups.com
You've installed PhantomJS from your package manager which is out of date (1.4.0). Which you run: 

phantomjs pjscrape/pjscrape.js my_config.js

you are calling the version linked to your path. In order to run the newer version you've downloaded, you'll need to specify where it is located such as: 

/path/to/phantomjs pjscrape/pjscrape.js my_config.js

This will fix your problem. I recommend uninstalling PhantomJS from your package manager to stop the confusion: 

apt-get remove phantomjs




Marco Ippolito

unread,
Sep 4, 2013, 12:18:32 PM9/4/13
to phan...@googlegroups.com
Dear Andrew,
thank you very much for your kind help.

typying: ~/scrape/pjscrape]$~/scrape/pjscrape/phantomjs pjscrape/pjscrape.js my_config.js
Can't open 'pjscrape/pjscrape.js'

I still have a problem to solve, but seems now that phantomjs works.

Kind regards.
Marco


2013/9/4 Andrew Hamilton <and...@gripmedia.com>

Andrew Hamilton

unread,
Sep 4, 2013, 12:30:34 PM9/4/13
to phan...@googlegroups.com
If you look at your line, you are already in the directory "pjscrape", so calling the script as "pjscrape/pjscrape.js" is like calling it from "~/scrape/pjscrape/pjscrape/pjscrape.js". One too many! Try:

~/scrape/pjscrape/phantomjs ~/scrape/pjscrape/pjscrape.js my_config.js

Or, since you're already in the directory, the easiest way would be: 

./phantomjs pjscrape.js my_config.js

Hope that helps!

Marco Ippolito

unread,
Sep 4, 2013, 12:35:13 PM9/4/13
to phan...@googlegroups.com
Dear Andrew,

do you ever think of coming to Italy for a trip?

I have to offer you one or two drinks!!!

Thank you very much for patiently solving my problem, and teaching me linux environment.

Kind regards.
Marco 

Andrew Hamilton

unread,
Sep 4, 2013, 12:39:15 PM9/4/13
to phan...@googlegroups.com
Glad I could be of service, haha. 
Reply all
Reply to author
Forward
0 new messages