Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing Jython 2.7.1 has issues installing pip on ARM #5

Closed
J-u-n-o opened this issue Sep 3, 2018 · 7 comments
Closed

Installing Jython 2.7.1 has issues installing pip on ARM #5

J-u-n-o opened this issue Sep 3, 2018 · 7 comments

Comments

@J-u-n-o
Copy link

J-u-n-o commented Sep 3, 2018

Installing 2.7.1 on rasbian results in error on setuptools.
I initially installed using sudo java ...
Subsequently changed /usr/share/jython owner and group to current user and ran without sudo:

:/usr/share/jython $ java -jar ../openhab2/jython-installer-2.7.1.jar --console
Welcome to Jython !
You are about to install Jython version 2.7.1
(at any time, answer c to cancel the installation)
For the installation process, the following languages are available: English, German
Please select your language [E/g] >>>
Do you want to read the license agreement now ? [y/N] >>>
Do you accept the license agreement ? [Y/n] >>>
The following installation types are available:
  1. All (everything, including sources)
  2. Standard (core, library modules, demos and examples, documentation)
  3. Minimum (core)
  9. Standalone (a single, executable .jar)
Please select the installation type [ 1 /2/3/9] >>>
Do you want to exclude parts from the installation ? [y/N] >>>
Please enter the target directory >>> /usr/share/jython
Directory /usr/share/jython is not empty - ok to overwrite contents ? [y/N] >>> y
Contents of directory /usr/share/jython will be deleted now! Are you sure to proceed ? [Y/n] >>>
Your java version to start Jython is: Azul Systems, Inc. / 1.8.0_152
Your operating system version is: Linux / 4.14.52-v7+
Summary:
  - mod: true
  - demo: true
  - doc: true
  - src: true
  - ensurepip: true
  - JRE: /usr/lib/jvm/zulu-embedded-8-armhf/jre
Please confirm copying of files to directory /usr/share/jython [Y/n] >>>
 10 %
 20 %
 30 %
 40 %
 50 %
 60 %
 70 %
 80 %
Generating start scripts ...
Installing pip and setuptools
 90 %
