[ 
https://issues.apache.org/jira/browse/PYLUCENE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xiang Zhang updated PYLUCENE-43:
--------------------------------
    Description: 
*Environment I'm Using*:
 * ubuntu 16.04
 * cleanly installed python 2.7.15 built with latest pyenv
 * Setuptools 40.4.1
 * pip 18.0
 * pylucene-7.4.0.tar.gz
 * jdk 1.8.0_181
 * ant 1.10. 5

*Phenomenon*

Step1. build jcc

In JCC's setup.py file, with_modern_setuptools is False by checking if 
pkg_resource.SetuptoolsVersions is available.

According to [setuptools 
developer|https://github.com/pypa/setuptools/issues/1310], this is not 
documented and is already removed, causing jcc not built with shared mode 
consequently but no error or warning is prompted.

Step2. build pylucene

The final error comes with the following line:
{code:java}
python -m jcc --shared --jar 
lucene-java-7.4.0/lucene/build/core/lucene-core-7.4.0.jar --jar 
....(omitted).....  --version 7.4.0 --module python/collections.py --module 
python/ICUNormalizer2Filter.py --module python/ICUFoldingFilter.py --module 
python/ICUTransformFilter.py  --files 8 --build

....(lots of warning omitted).....

Traceback (most recent call last):
  File "/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/runpy.py", line 174, in 
_run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/runpy.py", line 72, in 
_run_code
    exec code in run_globals
  File 
"/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/site-packages/JCC-3.2-py2.7-linux-x86_64.egg/jcc/__main__.py",
 line 107, in <module>
    cpp.jcc(sys.argv)
  File 
"/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/site-packages/JCC-3.2-py2.7-linux-x86_64.egg/jcc/cpp.py",
 line 736, in jcc
    egg_info, extra_setup_args)
  File 
"/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/site-packages/JCC-3.2-py2.7-linux-x86_64.egg/jcc/python.py",
 line 1606, in compile
    raise NotImplementedError, "JCC was not built with --shared mode support, 
see JCC's INSTALL file for more information"
NotImplementedError: JCC was not built with --shared mode support, see JCC's 
INSTALL file for more information
Makefile:349: recipe for target 'compile' failed
make: *** [compile] Error 1
{code}
It was hard to debug given that "JCC is not built with shared mode", actually I 
indeed got a _jcc.so library in the build directory.

*Quick Fix for Me*

As long as I believe the setuptools package has enough high version, I force 
the with_modern_setuptools switch to be True as the following(at line 210 in 
JCC's setup.py):
{code:java}
...
    try:
        from pkg_resources import SetuptoolsVersion
        with_modern_setuptools = True
    except ImportError:
        with_modern_setuptools = False

    enable_shared = False
    with_modern_setuptools = True
    if with_modern_setuptools and 'NO_SHARED' not in os.environ:
....
{code}
i.e., the helpers for linux are still useful

then rebuilt JCC, remove the existing one and reinstall, then continue to make 
pylucene, all things work now.

  was:
*Environment I'm Using*:
 * ubuntu 16.04
 * cleanly installed python 2.7.15 built with latest pyenv
 * Setuptools 40.4.1
 * pip 18.0
 * pylucene-7.4.0.tar.gz

*Phenomenon*

Step1. build jcc

In JCC's setup.py file, with_modern_setuptools is False by checking if 
pkg_resource.SetuptoolsVersions is available.

According to [setuptools 
developer|https://github.com/pypa/setuptools/issues/1310], this is not 
documented and is already removed, causing jcc not build with shared mode 
consequently but no error or warning is prompted.

Step2. build pylucene

The final error comes with the following line:
{code}
python -m jcc --shared --jar 
lucene-java-7.4.0/lucene/build/core/lucene-core-7.4.0.jar --jar 
....(omitted).....  --version 7.4.0 --module python/collections.py --module 
python/ICUNormalizer2Filter.py --module python/ICUFoldingFilter.py --module 
python/ICUTransformFilter.py  --files 8 --build

....(lots of warning omitted).....

Traceback (most recent call last):
  File "/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/runpy.py", line 174, in 
_run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/runpy.py", line 72, in 
_run_code
    exec code in run_globals
  File 
"/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/site-packages/JCC-3.2-py2.7-linux-x86_64.egg/jcc/__main__.py",
 line 107, in <module>
    cpp.jcc(sys.argv)
  File 
"/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/site-packages/JCC-3.2-py2.7-linux-x86_64.egg/jcc/cpp.py",
 line 736, in jcc
    egg_info, extra_setup_args)
  File 
"/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/site-packages/JCC-3.2-py2.7-linux-x86_64.egg/jcc/python.py",
 line 1606, in compile
    raise NotImplementedError, "JCC was not built with --shared mode support, 
see JCC's INSTALL file for more information"
NotImplementedError: JCC was not built with --shared mode support, see JCC's 
INSTALL file for more information
Makefile:349: recipe for target 'compile' failed
make: *** [compile] Error 1
{code}
It was hard to debug given that "JCC is not built with shared mode", actually I 
indeed got a _jcc.so library in the build directory.

*Quick Fix for Me*

As long as I believe the setuptools package has enough high version, I force 
the with_modern_setuptools switch to be True as the following(at line 210 in 
JCC's setup.py):
{code}
...
    try:
        from pkg_resources import SetuptoolsVersion
        with_modern_setuptools = True
    except ImportError:
        with_modern_setuptools = False

    enable_shared = False
    with_modern_setuptools = True
    if with_modern_setuptools and 'NO_SHARED' not in os.environ:
....
{code}
i.e., the helpers for linux are still useful

then rebuilt JCC, remove the existing one and reinstall, then continue to make 
pylucene, all things work now.


> Failed to build PyLucene after the removal of SetuptoolsVersion in setuptools
> -----------------------------------------------------------------------------
>
>                 Key: PYLUCENE-43
>                 URL: https://issues.apache.org/jira/browse/PYLUCENE-43
>             Project: PyLucene
>          Issue Type: Bug
>            Reporter: Xiang Zhang
>            Priority: Major
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> *Environment I'm Using*:
>  * ubuntu 16.04
>  * cleanly installed python 2.7.15 built with latest pyenv
>  * Setuptools 40.4.1
>  * pip 18.0
>  * pylucene-7.4.0.tar.gz
>  * jdk 1.8.0_181
>  * ant 1.10. 5
> *Phenomenon*
> Step1. build jcc
> In JCC's setup.py file, with_modern_setuptools is False by checking if 
> pkg_resource.SetuptoolsVersions is available.
> According to [setuptools 
> developer|https://github.com/pypa/setuptools/issues/1310], this is not 
> documented and is already removed, causing jcc not built with shared mode 
> consequently but no error or warning is prompted.
> Step2. build pylucene
> The final error comes with the following line:
> {code:java}
> python -m jcc --shared --jar 
> lucene-java-7.4.0/lucene/build/core/lucene-core-7.4.0.jar --jar 
> ....(omitted).....  --version 7.4.0 --module python/collections.py --module 
> python/ICUNormalizer2Filter.py --module python/ICUFoldingFilter.py --module 
> python/ICUTransformFilter.py  --files 8 --build
> ....(lots of warning omitted).....
> Traceback (most recent call last):
>   File "/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/runpy.py", line 174, 
> in _run_module_as_main
>     "__main__", fname, loader, pkg_name)
>   File "/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/runpy.py", line 72, 
> in _run_code
>     exec code in run_globals
>   File 
> "/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/site-packages/JCC-3.2-py2.7-linux-x86_64.egg/jcc/__main__.py",
>  line 107, in <module>
>     cpp.jcc(sys.argv)
>   File 
> "/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/site-packages/JCC-3.2-py2.7-linux-x86_64.egg/jcc/cpp.py",
>  line 736, in jcc
>     egg_info, extra_setup_args)
>   File 
> "/home/hesz/.pyenv/versions/2.7.15/lib/python2.7/site-packages/JCC-3.2-py2.7-linux-x86_64.egg/jcc/python.py",
>  line 1606, in compile
>     raise NotImplementedError, "JCC was not built with --shared mode support, 
> see JCC's INSTALL file for more information"
> NotImplementedError: JCC was not built with --shared mode support, see JCC's 
> INSTALL file for more information
> Makefile:349: recipe for target 'compile' failed
> make: *** [compile] Error 1
> {code}
> It was hard to debug given that "JCC is not built with shared mode", actually 
> I indeed got a _jcc.so library in the build directory.
> *Quick Fix for Me*
> As long as I believe the setuptools package has enough high version, I force 
> the with_modern_setuptools switch to be True as the following(at line 210 in 
> JCC's setup.py):
> {code:java}
> ...
>     try:
>         from pkg_resources import SetuptoolsVersion
>         with_modern_setuptools = True
>     except ImportError:
>         with_modern_setuptools = False
>     enable_shared = False
>     with_modern_setuptools = True
>     if with_modern_setuptools and 'NO_SHARED' not in os.environ:
> ....
> {code}
> i.e., the helpers for linux are still useful
> then rebuilt JCC, remove the existing one and reinstall, then continue to 
> make pylucene, all things work now.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to