You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by Márk Csaba <ma...@gwyll.eu> on 2014/10/22 20:22:20 UTC

Install two version of lucene.

Hello,

I'm trying to install 4.9.0 and 4.10.1 to the same python, but pip list shows only the last one.
How can I install lucene from source not to overwrite or deregister the previous one?

Thanks,
Csaba

Re: Install two version of lucene.

Posted by Andi Vajda <va...@apache.org>.
> On Oct 22, 2014, at 20:22, Márk Csaba <ma...@gwyll.eu> wrote:
> 
> Hello,
> 
> I'm trying to install 4.9.0 and 4.10.1 to the same python, but pip list shows only the last one.
> How can I install lucene from source not to overwrite or deregister the previous one?

Create python virtualenv setups. This allows you to 'fork' a python installation and then install different versions of whatever you like in each, but sharing the stuff installed in the original installation.

Andi..

> 
> Thanks,
> Csaba

Re: Install two version of lucene.

Posted by Andi Vajda <va...@apache.org>.
> On Oct 22, 2014, at 23:59, Márk Csaba <ma...@gwyll.eu> wrote:
> 
> Hello Thomas,
> 
> thanks for the suggestion.
> Out developers would like to use different versions with pkg_resources
> switched from code, not from virtualenv.
> I've modified the easy_install.pth but adding both version lead me to
> VersionConflict error.
> 
> The solution was to remove all pylucene line from easy_install.pth.

In python

 >>> import lucene
 >>> lucene.VERSION

Andi..