Collecting setuptools
Exception:
Traceback (most recent call last):
  File "/tmp/tmpJ9EEoh/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/tmp/tmpJ9EEoh/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/tmp/tmpJ9EEoh/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/tmp/tmpJ9EEoh/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 376, in prepare_files
    discovered_reqs.extend(self._prepare_file(
  File "/tmp/tmpJ9EEoh/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 376, in prepare_files
    discovered_reqs.extend(self._prepare_file(
  File "/tmp/tmpJ9EEoh/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 617, in _prepare_file
    unpack_url(
  File "/tmp/tmpJ9EEoh/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 617, in _prepare_file
    unpack_url(
  File "/tmp/tmpJ9EEoh/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 809, in unpack_url
    unpack_file_url(link, location, download_dir, hashes=hashes)
  File "/tmp/tmpJ9EEoh/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 715, in unpack_file_url
    unpack_file(from_path, location, content_type, link)
  File "/tmp/tmpJ9EEoh/pip-9.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 596, in unpack_file
    unzip_file(
  File "/tmp/tmpJ9EEoh/pip-9.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 498, in unzip_file
    ensure_dir(dir)
  File "/tmp/tmpJ9EEoh/pip-9.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/share/jython/Lib/os.py", line 174, in makedirs
    mkdir(name, mode)
OSError: [Errno 20000] Unknown error: 20000: '/tmp/pip-build-QWhVMF/setuptools'
 100 %

Also

/usr/share/jython $ ./bin/jython  -m ensurepip
Collecting setuptools
Exception:
Traceback (most recent call last):
  File "/tmp/tmponzBlX/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/tmp/tmponzBlX/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/tmp/tmponzBlX/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/tmp/tmponzBlX/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 376, in prepare_files
    discovered_reqs.extend(self._prepare_file(
  File "/tmp/tmponzBlX/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 376, in prepare_files
    discovered_reqs.extend(self._prepare_file(
  File "/tmp/tmponzBlX/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 617, in _prepare_file
    unpack_url(
  File "/tmp/tmponzBlX/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 617, in _prepare_file
    unpack_url(
  File "/tmp/tmponzBlX/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 809, in unpack_url
    unpack_file_url(link, location, download_dir, hashes=hashes)
  File "/tmp/tmponzBlX/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 715, in unpack_file_url
    unpack_file(from_path, location, content_type, link)
  File "/tmp/tmponzBlX/pip-9.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 596, in unpack_file
    unzip_file(
  File "/tmp/tmponzBlX/pip-9.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 498, in unzip_file
    ensure_dir(dir)
  File "/tmp/tmponzBlX/pip-9.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/share/jython/Lib/os.py", line 174, in makedirs
    mkdir(name, mode)
OSError: [Errno 20000] Unknown error: 20000: '/tmp/pip-build-wzPV2x/setuptools'
@J-u-n-o
Copy link
Author

J-u-n-o commented Sep 3, 2018

Simular for 2.7.0:

/usr/share/jython $ java -jar ../openhab2/jython-installer-2.7.0.jar --console
Welcome to Jython !
You are about to install Jython version 2.7.0
(at any time, answer c to cancel the installation)
For the installation process, the following languages are available: English, German
Please select your language [E/g] >>>
Do you want to read the license agreement now ? [y/N] >>>
Do you accept the license agreement ? [Y/n] >>>
The following installation types are available:
  1. All (everything, including sources)
  2. Standard (core, library modules, demos and examples, documentation)
  3. Minimum (core)
  9. Standalone (a single, executable .jar)
Please select the installation type [ 1 /2/3/9] >>>
Do you want to exclude parts from the installation ? [y/N] >>>
Please enter the target directory >>> /usr/share/jython
Directory /usr/share/jython is not empty - ok to overwrite contents ? [y/N] >>> y
Contents of directory /usr/share/jython will be deleted now! Are you sure to proceed ? [Y/n] >>>
Your java version to start Jython is: Azul Systems, Inc. / 1.8.0_152
Your operating system version is: Linux / 4.14.52-v7+
Summary:
  - mod: true
  - demo: true
  - doc: true
  - src: true
  - ensurepip: true
  - JRE: /usr/lib/jvm/zulu-embedded-8-armhf/jre
Please confirm copying of files to directory /usr/share/jython [Y/n] >>>
 10 %
 20 %
 30 %
 40 %
 50 %
 60 %
 70 %
 80 %
Generating start scripts ...
Installing pip and setuptools
 90 %
Traceback (most recent call last):
  File "/usr/share/jython/Lib/runpy.py", line 161, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/share/jython/Lib/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/share/jython/Lib/ensurepip/__main__.py", line 4, in <module>
    ensurepip._main()
  File "/usr/share/jython/Lib/ensurepip/__init__.py", line 220, in _main
    bootstrap(
  File "/usr/share/jython/Lib/ensurepip/__init__.py", line 123, in bootstrap
    _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/usr/share/jython/Lib/ensurepip/__init__.py", line 45, in _run_pip
    import pip
  File "/tmp/tmpSInCQo/pip-1.6-py2.py3-none-any.whl/pip/__init__.py", line 10, in <module>
  File "/tmp/tmpSInCQo/pip-1.6-py2.py3-none-any.whl/pip/util.py", line 17, in <module>
  File "/tmp/tmpSInCQo/pip-1.6-py2.py3-none-any.whl/pip/locations.py", line 109, in <module>
  File "/tmp/tmpSInCQo/pip-1.6-py2.py3-none-any.whl/pip/locations.py", line 71, in _get_build_prefix
  File "/tmp/tmpSInCQo/pip-1.6-py2.py3-none-any.whl/pip/locations.py", line 66, in __get_username
  File "/usr/share/jython/Lib/pwd.py", line 60, in getpwuid
    return struct_passwd(entry)
  File "/usr/share/jython/Lib/pwd.py", line 36, in __new__
    pwd = (newStringOrUnicode(pwd.loginName), newStringOrUnicode(pwd.password), int(pwd.UID),
NotImplementedError: passwd.pw_passwd unimplemented
 100 %
Do you want to show the contents of README ? [y/N] >>>
Congratulations! You successfully installed Jython 2.7.0 to directory /usr/share/jython.

and

:/usr/share/jython $ ./bin/jython -m ensurepip
Traceback (most recent call last):
  File "/usr/share/jython/Lib/runpy.py", line 161, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/share/jython/Lib/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/share/jython/Lib/ensurepip/__main__.py", line 4, in <module>
    ensurepip._main()
  File "/usr/share/jython/Lib/ensurepip/__init__.py", line 220, in _main
    bootstrap(
  File "/usr/share/jython/Lib/ensurepip/__init__.py", line 123, in bootstrap
    _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/usr/share/jython/Lib/ensurepip/__init__.py", line 45, in _run_pip
    import pip
  File "/tmp/tmpQMQyZh/pip-1.6-py2.py3-none-any.whl/pip/__init__.py", line 10, in <module>
  File "/tmp/tmpQMQyZh/pip-1.6-py2.py3-none-any.whl/pip/util.py", line 17, in <module>
  File "/tmp/tmpQMQyZh/pip-1.6-py2.py3-none-any.whl/pip/locations.py", line 109, in <module>
  File "/tmp/tmpQMQyZh/pip-1.6-py2.py3-none-any.whl/pip/locations.py", line 71, in _get_build_prefix
  File "/tmp/tmpQMQyZh/pip-1.6-py2.py3-none-any.whl/pip/locations.py", line 66, in __get_username
  File "/usr/share/jython/Lib/pwd.py", line 60, in getpwuid
    return struct_passwd(entry)
  File "/usr/share/jython/Lib/pwd.py", line 36, in __new__
    pwd = (newStringOrUnicode(pwd.loginName), newStringOrUnicode(pwd.password), int(pwd.UID),
NotImplementedError: passwd.pw_passwd unimplemented

@J-u-n-o J-u-n-o closed this as completed Sep 3, 2018
@J-u-n-o J-u-n-o reopened this Sep 3, 2018
@J-u-n-o
Copy link
Author

J-u-n-o commented Sep 3, 2018

Sorry wrong button...

@mnadvornik
Copy link

I have the same problems with 2.7.0 and 2.7.1 as Juno72 mentioned. Is there any solution to this?

@jamesmudd
Copy link
Member

Sorry its taken a while to get to this issue. I have reproduced this issue and can offer some advice. The error occurs from the Jython PosixModule where mkdir is implemented.

I'm not exactly sure what the error code 20000 means in this case I need to do more investigation. But some wild speculation is the issue is something to do with running on ARM.

However, this issue only seems to affect pip/setuptools Jython itself seems to work ok on the RPi so if you exclude pip/setuptools from the install it works e.g.

pi@raspberrypi:~/git $ java -jar jython-installer-2.7.1.jar 
Welcome to Jython !
You are about to install Jython version 2.7.1
(at any time, answer c to cancel the installation)
For the installation process, the following languages are available: English, German
Please select your language [E/g] >>> 
Do you want to read the license agreement now ? [y/N] >>> 
Do you accept the license agreement ? [Y/n] >>> 
The following installation types are available:
  1. All (everything, including sources)
  2. Standard (core, library modules, demos and examples, documentation)
  3. Minimum (core)
  9. Standalone (a single, executable .jar)
Please select the installation type [ 1 /2/3/9] >>> 
Do you want to exclude parts from the installation ? [y/N] >>> y
The following parts are selectable (n = no more) [mod/demo/doc/src/ensurepip/N] >>> ensurepip
ensurepip excluded from installation
The following parts are selectable (n = no more) [mod/demo/doc/src/ensurepip/N] >>> n
Please enter the target directory >>> /home/pi/jython 
Unable to find directory /home/pi/jython, create it ? [Y/n] >>> 
Your java version to start Jython is: Oracle Corporation / 1.8.0_65
Your operating system version is: Linux / 4.14.52-v7+
Summary:
  - mod: true
  - demo: true
  - doc: true
  - src: true
  - ensurepip: false
  - JRE: /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre
Please confirm copying of files to directory /home/pi/jython [Y/n] >>> 
 10 %
 20 %
 30 %
 40 %
 50 %
 60 %
 70 %
 80 %
 90 %
 100 %
 110 %
 120 %
 130 %
 140 %
Generating start scripts ...
 100 %
Do you want to show the contents of README ? [y/N] >>> 
Congratulations! You successfully installed Jython 2.7.1 to directory /home/pi/jython.
pi@raspberrypi:~/git $ cd /home/pi/jython/bin/
pi@raspberrypi:~/jython/bin $ ./jython 
Jython 2.7.1 (default:0df7adb1b397, Jun 30 2017, 19:02:43) 
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.8.0_65
Type "help", "copyright", "credits" or "license" for more information.
>>> 2+5
7
>>>

But this is not a solution so this needs further investigation. (Also something strange happens with the install progress in this case!)

@mnadvornik
Copy link

I can confirm that jython itself is working fine if you don't install pip/setuptools and I haven't experienced this problem with x86 based systems. But I really appreciate that you look into that @jamesmudd. I am using jython with openhab and would love to have an easy way to use external modules for my various rules without needing to switch to a different hardware architecture.

If there is anything I can help you with just tell me what I can do. I work in IT but am neither a professional software developer nor have I much experience with python so I didn't come far with debugging this issue yet

@jamesmudd
Copy link
Member

Ok some progress on this issue.

This occurs because on ARM the error returned when I directory already exists it wrong e.g
On x86

Jython 2.7.1 (default:0df7adb1b397, Jun 30 2017, 19:02:43) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java11.0.1
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.makedirs('/tmp/test')
>>> os.makedirs('/tmp/test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/james/jython/Lib/os.py", line 174, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '/tmp/test'

Where as on ARM

Jython 2.7.1 (default:0df7adb1b397, Jun 30 2017, 19:02:43) 
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.8.0_65
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.makedirs('/tmp/test')
>>> os.makedirs('/tmp/test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/jython/Lib/os.py", line 174, in makedirs
    mkdir(name, mode)
OSError: [Errno 20000] Unknown error: 20000: '/tmp/test'

So errno 20000 is returned when errno 17 should be.

Thankfully in the time since the 2.7.1 release the JNR and JFFI people have been working to fix ARM support so by updating to the newest versions of these libraries it appears the ARM support is fixed.

Here is a link to an installer built with updated JNR and JFFI libraries on my RPi it appears to install fully and pip works. Give it a try.

I will sort out getting a that merged before the 2.7.2 release.

@jamesmudd jamesmudd changed the title installing jython 2.7.1 has issues installing pip Installing Jython 2.7.1 has issues installing pip on ARM Apr 25, 2019
jamesmudd referenced this issue in jamesmudd/jython Apr 27, 2019
Updates:
- jnr-ffi 2.1.7 → 2.1.9
- jnr-posix 3.0.44 → 3.0.49
- jnr-constants 0.9.9 → 0.9.12
- jffi 1.2.15 → 1.2.18

This also updates the ARM stub for a newer one this was recently updated
to improve ARM hard float support and is needed to fix this bug. See
jnr/jffi@c29326d
jamesmudd referenced this issue in jamesmudd/jython Apr 27, 2019
Updates:
- jnr-ffi 2.1.7 → 2.1.9
- jnr-posix 3.0.44 → 3.0.49
- jnr-constants 0.9.9 → 0.9.12
- jffi 1.2.15 → 1.2.18

This also updates the ARM stub for a newer one this was recently updated
to improve ARM hard float support and is needed to fix this bug. See
jnr/jffi@c29326d
@jeff5
Copy link
Member

jeff5 commented Jun 4, 2020

Raised as jythontools/jython issue 108

@jeff5 jeff5 transferred this issue from jython/frozen-mirror Jun 4, 2020
@jeff5 jeff5 transferred this issue from jython/jython-bad-history Jul 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants