pyenv-virtualenv icon indicating copy to clipboard operation
pyenv-virtualenv copied to clipboard

problem when using jython

Open ghost opened this issue 7 years ago • 4 comments

[/U/x]$ pyenv versions
  system
* 2.7.12 (set by /Users/x/.python-version)
  3.4.5
  3.5.2
  3.6.1
  jython-2.7.0
[/U/x]$ pyenv virtualenv jython-2.7.0 test-env
/Users/x/.pyenv/versions/jython-2.7.0/bin/pip: line 4: import: command not found
/Users/x/.pyenv/versions/jython-2.7.0/bin/pip: line 5: import: command not found
from: can't read /var/mail/pip
/Users/x/.pyenv/versions/jython-2.7.0/bin/pip: line 10: syntax error near unexpected token `('
/Users/x/.pyenv/versions/jython-2.7.0/bin/pip: line 10: `    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])'

the content of /Users/x/.pyenv/versions/jython-2.7.0/bin/pip is :

#!/Users/x/.pyenv/versions/jython-2.7.0/bin/jython

# -*- coding: utf-8 -*-
import re
import sys

from pip import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

first lines of content of file /Users/x/.pyenv/versions/jython-2.7.0/bin/jython is

#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# jython.sh - start script for Jython (adapted from jruby.sh)
#
# Environment variables (optional)
#
#   JAVA_HOME      Java installation directory
#
#   JYTHON_HOME    Jython installation directory
#
#   JYTHON_OPTS    Default Jython command line arguments
#
# -----------------------------------------------------------------------------

cygwin=false

...

ghost avatar Jun 06 '17 04:06 ghost

creating a virtualenv using python (not jython) like this: pyenv virtualenv 2.7.12 test is OK and gives me no error

ghost avatar Jun 06 '17 04:06 ghost

When running directly virtualenv ...

[x@Mac /Users/x]$ virtualenv -p ~/.pyenv/versions/jython-2.7.0/bin/jython yoshi
Running virtualenv with interpreter /Users/x/.pyenv/versions/jython-2.7.0/bin/jython
Cannot find file /Users/x/.pyenv/versions/jython-2.7.0/Include (bad symlink)
New jython executable in /Users/x/yoshi/bin/jython
Installing setuptools, pip, wheel...done.

ghost avatar Jun 06 '17 04:06 ghost

I am having an issue with this too.

pyenv virtualenv jython-2.7.1 multibeam-ingest-jython-2.7.1
/Users/cslater/.pyenv/versions/jython-2.7.1/bin/pip: line 4: import: command not found
/Users/cslater/.pyenv/versions/jython-2.7.1/bin/pip: line 5: import: command not found
from: can't read /var/mail/pip
/Users/cslater/.pyenv/versions/jython-2.7.1/bin/pip: line 10: syntax error near unexpected token `('
/Users/cslater/.pyenv/versions/jython-2.7.1/bin/pip: line 10: `    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])'

electricsam avatar Jul 24 '20 16:07 electricsam

I managed to get a little further by upgrading pip. But creation of the virtualenv was still not successful.

pyenv local jython-2.7.1
jython -m pip install --upgrade pip
pyenv virtualenv jython-2.7.1 multibeam-ingest-jython-2.7.1
/Users/cslater/.pyenv/versions/jython-2.7.1/Lib/site-packages/filelock.py:451: UserWarning: only soft file lock is available
  warnings.warn("only soft file lock is available")
RuntimeError: No virtualenv implementation for PythonInfo(spec=Jython2.7.1.final.0-32, exe=/Users/cslater/.pyenv/versions/jython-2.7.1/bin/jython, platform=java1.8.0_202, version=u'2.7.1 (default:0df7adb1b397, Jun 30 2017, 19:02:43) \n[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)]', encoding_fs_io=utf-8-UTF-8)
Installing pip from https://bootstrap.pypa.io/get-pip.py...
pyenv: python: command not found

The `python' command exists in these Python versions:
  2.7.18
  2.7.18/envs/cruise-schema-orm-2.7.18
  cruise-schema-orm-2.7.18
  jython-2.7.1

Note: See 'pyenv help global' for tips on allowing both
      python2 and python3 to be found.
error: failed to install pip via get-pip.py

electricsam avatar Jul 24 '20 17:07 electricsam

WFM with Jython 2.7.3

native-api avatar Apr 13 '24 10:04 native-api