> 
> Now pkg_resources.require("lucene==4.9.0") and
> pkg_resources.require("lucene==4.10.1") runs smooth.
> 
> Can you provide me a lucene command to check the version of the loaded
> lucene?
> 
> Many thanks, 
> Csaba
> 
> -----Eredeti üzenet-----
> Feladó: Thomas Koch <ko...@orbiteam.de>
> Reply-to: pylucene-dev@lucene.apache.org
> Címzett: pylucene developers <py...@lucene.apache.org>
> Tárgy: Re: Install two version of lucene.
> Dátum: Wed, 22 Oct 2014 21:27:33 +0200
> 
> 
> Hi Caba,
> 
> you probably have both ‚installed‘ - i.e. both versions are copied into your global python’s site-packages directory, but only one is enabled by the installer (pip or easy-install). The ‚active‘ packages are added to the python sys.path - this is typically done in a file ‚easy-install.pth‘ in the site-packages directory - e.g.
> 
> /Library/Python/2.7/site-packages/easy-install.pth 
> 
> 
> You may manually edit the file if you want to switch between different versions. Alternatively (and recommended) you should give virtualenv a try - this allows you to separate different python libraries from you global python installation:
> 
> http://virtualenv.readthedocs.org/en/latest/
> 
> That way you can for example … (assume I’ve created a virtualenv called ‚pylucene48‘ before and installed PyLucene 4.8.x into this env.)
> 
> $ workon pylucene48
> (pylucene48)$ python
> Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import lucene
>>>> lucene.VERSION
> '4.8.0'
> 
> The 'trick' of virtualenv is to create a local 'site-package' scope:
> 
>>>> import sys
>>>> sys.path
> ['', '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg', 
>     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages/JCC-2.19-py2.7-macosx-10.9-intel.egg',
>     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages/lucene-4.8.0-py2.7-macosx-10.9-intel.egg',
>     '/Users/koch/.virtualenvs/pylucene48/lib/python27.zip', 
>     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7',
>     ...
>     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages']
> 
> 
> You can easily create new environments:
> 
> $ mkvirtualenv pylucene49
> (pylucene49) $ pip install …
> 
> 
> Hope this helps,
> 
> Thomas
> --
>> Am 22.10.2014 um 20:22 schrieb Márk Csaba <ma...@gwyll.eu>:
>> 
>> Hello,
>> 
>> I'm trying to install 4.9.0 and 4.10.1 to the same python, but pip list shows only the last one.
>> How can I install lucene from source not to overwrite or deregister the previous one?
>> 
>> Thanks,
>> Csaba
> 

Re: Install two version of lucene.

Posted by Márk Csaba <ma...@gwyll.eu>.
Not in runtime. It is much simplier to change a pkg_resources.require
line and restart app than changing between virtualenvs.

Thank you very much for your help!

Regards,
Csaba



This is living dangerously. Once you have pylucene and jcc loaded into the python VM with their shared libraries, you can't switch versions. Software that attempts a switch may silently fail and mixing incompatible versions (anything really: versions python, lucene, jcc, java) can cause crashes.

Andi..



Re: Install two version of lucene.

Posted by Andi Vajda <va...@apache.org>.
> On Oct 22, 2014, at 23:59, Márk Csaba <ma...@gwyll.eu> wrote:
> 
> Hello Thomas,
> 
> thanks for the suggestion.
> Out developers would like to use different versions with pkg_resources
> switched from code, not from virtualenv.
> I've modified the easy_install.pth but adding both version lead me to
> VersionConflict error.
> 
> The solution was to remove all pylucene line from easy_install.pth.
> 
> Now pkg_resources.require("lucene==4.9.0") and
> pkg_resources.require("lucene==4.10.1") runs smooth.

This is living dangerously. Once you have pylucene and jcc loaded into the python VM with their shared libraries, you can't switch versions. Software that attempts a switch may silently fail and mixing incompatible versions (anything really: versions python, lucene, jcc, java) can cause crashes.

Andi..

> 
> Can you provide me a lucene command to check the version of the loaded
> lucene?
> 
> Many thanks, 
> Csaba
> 
> -----Eredeti üzenet-----
> Feladó: Thomas Koch <ko...@orbiteam.de>
> Reply-to: pylucene-dev@lucene.apache.org
> Címzett: pylucene developers <py...@lucene.apache.org>
> Tárgy: Re: Install two version of lucene.
> Dátum: Wed, 22 Oct 2014 21:27:33 +0200
> 
> 
> Hi Caba,
> 
> you probably have both ‚installed‘ - i.e. both versions are copied into your global python’s site-packages directory, but only one is enabled by the installer (pip or easy-install). The ‚active‘ packages are added to the python sys.path - this is typically done in a file ‚easy-install.pth‘ in the site-packages directory - e.g.
> 
> /Library/Python/2.7/site-packages/easy-install.pth 
> 
> 
> You may manually edit the file if you want to switch between different versions. Alternatively (and recommended) you should give virtualenv a try - this allows you to separate different python libraries from you global python installation:
> 
> http://virtualenv.readthedocs.org/en/latest/
> 
> That way you can for example … (assume I’ve created a virtualenv called ‚pylucene48‘ before and installed PyLucene 4.8.x into this env.)
> 
> $ workon pylucene48
> (pylucene48)$ python
> Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import lucene
>>>> lucene.VERSION
> '4.8.0'
> 
> The 'trick' of virtualenv is to create a local 'site-package' scope:
> 
>>>> import sys
>>>> sys.path
> ['', '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg', 
>     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages/JCC-2.19-py2.7-macosx-10.9-intel.egg',
>     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages/lucene-4.8.0-py2.7-macosx-10.9-intel.egg',
>     '/Users/koch/.virtualenvs/pylucene48/lib/python27.zip', 
>     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7',
>     ...
>     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages']
> 
> 
> You can easily create new environments:
> 
> $ mkvirtualenv pylucene49
> (pylucene49) $ pip install …
> 
> 
> Hope this helps,
> 
> Thomas
> --
>> Am 22.10.2014 um 20:22 schrieb Márk Csaba <ma...@gwyll.eu>:
>> 
>> Hello,
>> 
>> I'm trying to install 4.9.0 and 4.10.1 to the same python, but pip list shows only the last one.
>> How can I install lucene from source not to overwrite or deregister the previous one?
>> 
>> Thanks,
>> Csaba
> 

Re: Install two version of lucene.

Posted by Márk Csaba <ma...@gwyll.eu>.
Hello Thomas,

thanks for the suggestion.
Out developers would like to use different versions with pkg_resources
switched from code, not from virtualenv.
I've modified the easy_install.pth but adding both version lead me to
VersionConflict error.

The solution was to remove all pylucene line from easy_install.pth.

Now pkg_resources.require("lucene==4.9.0") and
pkg_resources.require("lucene==4.10.1") runs smooth.

Can you provide me a lucene command to check the version of the loaded
lucene?

Many thanks, 
Csaba

-----Eredeti üzenet-----
Feladó: Thomas Koch <ko...@orbiteam.de>
Reply-to: pylucene-dev@lucene.apache.org
Címzett: pylucene developers <py...@lucene.apache.org>
Tárgy: Re: Install two version of lucene.
Dátum: Wed, 22 Oct 2014 21:27:33 +0200


Hi Caba,

you probably have both ‚installed‘ - i.e. both versions are copied into your global python’s site-packages directory, but only one is enabled by the installer (pip or easy-install). The ‚active‘ packages are added to the python sys.path - this is typically done in a file ‚easy-install.pth‘ in the site-packages directory - e.g.

/Library/Python/2.7/site-packages/easy-install.pth 


You may manually edit the file if you want to switch between different versions. Alternatively (and recommended) you should give virtualenv a try - this allows you to separate different python libraries from you global python installation:

http://virtualenv.readthedocs.org/en/latest/

That way you can for example … (assume I’ve created a virtualenv called ‚pylucene48‘ before and installed PyLucene 4.8.x into this env.)

$ workon pylucene48
(pylucene48)$ python
Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
Type "help", "copyright", "credits" or "license" for more information.
>>> import lucene
>>> lucene.VERSION
'4.8.0'

The 'trick' of virtualenv is to create a local 'site-package' scope:

>>> import sys
>>> sys.path
['', '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg', 
     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages/JCC-2.19-py2.7-macosx-10.9-intel.egg',
     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages/lucene-4.8.0-py2.7-macosx-10.9-intel.egg',
     '/Users/koch/.virtualenvs/pylucene48/lib/python27.zip', 
     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7',
     ...
     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages']


You can easily create new environments:

$ mkvirtualenv pylucene49
(pylucene49) $ pip install …


Hope this helps,

Thomas
--
Am 22.10.2014 um 20:22 schrieb Márk Csaba <ma...@gwyll.eu>:

> Hello,
> 
> I'm trying to install 4.9.0 and 4.10.1 to the same python, but pip list shows only the last one.
> How can I install lucene from source not to overwrite or deregister the previous one?
> 
> Thanks,
> Csaba


Re: Install two version of lucene.

Posted by Thomas Koch <ko...@orbiteam.de>.
Hi Caba,

you probably have both ‚installed‘ - i.e. both versions are copied into your global python’s site-packages directory, but only one is enabled by the installer (pip or easy-install). The ‚active‘ packages are added to the python sys.path - this is typically done in a file ‚easy-install.pth‘ in the site-packages directory - e.g.

/Library/Python/2.7/site-packages/easy-install.pth 


You may manually edit the file if you want to switch between different versions. Alternatively (and recommended) you should give virtualenv a try - this allows you to separate different python libraries from you global python installation:

http://virtualenv.readthedocs.org/en/latest/

That way you can for example … (assume I’ve created a virtualenv called ‚pylucene48‘ before and installed PyLucene 4.8.x into this env.)

$ workon pylucene48
(pylucene48)$ python
Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
Type "help", "copyright", "credits" or "license" for more information.
>>> import lucene
>>> lucene.VERSION
'4.8.0'

The 'trick' of virtualenv is to create a local 'site-package' scope:

>>> import sys
>>> sys.path
['', '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg', 
     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages/JCC-2.19-py2.7-macosx-10.9-intel.egg',
     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages/lucene-4.8.0-py2.7-macosx-10.9-intel.egg',
     '/Users/koch/.virtualenvs/pylucene48/lib/python27.zip', 
     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7',
     ...
     '/Users/koch/.virtualenvs/pylucene48/lib/python2.7/site-packages']


You can easily create new environments:

$ mkvirtualenv pylucene49
(pylucene49) $ pip install …


Hope this helps,

Thomas
--
Am 22.10.2014 um 20:22 schrieb Márk Csaba <ma...@gwyll.eu>:

> Hello,
> 
> I'm trying to install 4.9.0 and 4.10.1 to the same python, but pip list shows only the last one.
> How can I install lucene from source not to overwrite or deregister the previous one?
> 
> Thanks,
> Csaba