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 <k...@orbiteam.de>
Reply-to: pylucene-dev@lucene.apache.org
Címzett: pylucene developers <pylucene-dev@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 <mar...@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

Reply via email to