ovalhub / pyicu Goto Github PK
View Code? Open in Web Editor NEWThe PyICU project repository has moved to https://pyicu.org.
License: Other
The PyICU project repository has moved to https://pyicu.org.
License: Other
When I run "python setup.py test", all three tests in test_NumberFormatter.py produce errors due to the absence of NumberFormatter. It seems the ICU-version guard present in the file, which does work when the script is executed directly, needs to be extended to handle this mode of execution.
I am not sure if PyICU is intended to support Python 2.6; if not please close this issue.
If you do intend to support Python 2.6, the call to subprocess.check_output
in setup.py
fails because check_output
was not added till Python 2.7.
File "/tmp/pip-build-wPhmnv/PyICU/setup.py", line 11, in <module>
ICU_VERSION = subprocess.check_output(('icu-config', '--version')).strip()
AttributeError: 'module' object has no attribute 'check_output'
README reads:
The PyICU homepage is http://pyicu.osafoundation.org.
But this domain doesn't seem to exist.
Hi,
I am facing issues while installing PyICU 2.0.2, as I could not succeed installing with pip install or conda install, I tried installing from a local download and get below error.
C:\Users\my101292\Downloads\pyicu-master\pyicu-master>python setup.py install
Traceback (most recent call last):
File "setup.py", line 43, in
ICU_VERSION = os.environ['ICU_VERSION']
File "C:\ProgramData\Anaconda3\lib\os.py", line 669, in getitem
raise KeyError(key) from None
KeyError: 'ICU_VERSION'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 46, in
ICU_VERSION = check_output(('icu-config', '--version')).strip()
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 403, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 709, in init
restore_signals, start_new_session)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 53, in
''')
RuntimeError:
Please set the ICU_VERSION environment variable to the version of
ICU you have installed.
I can't manage to get it working on Ubuntu 16.04.1 LTS, ICU 58.2, Anaconda python 3.6.
Collecting pyicu
Downloading PyICU-2.0.2.tar.gz (194kB)
100% |████████████████████████████████| 194kB 403kB/s
Building wheels for collected packages: pyicu
Running setup.py bdist_wheel for pyicu ... error
Complete output from command /home/gian/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-ticen7jn/pyicu/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmpqyyqrreupip-wheel- --python-tag cp36:Building PyICU 2.0.2 for ICU 58.2
Adding CXXFLAGS="-I/home/gian/anaconda3/include" from /home/gian/anaconda3/bin/icu-config
Adding LDFLAGS="-L/home/gian/anaconda3/lib -licui18n -licuuc -licudata" from /home/gian/anaconda3/bin/icu-config
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-i686-3.6
copying PyICU.py -> build/lib.linux-i686-3.6
creating build/lib.linux-i686-3.6/icu
copying icu/init.py -> build/lib.linux-i686-3.6/icu
running build_ext
building '_icu' extension
creating build/temp.linux-i686-3.6
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c _icu.cpp -o build/temp.linux-i686-3.6/_icu.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c bases.cpp -o build/temp.linux-i686-3.6/bases.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c calendar.cpp -o build/temp.linux-i686-3.6/calendar.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c char.cpp -o build/temp.linux-i686-3.6/char.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c charset.cpp -o build/temp.linux-i686-3.6/charset.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c collator.cpp -o build/temp.linux-i686-3.6/collator.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c common.cpp -o build/temp.linux-i686-3.6/common.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c dateformat.cpp -o build/temp.linux-i686-3.6/dateformat.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c errors.cpp -o build/temp.linux-i686-3.6/errors.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c format.cpp -o build/temp.linux-i686-3.6/format.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c idna.cpp -o build/temp.linux-i686-3.6/idna.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c iterators.cpp -o build/temp.linux-i686-3.6/iterators.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c layoutengine.cpp -o build/temp.linux-i686-3.6/layoutengine.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c locale.cpp -o build/temp.linux-i686-3.6/locale.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c measureunit.cpp -o build/temp.linux-i686-3.6/measureunit.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
measureunit.cpp:538:9: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
int32_t size = MeasureUnit::getAvailable(type_name, nullptr, 0, status);
^
measureunit.cpp: In function ‘PyObject* t_measureunit_getAvailable(PyTypeObject*, PyObject*)’:
measureunit.cpp:538:61: error: ‘nullptr’ was not declared in this scope
int32_t size = MeasureUnit::getAvailable(type_name, nullptr, 0, status);
^
error: command 'gcc' failed with exit status 1
Failed building wheel for pyicu
Running setup.py clean for pyicu
Failed to build pyicu
Installing collected packages: pyicu
Running setup.py install for pyicu ... error
Complete output from command /home/gian/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-ticen7jn/pyicu/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-zcwnimo6-record/install-record.txt --single-version-externally-managed --compile:Building PyICU 2.0.2 for ICU 58.2 Adding CXXFLAGS="-I/home/gian/anaconda3/include" from /home/gian/anaconda3/bin/icu-config Adding LDFLAGS="-L/home/gian/anaconda3/lib -licui18n -licuuc -licudata" from /home/gian/anaconda3/bin/icu-config running install running build running build_py creating build creating build/lib.linux-i686-3.6 copying PyICU.py -> build/lib.linux-i686-3.6 creating build/lib.linux-i686-3.6/icu copying icu/__init__.py -> build/lib.linux-i686-3.6/icu running build_ext building '_icu' extension creating build/temp.linux-i686-3.6 gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c _icu.cpp -o build/temp.linux-i686-3.6/_icu.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c bases.cpp -o build/temp.linux-i686-3.6/bases.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c calendar.cpp -o build/temp.linux-i686-3.6/calendar.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c char.cpp -o build/temp.linux-i686-3.6/char.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c charset.cpp -o build/temp.linux-i686-3.6/charset.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c collator.cpp -o build/temp.linux-i686-3.6/collator.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c common.cpp -o build/temp.linux-i686-3.6/common.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c dateformat.cpp -o build/temp.linux-i686-3.6/dateformat.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c errors.cpp -o build/temp.linux-i686-3.6/errors.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c format.cpp -o build/temp.linux-i686-3.6/format.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c idna.cpp -o build/temp.linux-i686-3.6/idna.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c iterators.cpp -o build/temp.linux-i686-3.6/iterators.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c layoutengine.cpp -o build/temp.linux-i686-3.6/layoutengine.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c locale.cpp -o build/temp.linux-i686-3.6/locale.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/gian/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gian/anaconda3/include/python3.6m -c measureunit.cpp -o build/temp.linux-i686-3.6/measureunit.o -DPYICU_VER="2.0.2" -I/home/gian/anaconda3/include cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ measureunit.cpp:538:9: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat] int32_t size = MeasureUnit::getAvailable(type_name, nullptr, 0, status); ^ measureunit.cpp: In function ‘PyObject* t_measureunit_getAvailable(PyTypeObject*, PyObject*)’: measureunit.cpp:538:61: error: ‘nullptr’ was not declared in this scope int32_t size = MeasureUnit::getAvailable(type_name, nullptr, 0, status); ^ error: command 'gcc' failed with exit status 1 ----------------------------------------
Command "/home/gian/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-ticen7jn/pyicu/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-zcwnimo6-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ticen7jn/pyicu/
When compiling against ICU 60.2 on GNU/Linux, I ran into problems that are easily fixed by adding -std=c++11 to CFLAGS in setup.py
:
CFLAGS = {
'darwin': ['-DPYICU_VER="%s"' %(VERSION)],
- 'linux': ['-DPYICU_VER="%s"' %(VERSION)],
+ 'linux': ['-DPYICU_VER="%s"' %(VERSION), '-std=c++11'],
I suspect the same will be required for darwin. One of several reasons is that the C++ type char16_t
referenced by recent version of ICU (>=58?) only exists in the standard from C++11 onwards.
You could try to set -std=c++11
conditionally depending on the underlying ICU version. In that case, ideally you would get that flag via icu-config --cxxflags
, but icu-config
unfortunately does not provide that. So if you don't want to set -std=c++11
unconditionally, you'll have to add the required check of ICU_VERSION to setup.py.
Problem:
I cannot seem to run the pyicu setup.py script successfully these days. It terminates promptly as shown in the log below: (python:3.6.2, icu:59.2, pyicu: 1.9.7. I am running on Linux-mint _18.2) an ubuntu derivative.
I suspect I am missing an fundamental detail. I am experiencing this with other versions of:
icu (55,57)
pyicu (1.9.2, 1.9.3),
python (3.5*. 3.6),
and
on MacOS-sierra.
I have been able to create working icu/pyicu/python ntegrations in the past.
A log of a setup.py. I set ICU_VERSION=’59’
`$ /home//opt/python_/3_6_2_v/bin/python setup.py build
Building PyICU 1.9.7 for ICU 59
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
copying PyICU.py -> build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/icu
copying icu/docs.py -> build/lib.linux-x86_64-3.6/icu
copying icu/init.py -> build/lib.linux-x86_64-3.6/icu
running build_ext
building 'icu' extension
creating build/temp.linux-x86_64-3.6
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home//opt/icu/59_2/source/common -I//bryllyg/opt/python_/3_6_2_v/include -I/home//bryllyg/opt/python_/3_6_2/Include -I//bryllyg/opt/python_/3_6_2 -c _icu.cpp -o build/temp.linux-x86_64-3.6/_icu.o -DPYICU_VER="1.9.7" -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from _icu.cpp:27:0:
common.h:111:30: fatal error: unicode/calendar.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status
`
I built python 3.6.2 from source. I have not installed it. I am developing an app and
will be modifying python internals, I don't want to muck up the system python version with my
experiments so I am using a virtual env folder structure as is currently recommended.
------------------------------- python detail
$ /home//opt/python_/3_6_2_v/bin/python
Python 3.6.2 (default, Jul 26 2017, 15:06:33)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
I have built and checked ICU 59.2 without error.
The symptom suggests to me that I don't have my pyicu include directory correct. Here are the pertinent lines of my setup.py. Only the linux line is pertinent.
INCLUDES = {
'darwin': ['/usr/local/include'],
'linux': ['/home//opt/icu_/59_2/source/common'],
'freebsd': ['/usr/local/include'],
'win32': ['c:/icu/include'],
'sunos5': [],
}
The error is correct:
common.h:111:30: fatal error: unicode/calendar.h: No such file or directory
calendar.h is not in /home//opt/icu_/59_2/source/common/unicode
However, calendar.h IS in /home//opt/icu_/59_2/source/common/i18n,
and when I move it over to .../common, the build just complains about
another "misplaced" file.
I've tried changing
'linux': ['/home//opt/icu_/59_2/source/common'],
to
'linux': ['/home//opt/icu_/59_2/source/i18n'],
And the build just fails on other files.
Given those clues, I saved a copy of the .../common folder and copied all the files of
.../i18n into the original .../common. Much to my surprise, pyicu/setup.py completed the
compilation phase but failed at "ld". Here is the end of the log.
.
.
.
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home//opt/icu_/59_2/source/common -I/home//opt/python_/3_6_2_v/include -I/home//opt/python_/3_6_2/Include -I/home//opt/python_/3_6_2 -c tzinfo.cpp -o build/temp.linux-x86_64-3.6/tzinfo.o -DPYICU_VER="1.9.7" -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home//opt/icu_/59_2/source/common -I/home//opt/python_/3_6_2_v/include -I/home//opt/python_/3_6_2/Include -I/home//opt/python_/3_6_2 -c unicodeset.cpp -o build/temp.linux-x86_64-3.6/unicodeset.o -DPYICU_VER="1.9.7" -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
g++ -pthread -shared build/temp.linux-x86_64-3.6/icu.o build/temp.linux-x86_64-3.6/bases.o build/temp.linux-x86_64-3.6/calendar.o build/temp.linux-x86_64-3.6/char.o build/temp.linux-x86_64-3.6/charset.o build/temp.linux-x86_64-3.6/collator.o build/temp.linux-x86_64-3.6/common.o build/temp.linux-x86_64-3.6/dateformat.o build/temp.linux-x86_64-3.6/errors.o build/temp.linux-x86_64-3.6/format.o build/temp.linux-x86_64-3.6/idna.o build/temp.linux-x86_64-3.6/iterators.o build/temp.linux-x86_64-3.6/layoutengine.o build/temp.linux-x86_64-3.6/locale.o build/temp.linux-x86_64-3.6/normalizer.o build/temp.linux-x86_64-3.6/numberformat.o build/temp.linux-x86_64-3.6/regex.o build/temp.linux-x86_64-3.6/script.o build/temp.linux-x86_64-3.6/search.o build/temp.linux-x86_64-3.6/shape.o build/temp.linux-x86_64-3.6/spoof.o build/temp.linux-x86_64-3.6/transliterator.o build/temp.linux-x86_64-3.6/tzinfo.o build/temp.linux-x86_64-3.6/unicodeset.o -licui18n -licuuc -licudata -o build/lib.linux-x86_64-3.6/icu.cpython-36m-x86_64-linux-gnu.so /home//opt/icu/59_2/source/lib
/usr/bin/ld: cannot find -licui18n
/usr/bin/ld: cannot find -licuuc
/usr/bin/ld: cannot find -licudata
/usr/bin/ld: cannot find /home//opt/icu/59_2/source/lib: File format not recognized
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
This suggests that the path I supply for finding the libraries is wrong.
The complaint "file format not recognized" is cryptic.
Have I configured ICU incorrectly perhaps?
Can I only integrate with the root of the virtualenv tree? I haven't tried that yet.
I'm having trouble installing pyicu. I've tried to install with pip, and install from source, but each time I get this error (run: python setup.py build):
shape.cpp: In function ‘void _init_shape(PyObject*)’:
shape.cpp:167: error: ‘U_SHAPE_TAIL_NEW_UNICODE’ was not declared in this scope
shape.cpp:168: error: ‘U_SHAPE_TAIL_TYPE_MASK’ was not declared in this scope
/usr/include/unicode/tmutfmt.h: At global scope:
/usr/include/unicode/tmutfmt.h:231: warning: ‘UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)’ declared ‘static’ but never defined
error: command 'gcc' failed with exit status 1
I'm using Scientific Linux 6.7 (Carbon), python 2.7
Running this script with the pypy from pypy.org and icu installed from macports:
#!/bin/bash
set -e
curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-13.0.1.tar.gz
tar xvfz virtualenv-13.0.1.tar.gz
cd virtualenv-13.0.1
~/py/pypy/bin/pypy virtualenv.py myVE
cd myVE
export PYICU_INCLUDES=/opt/local/include
export PYICU_LFLAGS=-L/opt/local/lib
./bin/pip install PyICU
./bin/pypy -c 'import icu'
results in this:
./test.sh: line 14: 73312 Segmentation fault: 11 ./bin/pypy -c 'import icu'
Would be happy to provide any more info that might help resolve the issue.
This test fails for me at least on x86_64:
Traceback (most recent call last):
File "/home/packages/tmp/pyicu-1.9.8/build/py2/test/test_Script.py", line 48, in testSurrogatePairs
self.assertEqual(['Latn', 'Deva', 'Hani', 'Zzzz', 'Zzzz'], names)
AssertionError: Lists differ: ['Latn', 'Deva', 'Hani', 'Zzzz... != ['Latn', 'Deva', 'Hani', 'Zyyy...
First differing element 3:
'Zzzz'
'Zyyy'
Ran 39 tests in 0.351s
FAILED (failures=1)
My code
import icu
thai2latin = icu.Transliterator.createInstance('Thai-Latin')
thai2latin("แมว")
error
Traceback (most recent call last):
File "<pyshell#41>", line 3, in <module>
thai2latin("แมว")
TypeError: 'icu.Transliterator' object is not callable
how to use Thai-Latin in pyicu ? https://github.com/svn2github/icu/blob/master/source/data/translit/ThaiLogical_Latin.txt
Traceback (most recent call last):
File "/<>/build/py2/test/test_Spoof.py", line 62, in testGetSkeleton
u" A long 'identifier' that vvill overflovv irnplernentation stack buffers, forcing heap allocations. A long 'identifier' that vvill overflovv irnplernentation stack buffers, forcing heap allocations. A long 'identifier' that vvill overflovv irnplernentation stack buffers, forcing heap allocations. A long 'identifier' that vvill overflovv irnplernentation stack buffers, forcing heap allocations.")
File "/<>/build/py2/test/test_Spoof.py", line 55, in checkSkeleton
self.assertEqual(skeleton, result)
AssertionError: u" A long 'identifier' that will overflow irnplernentation stack buffers, forcin [truncated]... != u" A long 'identifier' that vvill overflovv irnplernentation stack buffers, forc [truncated]...
Diff is 791 characters long. Set self.maxDiff to None to see it.
Ran 39 tests in 0.570s
FAILED (failures=1)
It seems that from icu import * does not import ListFormatter.
EE
======================================================================
ERROR: testDefault (__main__.TestListFormatter)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_ListFormatter.py", line 34, in testDefault
formatter = ListFormatter.createInstance()
NameError: global name 'ListFormatter' is not defined
======================================================================
ERROR: testLocale (__main__.TestListFormatter)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_ListFormatter.py", line 41, in testLocale
formatter = ListFormatter.createInstance(Locale.getFrance())
NameError: global name 'ListFormatter' is not defined
----------------------------------------------------------------------
Ran 2 tests in 0.000s
Does it work for you?
One of my projects installs pyicu
on travis to run some tests, but installing PyICU seems to fail.
I'm no familiar enough to explain what's failing, but the entire output is here:
Both 2.0.2 and the current master fail to compile with ICU 59.1:
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c bases.cpp -o build/temp.linux-x86_64-2.7/bases.o -DPYICU_VER="2.0.2" -std=c++11 -I/usr/local/include
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
In file included from bases.cpp:30:0:
bases.cpp: In function 'void _init_bases(PyObject*)':
bases.cpp:2368:27: error: 'U_TITLECASE_NO_BREAK_ADJUSTMENT' was not declared in this scope
INSTALL_MODULE_INT(m, U_TITLECASE_NO_BREAK_ADJUSTMENT);
^
macros.h:371:44: note: in definition of macro 'INSTALL_MODULE_INT'
PyModule_AddIntConstant(module, #name, name);
^~~~
bases.cpp:2369:27: error: 'U_TITLECASE_NO_LOWERCASE' was not declared in this scope
INSTALL_MODULE_INT(m, U_TITLECASE_NO_LOWERCASE);
^
macros.h:371:44: note: in definition of macro 'INSTALL_MODULE_INT'
PyModule_AddIntConstant(module, #name, name);
^~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
The error can be reproduced with this Dockerfile:
FROM debian:stable
RUN apt-get -y update && apt-get -y install git wget build-essential python-dev
RUN cd /tmp
RUN wget http://download.icu-project.org/files/icu4c/59.1/icu4c-59_1-src.tgz
RUN tar xf icu4c-59_1-src.tgz
RUN cd icu/source && ./configure && make -j3 && make install
RUN cd /tmp
RUN git clone https://github.com/ovalhub/pyicu/
RUN cd pyicu && python setup.py build
The problem occurs with:
- visual studio community 2015
- windows 10 amd64 4-processor dell
- python 3.5.0 win32 python. Note that vc 2015 compiles amd64 bit code but blocks execution at run-time.
- icu 55 and 56 win32 builds
The problem does not occur when I use visual C++ 2010 express, I just verified this on my win7 machine. BUT
- unfortunately I no longer have the vs 2010 express install package,
- I can no longer find a means to download visual C++ 2010 express from a credible site. If I can't get it from microsoft directly then I probably don't want it, and MS probably is discouraging use
at this point.
- documentation for VS community 2015 indicates that visual C++ express 2010 is accessible "in" VS community 2015. I have not figured out how at this point.
Regardless it appears that python 3.5.0 is now using VS 2015 in production to compile from source.
Here is my compile output (I tried attaching but git hub declared, "Something went really wrong...")
It occurs to me that I should try installing VS 2015 on my win7 machine to see if by chance the compilation works there.
There are 4 instances of a single type error in a function/method within the pyicu calendar.cpp module
c:\Users\xxxxxx\bryllyg\opt\icu\56.1\pyicu_1.9.2>C:\Users\xxxxxx\bryllyg\opt\python\Python-3.5.0\PCbuild\win32\python.exe setup.py build --debug
C:\Users\xxxxxx\bryllyg\opt\python\Python-3.5.0\PCbuild\win32\python.exe setup.py build --debug
running build
running build_py
running build_ext
building '_icu' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Od /MDd /Zi /W3 /D_DEBUG -IC:\Users\xxxxxx\bryllyg\opt\icu\56.1\icu\include -IC:\Users\xxxxxx\bryllyg\opt\python\Python-3.5.0\include -IC:\Users\xxxxxx\bryllyg\opt\python\Python-3.5.0\PC "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /EHsc /Tpc:\Users\xxxxxx\bryllyg\opt\icu\56.1\pyicu_1.9.2\bases.cpp /Fobuild\temp.win32-3.5\Debug\bases.obj /Zc:wchar_t /EHsc /DPYICU_VER="1.9.2" /Od /DDEBUG
bases.cpp
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Od /MDd /Zi /W3 /D_DEBUG -IC:\Users\xxxxxx\bryllyg\opt\icu\56.1\icu\include -IC:\Users\xxxxxx\bryllyg\opt\python\Python-3.5.0\include -IC:\Users\xxxxxx\bryllyg\opt\python\Python-3.5.0\PC "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /EHsc /Tpc:\Users\xxxxxx\bryllyg\opt\icu\56.1\pyicu_1.9.2\calendar.cpp /Fobuild\temp.win32-3.5\Debug\calendar.obj /Zc:wchar_t /EHsc /DPYICU_VER="1.9.2" /Od /DDEBUG
calendar.cpp
c:\Users\xxxxxx\bryllyg\opt\icu\56.1\pyicu_1.9.2\calendar.cpp(353): error C2664: 'icu_56::UnicodeString &icu_56::TimeZone::getDisplayName(UBool *(__cdecl *)(void),icu_56::TimeZone::EDisplayType,const icu_56::Locale &,icu_56::UnicodeString &) const': cannot convert argument 1 from 'UBool' to 'UBool *(__cdecl *)(void)'
c:\Users\xxxxxx\bryllyg\opt\icu\56.1\pyicu_1.9.2\calendar.cpp(353): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
c:\Users\xxxxxx\bryllyg\opt\icu\56.1\pyicu_1.9.2\calendar.cpp(367): error C2664: 'icu_56::UnicodeString &icu_56::TimeZone::getDisplayName(UBool *(__cdecl *)(void),icu_56::TimeZone::EDisplayType,const icu_56::Locale &,icu_56::UnicodeString &) const': cannot convert argument 1 from 'UBool' to 'UBool *(__cdecl *)(void)'
c:\Users\xxxxxx\bryllyg\opt\icu\56.1\pyicu_1.9.2\calendar.cpp(367): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
c:\Users\xxxxxx\bryllyg\opt\icu\56.1\pyicu_1.9.2\calendar.cpp(372): error C2664: 'icu_56::UnicodeString &icu_56::TimeZone::getDisplayName(UBool *(__cdecl *)(void),icu_56::TimeZone::EDisplayType,const icu_56::Locale &,icu_56::UnicodeString &) const': cannot convert argument 1 from 'UBool' to 'UBool *(__cdecl *)(void)'
c:\Users\xxxxxx\bryllyg\opt\icu\56.1\pyicu_1.9.2\calendar.cpp(372): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
c:\Users\xxxxxx\bryllyg\opt\icu\56.1\pyicu_1.9.2\calendar.cpp(380): error C2664: 'icu_56::UnicodeString &icu_56::TimeZone::getDisplayName(UBool *(__cdecl *)(void),icu_56::TimeZone::EDisplayType,const icu_56::Locale &,icu_56::UnicodeString &) const': cannot convert argument 1 from 'UBool' to 'UBool *(__cdecl *)(void)'
c:\Users\xxxxxx\bryllyg\opt\icu\56.1\pyicu_1.9.2\calendar.cpp(380): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Users\xxxxxx\bryllyg\opt\python\Python-3.5.0\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'test_suite'
warnings.warn(msg)
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe' failed with exit status
I had to disable the tests on the python 3 build of pyicu on Mageia as they seem not to be compatible with Python 3.
This patch fixes a first set of error:
From d5a0a92b58e8df63f756030512453446f00256c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <[email protected]>
Date: Wed, 15 Mar 2017 23:08:44 +0100
Subject: [PATCH] Fix `except` syntax error with Python 3.5
---
test/test_LayoutEngine.py | 2 +-
test/test_LocaleData.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/test_LayoutEngine.py b/test/test_LayoutEngine.py
index 083a082..ed9e8ff 100644
--- a/test/test_LayoutEngine.py
+++ b/test/test_LayoutEngine.py
@@ -31,7 +31,7 @@ try:
if ICU_VERSION >= '58':
raise NotImplementedError
from fontTools.ttLib import TTFont
-except ImportError, e:
+except ImportError:
print >>sys.stderr, "\nfontTools package not found, skipping LayoutEngine tests\n"
except NotImplementedError:
print >>sys.stderr, "\nLayoutEngine not available in ICU %s" %(ICU_VERSION)
diff --git a/test/test_LocaleData.py b/test/test_LocaleData.py
index b4752a2..9d88eba 100644
--- a/test/test_LocaleData.py
+++ b/test/test_LocaleData.py
@@ -184,7 +184,7 @@ class TestLocaleData(TestCase):
try:
print_output(locale + " LocaleDisplayPattern:" + repr(ld.getLocaleDisplayPattern()))
getLocaleDisplayPattern = True
- except ICUError, e: # resource not found
+ except ICUError as e: # resource not found
getLocaleDisplayPattern = str(e) == NOT_FOUND_ERR
except:
getLocaleDisplayPattern = False
@@ -192,7 +192,7 @@ class TestLocaleData(TestCase):
try:
print_output(locale + " LocaleSeparator:" + repr(ld.getLocaleSeparator()))
getLocaleSeparator = True
- except ICUError, e: # resource not found
+ except ICUError as e: # resource not found
getLocaleSeparator = str(e) == NOT_FOUND_ERR
except:
getLocaleSeparator = False
--
2.10.2
But then there are some more errors:
======================================================================
ERROR: testUnicode (test.test_Charset.TestCharset)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/akien/Mageia/Checkout/python-icu/BUILD/python3-python-icu-1.9.5-1.mga6/test/test_Charset.py", line 62, in testUnicode
ustring = unicode(CharsetDetector(bytes).detect())
NameError: name 'unicode' is not defined
======================================================================
ERROR: testSort (test.test_Collator.TestCollator)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/akien/Mageia/Checkout/python-icu/BUILD/python3-python-icu-1.9.5-1.mga6/test/test_Collator.py", line 47, in testSort
names = [unicode(n.strip(), 'utf-8') for n in input.readlines()]
File "/home/akien/Mageia/Checkout/python-icu/BUILD/python3-python-icu-1.9.5-1.mga6/test/test_Collator.py", line 47, in <listcomp>
names = [unicode(n.strip(), 'utf-8') for n in input.readlines()]
NameError: name 'unicode' is not defined
======================================================================
ERROR: testSurrogatePairs (test.test_Script.TestScript)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/akien/Mageia/Checkout/python-icu/BUILD/python3-python-icu-1.9.5-1.mga6/test/test_Script.py", line 53, in testSurrogatePairs
for i in xrange(pairs.countChar32())]
NameError: name 'xrange' is not defined
======================================================================
ERROR: testPythonTransliterator (test.test_Transliterator.TestTransliterator)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/akien/Mageia/Checkout/python-icu/BUILD/python3-python-icu-1.9.5-1.mga6/test/test_Transliterator.py", line 74, in testPythonTransliterator
self.assertTrue(trans.transliterate(string) == result)
File "/home/akien/Mageia/Checkout/python-icu/BUILD/python3-python-icu-1.9.5-1.mga6/test/test_Transliterator.py", line 64, in handleTransliterate
for i in xrange(pos.start, pos.limit):
NameError: name 'xrange' is not defined
======================================================================
ERROR: testUnicodeString (test.test_Transliterator.TestTransliterator)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/akien/Mageia/Checkout/python-icu/BUILD/python3-python-icu-1.9.5-1.mga6/test/test_Transliterator.py", line 53, in testUnicodeString
self.assertTrue(trans.transliterate(unicode(string)) == result)
NameError: name 'unicode' is not defined
======================================================================
ERROR: testExemplarSet (test.test_LocaleData.TestLocaleData)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/akien/Mageia/Checkout/python-icu/BUILD/python3-python-icu-1.9.5-1.mga6/test/test_LocaleData.py", line 111, in testExemplarSet
print_output(locale + " exemplar " + repr(unicode(exemplarSets[0])))
NameError: name 'unicode' is not defined
======================================================================
ERROR: testExemplarSet2 (test.test_LocaleData.TestLocaleData)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/akien/Mageia/Checkout/python-icu/BUILD/python3-python-icu-1.9.5-1.mga6/test/test_LocaleData.py", line 157, in testExemplarSet2
print_output(locale + " exemplar(ES_STANDARD)" + repr(unicode(exemplarSets[0])))
NameError: name 'unicode' is not defined
----------------------------------------------------------------------
Ran 40 tests in 0.106s
FAILED (errors=7)
I don't have time to debug much further just yet, so opening this issue instead of providing a complete PR :)
The following line:
ICU_VERSION = subprocess.check_output(('icu-config', '--version')).strip()
( 81830b3#diff-2eeaed663bd0d25b7e608891384b7298R11 )
Fails on windows for which an icu-config exe doesn't exist (the icu win binaries include a bunch of dll and exe files but no icu-config).
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:/icu/include -IC:\Python36\include -IC:\Python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /EHsc /Tpcommon.cpp /Fobuild\temp.win-amd64-3.6\Release\common.obj /Zc:wchar_t /EHsc /DPYICU_VER="1.9.5" common.cpp
common.cpp(226): error C2664: 'UChar *u_memcpy_58(UChar *,const UChar *,int32_t)': cannot convert argument 1 from 'Py_UCS2 *' to 'UChar *'
common.cpp(226): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
common.cpp(283): warning C4244: '=': conversion from 'Py_ssize_t' to 'int32_t', possible loss of data
common.cpp(325): warning C4244: 'argument': conversion from '__int64' to 'int32_t', possible loss of data
common.cpp(361): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int32_t', possible loss of data
common.cpp(369): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int32_t', possible loss of data
common.cpp(377): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int32_t', possible loss of data
common.cpp(383): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int32_t', possible loss of data
common.cpp(392): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int32_t', possible loss of data
common.cpp(400): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int32_t', possible loss of data
common.cpp(619): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
common.cpp(690): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
common.cpp(730): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
common.cpp(765): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
common.cpp(806): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
common.cpp(826): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data
common.cpp(1089): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2
Can we have this feature? this is really important, cause currently we can't change timezone using ICU.
I got this error when I tried to run my code
ImportError: /usr/local/lib/python3.5/dist-packages/_icu.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZTIN6icu_5714LEFontInstanceE
any ideas?
Our travis just broke on:
$ travis_retry sudo pip3 install pyicu
Collecting pyicu
Downloading PyICU-1.9.tar.gz (175kB)
100% |████████████████████████████████| 176kB 1.9MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-8u4vam/pyicu/setup.py", line 88, in <module>
long_description=open('README.md').read(),
IOError: [Errno 2] No such file or directory: 'README.md'
According to this issue in stackoverflow I understood that there are some incompatibilities between python 3.6 and PyICU, just reporting the error here so I can be fixed.
Install v1.9.6 works, but 1.9.7 failed with gcc error:
Building PyICU 1.9.7 for ICU 4.8.1.1
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying PyICU.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/icu
copying icu/docs.py -> build/lib.linux-x86_64-2.7/icu
copying icu/__init__.py -> build/lib.linux-x86_64-2.7/icu
running build_ext
building '_icu' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c _icu.cpp -o build/temp.linux-x86_64-2.7/_icu.o -DPYICU_VER="1.9.7" -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]
cc1plus: error: unrecognized command line option ‘-std=c++11’
error: command 'gcc' failed with exit status 1
My python version is python 3.6 and I installed PyICU in a conda environment (As I'm already using Tensofrlow and NLTK in the environment) .
And use import icu
it doesn't give me any syntax error (on Pycharm) , but when I execute the code it gives me this error.
Traceback (most recent call last):
File "/home/pankaja/PycharmProjects/teamspark/testing/sinhalasort.py", line 1, in <module>
import icu
File "/home/pankaja/anaconda3/envs/tensorflow/lib/python3.5/site-packages/icu/__init__.py", line 37, in <module>
from _icu import *
ImportError: libicui18n.so.58: cannot open shared object file: No such file or directory
I can install and use pyicu in the normal environment. But I need to use this in this conda environment. So how can I do that ?
This program causes segmentation fault:
import icu
while 1:
try:
icu.UnicodeString(b'', 'moo')
except:
pass
Backtrace:
#0 0x00000000004a62d7 in PyObject_GC_UnTrack (op=0x7ffff7e850e0) at ../Modules/gcmodule.c:1482
#1 0x00000000004e41b3 in tupledealloc.lto_priv.397 (op=0x7ffff7e850e0) at ../Objects/tupleobject.c:217
#2 BaseException_clear.lto_priv.69 (self=0x7ffff7e60a00) at ../Objects/exceptions.c:75
#3 BaseException_dealloc.lto_priv.67 () at ../Objects/exceptions.c:84
#4 0x00000000004fd4da in subtype_dealloc.lto_priv () at ../Objects/typeobject.c:1050
#5 0x00000000004a0b12 in insertdict_by_entry.lto_priv.1410 (value=<ICUError at remote 0x7ffff7e60a50>, ep=<optimized out>, hash=<optimized out>, key='exc_value', mp=0x7ffff7fe5280) at ../Objects/dictobject.c:519
#6 insertdict.lto_priv.1282 (value=<ICUError at remote 0x7ffff7e60a50>, hash=<optimized out>, key='exc_value', mp=0x7ffff7fe5280) at ../Objects/dictobject.c:556
#7 dict_set_item_by_hash_or_entry (value=<ICUError at remote 0x7ffff7e60a50>, ep=0x0, hash=<optimized out>, key='exc_value', op= {'setrecursionlimit': <built-in function setrecursionlimit>, 'dont_write_bytecode': False, 'getrefcount': <built-in function getrefcount>, 'long_info': <sys.long_info at remote 0x7ffff7fb1530>, 'path_importer_cache': {'/usr/lib/python2.7/lib-old': <imp.NullImporter at remote 0x7ffff7ec6040>, '/usr/local/lib/python2.7/dist-packages': None, '/usr/lib/python2.7/encodings': None, '/usr/lib/python2.7/plat-x86_64-linux-gnu': None, '/home/jwilk': None, '/usr/lib/python2.7/lib-tk': None, '/usr/lib/python2.7/lib-dynload': None, 'test.py': <imp.NullImporter at remote 0x7ffff7ec6050>, '/usr/lib/python2.7/dist-packages': None, '/usr/lib/python2.7': None, '/usr/lib/python2.7/': None}, 'stdout': <file at remote 0x7ffff7fcd150>, 'getprofile': <built-in function getprofile>, '__stdin__': <file at remote 0x7ffff7fcd0c0>, 'version_info': <sys.version_info at remote 0x7ffff7fb0f70>, 'exc_clear': <built-in function exc_clear>, 'prefix': '/usr', 'getfilesystemencoding': <built-in function getfilesystemencoding>, 'byteorder': 'lit...(truncated)) at ../Objects/dictobject.c:795
#8 PyDict_SetItem () at ../Objects/dictobject.c:848
#9 0x00000000004a451c in PyDict_SetItemString () at ../Objects/dictobject.c:2469
#10 0x00000000004ca8f4 in set_exc_info (tb=<traceback at remote 0x7ffff7eac8c0>, value=<ICUError at remote 0x7ffff7e60a50>, type=<type at remote 0xa24fe0>, tstate=0x9840a0) at ../Python/ceval.c:3737
#11 PyEval_EvalFrameEx () at ../Python/ceval.c:3251
#12 0x00000000004c2215 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#13 0x00000000004c1fb9 in PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>) at ../Python/ceval.c:669
#14 0x00000000004f193f in run_mod.lto_priv () at ../Python/pythonrun.c:1376
#15 0x00000000004ec252 in PyRun_FileExFlags () at ../Python/pythonrun.c:1362
#16 0x00000000004eaa21 in PyRun_SimpleFileExFlags () at ../Python/pythonrun.c:948
#17 0x000000000049dde8 in Py_Main () at ../Modules/main.c:640
#18 0x00007ffff6f14730 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#19 0x000000000049d639 in _start ()
Tested with PyICU 1.9.3, ICU 55.1.
Hi
I am using TimeUnitFormat class as mentioned here.
But I am getting icu.InvalidArgsError
always.
formatter = TimeUnitFormat(Locale('en_US'))
obj = TimeUnitAmount(1, 0) # 0 means YEAR
print(formatter.format(obj))
I am getting one test failure with the latest pyicu 1.9.3 release:
======================================================================
FAIL: testGetBestPattern (test.test_DateTimeParserGenerator.TestDateTimePatternGenerator)
Test a few different languages and common patterns.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/build/python-pyicu/src/PyICU-1.9.3/test/test_DateTimeParserGenerator.py", line 74, in testGetBestPattern
self.assertEqual(sdf.format(self.date), locale_data[index])
AssertionError: 'May 10' != 'May 9'
- May 10
? ^^
+ May 9
? ^
----------------------------------------------------------------------
Ran 38 tests in 0.339s
FAILED (failures=1)
Any hints?
I am seeing the following test failure on Cygwin with Python 3.
======================================================================
FAIL: testSurrogatePairs (test.test_Script.TestScript)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/cygdrive/c/stuff/PyICU-1.9.7/test/test_Script.py", line 48, in testSurrogatePairs
self.assertEqual(['Latn', 'Deva', 'Hani', 'Hani', 'Hani'], names)
AssertionError: Lists differ: ['Latn', 'Deva', 'Hani', 'Hani', 'Hani'] != ['Latn', 'Deva', 'Hani', 'Zzzz', 'Zzzz']
First differing element 3:
'Hani'
'Zzzz'
- ['Latn', 'Deva', 'Hani', 'Hani', 'Hani']
? ^^^^ ^^^^
+ ['Latn', 'Deva', 'Hani', 'Zzzz', 'Zzzz']
? ^^^^ ^^^^
----------------------------------------------------------------------
Ran 39 tests in 0.428s
FAILED (failures=1)
Test failed: <unittest.runner.TextTestResult run=39 errors=0 failures=1>
error: Test failed: <unittest.runner.TextTestResult run=39 errors=0 failures=1>
This is with PyICU 1.9.7 for ICU 58.2, Python 3.6.1.
I want to use PyICU on Heroku.
I installed libicu-dev via heroku-buildpack-apt.
During build, I see this:
building '_icu' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app/.heroku/python/include/python2.7 -c iterators.cpp -o build/temp.linux-x86_64-2.7/iterators.o -DPYICU_VER="1.9.3"
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from /usr/include/c++/4.8/clocale:42:0,
from /usr/include/x86_64-linux-gnu/c++/4.8/bits/c++locale.h:41,
from /usr/include/c++/4.8/bits/localefwd.h:40,
from /usr/include/c++/4.8/string:43,
from /app/.apt/usr/include/x86_64-linux-gnu/unicode/std_string.h:30,
from /app/.apt/usr/include/x86_64-linux-gnu/unicode/unistr.h:31,
from common.h:91,
from iterators.cpp:24:
./locale.h:29:23: error: ‘Locale’ was not declared in this scope
PyObject *wrap_Locale(Locale *locale, int flags);
^
./locale.h:29:31: error: ‘locale’ was not declared in this scope
PyObject *wrap_Locale(Locale *locale, int flags);
^
./locale.h:29:39: error: expected primary-expression before ‘int’
PyObject *wrap_Locale(Locale *locale, int flags);
^
./locale.h:29:48: error: expression list treated as compound expression in initializer [-fpermissive]
PyObject *wrap_Locale(Locale *locale, int flags);
^
./locale.h:30:29: error: ‘Locale’ does not name a type
PyObject *wrap_Locale(const Locale &locale);
^
./locale.h:30:43: error: ‘PyObject* wrap_Locale(const int&)’ redeclared as different kind of symbol
PyObject *wrap_Locale(const Locale &locale);
^
./locale.h:29:11: error: previous declaration of ‘PyObject* wrap_Locale’
PyObject *wrap_Locale(Locale *locale, int flags);
^
In file included from /usr/include/x86_64-linux-gnu/c++/4.8/bits/c++locale.h:41:0,
from /usr/include/c++/4.8/bits/localefwd.h:40,
from /usr/include/c++/4.8/string:43,
from /app/.apt/usr/include/x86_64-linux-gnu/unicode/std_string.h:30,
from /app/.apt/usr/include/x86_64-linux-gnu/unicode/unistr.h:31,
from common.h:91,
from iterators.cpp:24:
/usr/include/c++/4.8/clocale:53:11: error: ‘::lconv’ has not been declared
using ::lconv;
^
/usr/include/c++/4.8/clocale:54:11: error: ‘::setlocale’ has not been declared
using ::setlocale;
^
/usr/include/c++/4.8/clocale:55:11: error: ‘::localeconv’ has not been declared
using ::localeconv;
^
In file included from /usr/include/c++/4.8/bits/localefwd.h:40:0,
from /usr/include/c++/4.8/string:43,
from /app/.apt/usr/include/x86_64-linux-gnu/unicode/std_string.h:30,
from /app/.apt/usr/include/x86_64-linux-gnu/unicode/unistr.h:31,
from common.h:91,
from iterators.cpp:24:
/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++locale.h:52:23: error: ‘uselocale’ was not declared in this scope
extern "C" __typeof(uselocale) __uselocale;
^
/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++locale.h:52:45: error: invalid type in declaration before ‘;’ token
extern "C" __typeof(uselocale) __uselocale;
^
/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++locale.h: In function ‘int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)’:
/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++locale.h:75:53: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
^
/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++locale.h:100:33: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
__gnu_cxx::__uselocale(__old);
^
iterators.cpp: In function ‘PyObject* t_breakiterator_getLocale(t_breakiterator*, PyObject*)’:
iterators.cpp:802:34: error: ‘wrap_Locale’ cannot be used as a function
return wrap_Locale(locale);
^
iterators.cpp:807:38: error: ‘wrap_Locale’ cannot be used as a function
return wrap_Locale(locale);
^
iterators.cpp: In function ‘PyObject* t_breakiterator_getAvailableLocales(PyTypeObject*)’:
iterators.cpp:936:46: error: ‘wrap_Locale’ cannot be used as a function
PyObject *obj = wrap_Locale(locale, 0);
^
error: command 'gcc' failed with exit status 1
Environment:
~ $ echo $LD_LIBRARY_PATH
/app/.heroku/vendor/lib:/app/.heroku/python/lib:/app/.apt/usr/lib/x86_64-linux-gnu:/app/.apt/usr/lib/i386-linux-gnu:/app/.apt/usr/lib:
I am unable to get python 3.6.0/icu 58.2/pyicu 1.9.5 to work as I expect. Specifically the problem is with
word break iteration.
I am running on Linux/mint/rosa (64-bit) and am current with updates.
I customize word.txt and word_POSIX.txt files for my ICU work.
The "failure" is that I don't see the results of the word_POSIX.txt customizations. It appears as if the default .so are being used rather than that specified in LD_LIBRARY_PATH.
I've attached two files that illustrate the problem:
- word_POSIX.txt with two lines added that have worked on priori versions of ICU and PyICU
(search for XmlMarkup)
word_POSIX.txt
- icu1.py a short script that demonstrates the problem derived from PyICU tests
[icu1.py.txt](https://github.com/ovalhub/pyicu/files/711907/icu1.py.txt)
At the end of this note I have attached output from icu1.py using ICU 57.1 and pyicu 1.9.3 which show correct execution. And, output from the same script ICU 58.2 and pyicu 1.9.5 which show incorrect
execution.
I am confident that python is not the problem. My customizations work with python 3.6.0, icu 57.1, and pyicu 1.9.3, and several versions prior to that.
ICU 58.2 builds without error, and passes its own tests. I build with the commands:
make clean
./runConfigureICU
make
and to test:
make check
For reasons I explain below, with 58.2 I also execute "make install" but it doesn't help.
In addition, when I add my customizations, icu 58.2 still builds without error and the icu tests show differences that I expect. For this reason, my "failure" feels more like user error than a genuine bug. My customized data is lurking somewhere. It feels like I am just missing a switch, or environment variable to access it.
When I start working with pyicu 1.9.5, odd things start to happen. The pyicu build commands I use are
python setup.py build
python setup.py install
The logs below show how I run the icu1.py script which show the results.
Details follow
First, "setup.py build" execution fails. The script reports that it is unable to find the icu *.so files in /usr/local/lib. Specifically the message from setup.py is:
### icu-config: Can't find /usr/local/lib/libicuuc.so - ICU prefix is wrong.
### Try the --prefix= option
### or --detect-prefix
### (If you want to disable this check, use the --noverify option)
### icu-config: Exitting.
Traceback (most recent call last):
File "setup.py", line 11, in <module>
ICU_VERSION = subprocess.check_output(('icu-config', '--version')).strip()
File "/home/mkearney/bryllyg/opt/python_/3_6_0/Lib/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/home/mkearney/bryllyg/opt/python_/3_6_0/Lib/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '('icu-config', '--version')' returned non-zero exit status 2.
Indeed they are not there, I have not installed icu yet. I keep normally new versions out of that area until they are proven, and defined LD_LIBRARY_PATH to be .../icu_58_2/source/lib which gets created when ICU is built. This strategy has worked until ICU 58.2
Hoping to isolate the problem, I performed icu "make install" and saw that the icu libraries were installed in
/usr/local/lib. That enable me to run pyicu "setup.py build" and "install" However, when I run my
liveness test for my customizations, the results I get are those of no customizations installed. Perhaps I am getting the default ICU data.
Bottom line, I can proceed for now with python 3.6.0/icu 57.1/pyicu 1.9.3. FYI, I tried icu 58.2 with pyicu 1.9.3, and got undefined symbol errors, and didn't proceed beyond that point.
Expected output --------- with ICU 57.1 and PyIcu 1.9.3
... /opt/python_/3_6_0_x/bin/python icu1.py
DYLD_LIBRARY_PATH not defined.
LD_LIBRARY_PATH: .../opt/icu_/57_1_brl/source/lib
ICU Break Iterator Sample Program
C++ Break Iteration in Python
Examining: bbb ccc. Ddd eee fff.
Word Boundaries...
----- forward: -----------
0 3 || bbb ccc. Ddd eee fff.
3 4 | |bbb ccc. Ddd eee fff.
4 7 |bbb| ccc. Ddd eee fff.
7 8 bbb| |ccc. Ddd eee fff.
8 11 bbb |ccc|. Ddd eee fff.
11 12 bbb ccc|.| Ddd eee fff.
12 13 bbb ccc.| |Ddd eee fff.
13 17 bbb ccc. ||Ddd eee fff.
17 20 bbb ccc. |Ddd| eee fff.
20 21 bbb ccc. Ddd| |eee fff.
21 24 bbb ccc. Ddd |eee| fff.
24 25 bbb ccc. Ddd eee| |fff.
25 28 bbb ccc. Ddd eee |fff|.
28 29 bbb ccc. Ddd eee fff|.|
End C++ Break Iteration in Python
.
Failing output - iterator breaks incorrectly. With ICU 58.2 and PyIcu 1.9.5
... /opt/python_/3_6_0_y/bin/python icu1.py
DYLD_LIBRARY_PATH not defined.
LD_LIBRARY_PATH: .../opt/icu_/58_2_brl/source/lib
ICU Break Iterator Sample Program
C++ Break Iteration in Python
Examining: bbb ccc. Ddd eee fff.
Word Boundaries...
----- forward: -----------
0 1 |<|a> bbb ccc. Ddd eee fff.
1 2 <|a|> bbb ccc. Ddd eee fff.
2 3 <a|>| bbb ccc. Ddd eee fff.
3 4 | |bbb ccc. Ddd eee fff.
4 7 |bbb| ccc. Ddd eee fff.
7 8 bbb| |ccc. Ddd eee fff.
8 11 bbb |ccc|. Ddd eee fff.
11 12 bbb ccc|.| Ddd eee fff.
12 13 bbb ccc.| |Ddd eee fff.
13 14 bbb ccc. |<|/a>Ddd eee fff.
14 15 bbb ccc. <|/|a>Ddd eee fff.
15 16 bbb ccc. </|a|>Ddd eee fff.
16 17 bbb ccc. </a|>|Ddd eee fff.
17 20 bbb ccc. |Ddd| eee fff.
20 21 bbb ccc. Ddd| |eee fff.
21 24 bbb ccc. Ddd |eee| fff.
24 25 bbb ccc. Ddd eee| |fff.
25 28 bbb ccc. Ddd eee |fff|.
28 29 bbb ccc. Ddd eee fff|.|
End C++ Break Iteration in Python
Creating a Collator and rebuilding from its rules fails for Chinese Collator's
The following code works if you change the locale to Locale("en", "US", "")
, Locale("da", "DK", "")
and a few others but not Locale("zh", "hant", "TW")
, Locale("zh", "hans", "CN")
, Locale("zh", "CN")
import icu
zh_TWCollator= icu.Collator.createInstance(icu.Locale("zh", "TW"))
zh_TWRules = zh_TWCollator.getRules();
newCollator = icu.RuleBasedCollator(zh_TWRules)
Traceback (most recent call last):
File "", line 1, in
ICUError: Character conversion: Unmappable input sequence. In other APIs: Invalid character., error code: 10
ie this line fails.
icu.Collator.createInstance(icu.Locale("zh", "TW"))
Traceback (most recent call last):
File "", line 1, in
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0101' in position 34: ordinal not in range(128)
Using icu-58.1 and msvc10/14, PyICU-1.9.5 fails to compile on CPython 3.x:
common.cpp(226): error C2664: 'UChar *u_memcpy_58(UChar *,const UChar *,int32_t)': cannot convert argument 1 from 'Py_UCS2 *' to 'UChar *'
PyICU-1.9.4 compiled OK.
In the interest of getting a different perspective on the compile problem on Windows 10, I moved to OSX. I've had working the combination icu55.1, python 3.5.0, pyicu 1.9.2 on OSX Yosemite. However, when I advanced to icu56.1,
Actually, I encounter the following error, (same as in test) when I just attempt to import icu:
hurst:PyICU-1.9.2 mkearney$ python3
Python 3.5.0 (v3.5.0:374f501f4567, Sep 12 2015, 11:00:19)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import requests
import icu
Traceback (most recent call last):
File "", line 1, in
File "/Users/mkearney/bryllyg/opt/icu/56.1/PyICU-1.9.2/icu.py", line 37, in
from docs import *
File "/Users/mkearney/bryllyg/opt/icu/56.1/PyICU-1.9.2/docs.py", line 23, in
from _icu import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/PyICU-1.9.2-py3.5-macosx-10.6-intel.egg/_icu.cpython-35m-darwin.so, 2): Library not loaded: libicui18n.56.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/PyICU-1.9.2-py3.5-macosx-10.6-intel.egg/_icu.cpython-35m-darwin.so
Reason: image not found
quit
I actually encountered this when I first tried integrating with my built from source python.3.5.0.
So the idea above was to eliminate everything custom at my end except the machine and os
I am running on.
With luck, there is still something obviously wrong that I just am unaware of. It sure looks that way.
I am thinking I need to drop back to 55.1 which I did have working and is good enough for me, though
I have encountered 56.1 has fixed some bugs that I have worked around.
Hello.
I'm using Ubuntu 16.04(64bit).
I tried to install PyICU(for python3), by using pip3.
$ pip3 install pyicu
Collecting pyicu
Using cached PyICU-1.9.3.tar.gz
Building wheels for collected packages: pyicu
Running setup.py bdist_wheel for pyicu ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-rbi2xozh/pyicu/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp4fr3ryutpip-wheel- --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
copying icu.py -> build/lib.linux-x86_64-3.5
copying PyICU.py -> build/lib.linux-x86_64-3.5
copying docs.py -> build/lib.linux-x86_64-3.5
running build_ext
building '_icu' extension
creating build/temp.linux-x86_64-3.5
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c _icu.cpp -o build/temp.linux-x86_64-3.5/_icu.o -DPYICU_VER="1.9.3"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
In file included from _icu.cpp:27:0:
common.h:90:28: fatal error: unicode/utypes.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pyicu
Running setup.py clean for pyicu
Failed to build pyicu
Installing collected packages: pyicu
Running setup.py install for pyicu ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-rbi2xozh/pyicu/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-uec_n7ii-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
copying icu.py -> build/lib.linux-x86_64-3.5
copying PyICU.py -> build/lib.linux-x86_64-3.5
copying docs.py -> build/lib.linux-x86_64-3.5
running build_ext
building '_icu' extension
creating build/temp.linux-x86_64-3.5
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c _icu.cpp -o build/temp.linux-x86_64-3.5/_icu.o -DPYICU_VER="1.9.3"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
In file included from _icu.cpp:27:0:
common.h:90:28: fatal error: unicode/utypes.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-rbi2xozh/pyicu/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-uec_n7ii-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-rbi2xozh/pyicu/
I tried with sudo, but the result was the same.
Can any help me with this?
Hey,
I've been wondering - is it safe to share the object returned by icu.Transliterator.createInstance(...)
between threads?
PyICU 2.0.1 fails to build on Ubuntu 14.04 LTS (Trusty Tahr):
Building PyICU 2.0.1 for ICU 52.1
Adding CXXFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long --std=c++0x -D_FORTIFY_SOURCE=2 -D_REENTRANT -DU_HAVE_ELF_H=1 -DU_HAVE_ATOMIC=1 -I/usr/include" from /usr/bin/icu-config
Adding LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro -ldl -lm -L/usr/lib/i386-linux-gnu -licui18n -licuuc -licudata -ldl -lm" from /usr/bin/icu-config
...
i686-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c measureunit.cpp -o build/temp.linux-i686-2.7/measureunit.o -DPYICU_VER="2.0.1" -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long --std=c++0x -D_FORTIFY_SOURCE=2 -D_REENTRANT -DU_HAVE_ELF_H=1 -DU_HAVE_ATOMIC=1 -I/usr/include
...
measureunit.cpp: In function ‘void _init_measureunit(PyObject*)’:
measureunit.cpp:2017:42: error: ‘t_measureunit_str’ was not declared in this scope
MeasureUnitType_.tp_str = (reprfunc) t_measureunit_str;
^
error: command 'i686-linux-gnu-gcc' failed with exit status 1
Full build log: https://gist.github.com/anonymous/8fe4aec7166c00012ff565e596422cc6
Have installed libicu-dev and the version of it is 4.2.1.
Downloading PyICU-1.9.4.tar.gz (181kB): 181kB downloaded
Running setup.py (path:/tmp/pip_build_root/PyICU/setup.py) egg_info for package PyICU
Installing collected packages: PyICU
Running setup.py install for PyICU
building '_icu' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c _icu.cpp -o build/temp.linux-x86_64-2.6/_icu.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c bases.cpp -o build/temp.linux-x86_64-2.6/bases.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c calendar.cpp -o build/temp.linux-x86_64-2.6/calendar.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c char.cpp -o build/temp.linux-x86_64-2.6/char.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
In file included from /usr/include/python2.6/Python.h:8:0,
from common.h:33,
from char.cpp:27:
/usr/include/python2.6/pyconfig.h:1031:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:164:0: note: this is the location of the previous definition
/usr/include/python2.6/pyconfig.h:1040:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
/usr/include/features.h:166:0: note: this is the location of the previous definition
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c charset.cpp -o build/temp.linux-x86_64-2.6/charset.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c collator.cpp -o build/temp.linux-x86_64-2.6/collator.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c common.cpp -o build/temp.linux-x86_64-2.6/common.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
common.cpp: In function 'void _init_common(PyObject*)':
common.cpp:1448:5: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
common.cpp:1448:5: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
/usr/include/unicode/tmutfmt.h: At global scope:
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c dateformat.cpp -o build/temp.linux-x86_64-2.6/dateformat.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c errors.cpp -o build/temp.linux-x86_64-2.6/errors.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c format.cpp -o build/temp.linux-x86_64-2.6/format.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c idna.cpp -o build/temp.linux-x86_64-2.6/idna.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
In file included from /usr/include/python2.6/Python.h:8:0,
from common.h:33,
from idna.cpp:27:
/usr/include/python2.6/pyconfig.h:1031:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:164:0: note: this is the location of the previous definition
/usr/include/python2.6/pyconfig.h:1040:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
/usr/include/features.h:166:0: note: this is the location of the previous definition
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c iterators.cpp -o build/temp.linux-x86_64-2.6/iterators.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c layoutengine.cpp -o build/temp.linux-x86_64-2.6/layoutengine.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c locale.cpp -o build/temp.linux-x86_64-2.6/locale.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
In file included from /usr/include/python2.6/Python.h:8:0,
from common.h:33,
from locale.cpp:35:
/usr/include/python2.6/pyconfig.h:1031:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:164:0: note: this is the location of the previous definition
/usr/include/python2.6/pyconfig.h:1040:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
/usr/include/features.h:166:0: note: this is the location of the previous definition
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c normalizer.cpp -o build/temp.linux-x86_64-2.6/normalizer.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c numberformat.cpp -o build/temp.linux-x86_64-2.6/numberformat.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
numberformat.cpp: In function 'PyObject* t_numberformat_isLenient(t_numberformat*)':
numberformat.cpp:912:29: error: 'class icu_4_2::NumberFormat' has no member named 'isLenient'
numberformat.cpp: In function 'PyObject* t_numberformat_setLenient(t_numberformat*, PyObject*)':
numberformat.cpp:923:23: error: 'class icu_4_2::NumberFormat' has no member named 'setLenient'
/usr/include/unicode/tmutfmt.h: At global scope:
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
error: command 'gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/PyICU/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-FzWkfv-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.6
copying icu.py -> build/lib.linux-x86_64-2.6
copying PyICU.py -> build/lib.linux-x86_64-2.6
copying docs.py -> build/lib.linux-x86_64-2.6
running build_ext
building '_icu' extension
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c _icu.cpp -o build/temp.linux-x86_64-2.6/_icu.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c bases.cpp -o build/temp.linux-x86_64-2.6/bases.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c calendar.cpp -o build/temp.linux-x86_64-2.6/calendar.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c char.cpp -o build/temp.linux-x86_64-2.6/char.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
In file included from /usr/include/python2.6/Python.h:8:0,
from common.h:33,
from char.cpp:27:
/usr/include/python2.6/pyconfig.h:1031:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:164:0: note: this is the location of the previous definition
/usr/include/python2.6/pyconfig.h:1040:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
/usr/include/features.h:166:0: note: this is the location of the previous definition
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c charset.cpp -o build/temp.linux-x86_64-2.6/charset.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c collator.cpp -o build/temp.linux-x86_64-2.6/collator.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c common.cpp -o build/temp.linux-x86_64-2.6/common.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
common.cpp: In function 'void _init_common(PyObject*)':
common.cpp:1448:5: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
common.cpp:1448:5: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
/usr/include/unicode/tmutfmt.h: At global scope:
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c dateformat.cpp -o build/temp.linux-x86_64-2.6/dateformat.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c errors.cpp -o build/temp.linux-x86_64-2.6/errors.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c format.cpp -o build/temp.linux-x86_64-2.6/format.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c idna.cpp -o build/temp.linux-x86_64-2.6/idna.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
In file included from /usr/include/python2.6/Python.h:8:0,
from common.h:33,
from idna.cpp:27:
/usr/include/python2.6/pyconfig.h:1031:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:164:0: note: this is the location of the previous definition
/usr/include/python2.6/pyconfig.h:1040:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
/usr/include/features.h:166:0: note: this is the location of the previous definition
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c iterators.cpp -o build/temp.linux-x86_64-2.6/iterators.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c layoutengine.cpp -o build/temp.linux-x86_64-2.6/layoutengine.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c locale.cpp -o build/temp.linux-x86_64-2.6/locale.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
In file included from /usr/include/python2.6/Python.h:8:0,
from common.h:33,
from locale.cpp:35:
/usr/include/python2.6/pyconfig.h:1031:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:164:0: note: this is the location of the previous definition
/usr/include/python2.6/pyconfig.h:1040:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
/usr/include/features.h:166:0: note: this is the location of the previous definition
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c normalizer.cpp -o build/temp.linux-x86_64-2.6/normalizer.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c numberformat.cpp -o build/temp.linux-x86_64-2.6/numberformat.o -DPYICU_VER="1.9.4"
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
numberformat.cpp: In function 'PyObject* t_numberformat_isLenient(t_numberformat*)':
numberformat.cpp:912:29: error: 'class icu_4_2::NumberFormat' has no member named 'isLenient'
numberformat.cpp: In function 'PyObject* t_numberformat_setLenient(t_numberformat*, PyObject*)':
numberformat.cpp:923:23: error: 'class icu_4_2::NumberFormat' has no member named 'setLenient'
/usr/include/unicode/tmutfmt.h: At global scope:
/usr/include/unicode/tmutfmt.h:231:29: warning: 'UBool icu_4_2::hashTableValueComparator(UHashTok, UHashTok)' declared 'static' but never defined [-Wunused-function]
error: command 'gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/PyICU/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-FzWkfv-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/PyICU
Storing debug log for failure in /root/.pip/pip.log
Similar output is generated by cloning master and attempting python setup.py install
. My first guess is that libicu4_2 numberformat doesn't have the isLenient and setLenient methods (seen http://icu.sourcearchive.com/documentation/4.2/classNumberFormat.html)
ICU layout engine is removed since ICU 58, but PyICU still uses its header file and links to the library.
(#32 mentioned it but this looks like a different problem)
I tried to remove layout engine from the source code and it worked.
Hi,
So I'm having some troubles installing pyicu in my mac. I'm running the following command:
CFLAGS='-I/usr/local/opt/icu4c/include -I/opt/local/include' LDFLAGS=-L/usr/local/opt/icu4c/lib pip install pyicu
and it results in the error:
ld: library not found for -licule
Which library is this licule?
Just compiled and installed the most recent ICU (58 http://site.icu-project.org/download/58) on a Centos 5 machine and tried to compile the PyICU 1.9.3 from https://pypi.python.org/pypi/PyICU/ and also the master from GitHub. Same error for both:
[iccdb@web80 pyicu-master]$ python setup.py build
running build
running build_py
creating build
creating build/lib.linux-i686-2.7
copying icu.py -> build/lib.linux-i686-2.7
copying PyICU.py -> build/lib.linux-i686-2.7
copying docs.py -> build/lib.linux-i686-2.7
running build_ext
building '_icu' extension
creating build/temp.linux-i686-2.7
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python2.7 -c _icu.cpp -o build/temp.linux-i686-2.7/_icu.o -DPYICU_VER="1.9.3"
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
In file included from _icu.cpp:27:
common.h:102:28: error: unicode/udatpg.h: No such file or directory
common.h:103:30: error: unicode/dtptngen.h: No such file or directory
error: command 'gcc' failed with exit status 1
udatpg.h
and dtptngen.h
are in i18n/unicode/
down in the icu source, but they don't seem to make it into the make install
ed include directory (below)
For reference, this is python 2.7.12, with a local icu stuff in /home/me/lib
and /home/me/include
, which also went into the setup.py
.
Is there perhaps a less recent ICU that is known to work better?
I using pyicu-1.9.7. python 3.5.2 in ubuntu 16.04.2
>>> a="ผมชอบพูดไทยคำ English คำดี"
>>> a.replace(' ', '')
'ผมชอบพูดไทยคำEnglishคำดี'
>>> import PyICU
>>> bd = PyICU.BreakIterator.createWordInstance(PyICU.Locale("th"))
>>> bd.setText(a.replace(' ', ''))
>>> breaks = list(bd)
>>> result=[a[x[0]:x[1]] for x in zip([0]+breaks, breaks)]
>>> print(result)
['ผม', 'ชอบ', 'พูด', 'ไทย', 'คำ English คำ']
I lost word 'ดี'.
Not sure if I'm using this correctly:
from icu import MessageFormat
m = MessageFormat('Hello {name}!')
m.getFormats()
Gives me a segfault. I'm trying to get all parameters out of the string.
From the ICU docs I can see that getFormatNames
would fix my problem, but isn't implemented yet.
When trying to pip install the package I get:
$ pip install PyICU
Collecting PyICU
Using cached PyICU-1.9.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-vLooPA/PyICU/setup.py", line 11, in <module>
ICU_VERSION = subprocess.check_output(('icu-config', '--version')).strip()
File "/usr/lib/python2.7/subprocess.py", line 566, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vLooPA/PyICU/
My machine data is:
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty
Python 2.7.6
pip 9.0.1
I've been trying to develop a flask-icu version of flask-babel with pyicu, and it's been quite slow going because the API documentation is weak. The readme refers us to the documentation for ICU in general, but in many cases that API has been selectively implemented here, and the method argument profiles differ. A particularly confusing area is the documentation of how one might load message data into pyicu. So, in general, at least some sort of guidance about how to interpret the icu API for pyicu might be of great help.
After having finally figured out how to successfully build PyICU 1.9.8 with ICU 60.2 on OS X with Python 3.6.4,
building PyICU 2.0.2 again fails with the following error:
Complete output from command python setup.py egg_info:
Building PyICU 2.0.2 for ICU 60.2
Could not configure CXXFLAGS with icu-config
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/59/18ktbnzd1nq82_537cj3lmj40000gn/T/pip-build-ldpmxq8e/pyicu/setup.py", line 131, in <module>
_cflags, ('--cxxflags', '--cppflags'), 'CXXFLAGS')
File "/private/var/folders/59/18ktbnzd1nq82_537cj3lmj40000gn/T/pip-build-ldpmxq8e/pyicu/setup.py", line 30, in configure_with_icu_config
output = check_output(('icu-config',) + config_args).strip()
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 403, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'icu-config': 'icu-config'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/59/18ktbnzd1nq82_537cj3lmj40000gn/T/pip-build-ldpmxq8e/pyicu/
I would be grateful for any information how to get this working again.
If a UnicodeString object contains characters that are UTF16 surrogate pair (i.e u' \U000216d5') then direct conversion to unicode results in an invalid value. For example:
import icu
print unicode(icu.UnicodeString(u'\U000216d5'))
Results in: u'\ud845\uded5'
Which is wrong since the correct value should be u' \U000216d5'
You can also see that UnicodeString(unicode(icu.UnicodeString(u' \U000216d5')))
fails because of incorrect value.
A quick fix is to use explicit encoding like this:
unicode(icu.UnicodeString(u'\U000216d5').encode('utf8'), 'utf8')
I've encountered this problem on linux python 2.7 with PyICU 1.9.3 and ICU 57 and also with PyICU 1.8 and ICU 53.
this isn't an issue per-se; i was just curious whether you had any examples of how to do compact currency formatting. for instance, formatting 1234 US dollars as $1.2K.
a pointer to how to do something to that effect would be great @ovalhub. happy to chat offline/not in this issue as well
I am trying to build PyICU 1.9.3 (plus the fix for #19 ) using GNU Guix. I get the following test failure.
======================================================================
FAIL: testAddPattern (test.test_DateTimeParserGenerator.TestDateTimePatternGenerator)
Test overwriting a pattern with the same skeleton.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/guix-build-python-pyicu-1.9.3.drv-0/PyICU-1.9.3/test/test_DateTimeParserGenerator.py", line 47, in testAddPattern
self.assertEqual(sdf.format(self.date), '09 mai à 17:30')
AssertionError: '09 mai 17:30' != '09 mai à 17:30'
- 09 mai 17:30
+ 09 mai à 17:30
? ++
----------------------------------------------------------------------
Ran 37 tests in 0.637s
FAILED (failures=1)
I'm using python-3.4.3, icu4c-55.1, perl-5.22.1. Let me know what other information could help debug this.
I'm installing PyICU with pip in a Travis continuous build using Travis's Ubuntu "trusty" image, for which apt-get install libicu-dev installs ICU 52. The pip install of PyICU started failing today after the release of 2.0. Here is what I think is the relevant error message, taken from the full log:
In file included from measureunit.cpp:29:0:
measureunit.cpp: In function ‘int t_measure_init(t_measure*, PyObject*, PyObject*)’:
measureunit.cpp:1686:70: error: cannot allocate an object of abstract type ‘icu_52::Measure’
Formattable(d), (MeasureUnit *) unit->clone(), status));
^
macros.h:95:9: note: in definition of macro ‘INT_STATUS_CALL’
action; \
^
In file included from /usr/include/x86_64-linux-gnu/unicode/curramt.h:18:0,
from /usr/include/x86_64-linux-gnu/unicode/numfmt.h:39,
from /usr/include/x86_64-linux-gnu/unicode/datefmt.h:28,
from common.h:114,
from measureunit.cpp:24:
/usr/include/x86_64-linux-gnu/unicode/measure.h:45:18: note: because the following virtual functions are pure within ‘icu_52::Measure’:
class U_I18N_API Measure: public UObject {
^
/usr/include/x86_64-linux-gnu/unicode/measure.h:77:22: note: virtual icu_52::UObject* icu_52::Measure::clone() const
virtual UObject* clone() const = 0;
^
In other words, new Measure(...) is not possible because icu_52::Measure is abstract, since its clone() method is pure virtual.
In ICU 52-1 Measure::clone() was pure virtual. But starting from ICU 53-1 Measure::clone() lost its purity.
This was never an issue with PyICU < 2. Any plans to support ICU 52 for PyICU?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.