Issue2345

classification
Title: Installing pip fails if JYTHON_HOME set and points to old installation
Type: behaviour Severity: normal
Components: Installer Versions: Jython 2.7
Milestone: Jython 2.7.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jeff.allen Nosy List: jeff.allen, pekka.klarck, zyasoft
Priority: normal Keywords:

Created on 2015-04-26.20:04:56 by pekka.klarck, last changed 2019-09-01.14:11:13 by jeff.allen.

Messages
msg9973 (view) Author: Pekka Klärck (pekka.klarck) Date: 2015-04-26.20:04:56
I installed 2.7 rc3 on Windows where I had JYTHON_HOME set so that it pointed to old beta4 installation. After installation finished, I noticed this on the command prompt:

    Try running this script from the 'bin' directory of an installed Jython or setting %JYTHON_HOME.
    usage: jython [option] ... [-c cmd | -m mod | file | -] [arg] ...
    Try `jython -h' for more information.

My guess is that installer tried to use installed Jython for running ensurepip. At least pip wasn't installed correctly:

    C:\>jython -m pip
    Traceback (most recent call last):
      File "C:\jython2.7rc3\Lib\runpy.py", line 151, in _run_module_as_main
        mod_name, loader, code, fname = _get_module_details(mod_name)
      File "C:\jython2.7rc3\Lib\runpy.py", line 151, in _run_module_as_main
        mod_name, loader, code, fname = _get_module_details(mod_name)
      File "C:\jython2.7rc3\Lib\runpy.py", line 104, in _get_module_details
        if loader.is_package(mod_name):
    AttributeError: 'org.python.core.JavaImporter' object has no attribute 'is_package'

Not sure was something else broken. Fixed the problem by unsetting JYTHON_HOME and reinstalling Jython.
msg9978 (view) Author: Jim Baker (zyasoft) Date: 2015-04-27.01:51:59
This should be documented in release notes. Spurious or incorrect environment variable settings are always going to be tough to deal with.

One possibility is for the installer to analyze such settings, if any.
msg12592 (view) Author: Jeff Allen (jeff.allen) Date: 2019-07-20.15:18:20
It is documented in the README, but that's not very helpful as it comes out after the failure. I think I see where this happens and propose simply to eliminate JAVA_HOME from the environment that runs "jython -m ensurepip".
msg12596 (view) Author: Jeff Allen (jeff.allen) Date: 2019-07-21.05:40:07
Yes, that seems to do the trick. Fixed at: https://hg.python.org/jython/rev/6e1f58fc7445
msg12608 (view) Author: Pekka Klärck (pekka.klarck) Date: 2019-07-22.20:35:17
Awesome! Great to see an old issue fixed!
History
Date User Action Args
2019-09-01 14:11:13jeff.allensetstatus: pending -> closed
2019-07-22 20:35:17pekka.klarcksetmessages: + msg12608
2019-07-21 05:40:07jeff.allensetstatus: open -> pending
resolution: accepted -> fixed
messages: + msg12596
2019-07-20 15:18:20jeff.allensetpriority: normal
assignee: jeff.allen
type: behaviour
components: + Installer
milestone: Jython 2.7.2
nosy: + jeff.allen
messages: + msg12592
resolution: accepted
2015-04-27 01:51:59zyasoftsetnosy: + zyasoft
messages: + msg9978
2015-04-26 20:04:56pekka.klarckcreate