oracle / graalpython

A Python 3 implementation built on GraalVM
Other
1.2k stars 104 forks source link

graalpy -m ginstall install setuptools fails with java.lang.ArrayIndexOutOfBoundsException #292

Closed oroppas closed 1 year ago

oroppas commented 1 year ago
graalpy -m ginstall install setuptools
Installing required dependency: setuptools ... 
Traceback (most recent call last):
  File "<module>", line 85, in wrapper
  File "<module>", line 109, in import_module
  File "<module>", line 986, in _find_and_load
  File "<module>", line 956, in _find_and_load_unlocked
  File "<module>", line 782, in exec_module
Index -1 out of bounds for length 36
Traceback (most recent call last):
  File "<module>", line 85, in wrapper
  File "<module>", line 109, in import_module
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 36
msimacek commented 1 year ago

Are you running it locally from the repo? The most common cause for such an error is you end up with stale bytecode from an earlier build. Can you try find -name '*.pyc' -delete first?

oroppas commented 1 year ago

Thanks for the advice. find . -name "*.pyc" -delete and clean build fixed java.lang.ArrayIndexOutOfBoundsException.

Now I have zipimport.ZipImportError:

graalpy -m ginstall install setuptools
Installing required dependency: setuptools ... 
+  curl -L -o /tmp/tmpdhhpyl4v/setuptools-41.0.1.zip https://files.pythonhosted.org/packages/1d/64/a18a487b4391a05b9c7f938b94a16d80305bf0369c6b0b9509e86165e1d3/setuptools-41.0.1.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  829k  100  829k    0     0  2010k      0 --:--:-- --:--:-- --:--:-- 2012k
+  unzip -u /tmp/tmpdhhpyl4v/setuptools-41.0.1.zip -d /tmp/tmpdhhpyl4v
Archive:  /tmp/tmpdhhpyl4v/setuptools-41.0.1.zip
  inflating: /tmp/tmpdhhpyl4v/setuptools-41.0.1/MANIFEST.in  
  inflating: /tmp/tmpdhhpyl4v/setuptools-41.0.1/msvc-build-launcher.cmd

...

creating dist
creating 'dist/setuptools-41.0.1-py3.8.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing setuptools-41.0.1-py3.8.egg
Traceback (most recent call last):
  File "/tmp/tmpdhhpyl4v/setuptools-41.0.1/setup.py", line 194, in <module>
    dist = setuptools.setup(**setup_params)
  File "/tmp/tmpdhhpyl4v/setuptools-41.0.1/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/home/ryuta/packages/graalvm/graal/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib-python/3/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/ryuta/packages/graalvm/graal/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib-python/3/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/home/ryuta/packages/graalvm/graal/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib-python/3/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/tmp/tmpdhhpyl4v/setuptools-41.0.1/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/tmp/tmpdhhpyl4v/setuptools-41.0.1/setuptools/command/install.py", line 117, in do_egg_install
    cmd.run()
  File "/tmp/tmpdhhpyl4v/setuptools-41.0.1/setuptools/command/easy_install.py", line 418, in run
    self.easy_install(spec, not self.no_deps)
  File "/tmp/tmpdhhpyl4v/setuptools-41.0.1/setuptools/command/easy_install.py", line 660, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "/tmp/tmpdhhpyl4v/setuptools-41.0.1/setuptools/command/easy_install.py", line 705, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/tmp/tmpdhhpyl4v/setuptools-41.0.1/setuptools/command/easy_install.py", line 851, in install_eggs
    return [self.install_egg(dist_filename, tmpdir)]
  File "/tmp/tmpdhhpyl4v/setuptools-41.0.1/setuptools/command/easy_install.py", line 909, in install_egg
    dist = self.egg_distribution(egg_path)
  File "/tmp/tmpdhhpyl4v/setuptools-41.0.1/setuptools/command/easy_install.py", line 897, in egg_distribution
    metadata = EggMetadata(zipimport.zipimporter(egg_path))
zipimport.ZipImportError: not a Zip file: **'dist/setuptools-41.0.1-py3.8.egg'**

Inspecting dist/setuptools-41.0.1-py3.8.egg

head -9 /tmp/tmpdhhpyl4v/setuptools-41.0.1/dist/setuptools-41.0.1-py3.8.egg 
#!/bin/sh
if [ `basename $0` = "setuptools-41.0.1-py3.8.egg" ]
then exec python3.8 -c "import sys, os; sys.path.insert(0, os.path.abspath('$0')); from setuptools.command.easy_install import bootstrap; sys.exit(bootstrap())" "$@"
else
  echo $0 is not the correct name for this egg file.
  echo Please rename it back to setuptools-41.0.1-py3.8.egg and try again.
  exec false
fi
PKE��N\O�Ei~easy_install.py-�1�@
                                  D�~Oa��4 e��\`d�EYim#��=1�4�3���7�K��m-�V�]U���)����#u�J1�{&:�l��r�k��6�t�g��]}
EGG-INFO/PKG-INFO�WMs�6��W���3�L����QR�qZOG����@��B(���I�C���u!D�-�.v߂����;��.Sv?�\�R���qZ+�t�ϟ�Oh���U��8JU�L�J�y6e+/=d��+5e���g0e�̘/��lQ��.���+�'�"CÔm�3�&I.�Ưb���T�':sOh���,j+��Y3!]�.���R�,�輓
msimacek commented 1 year ago

We have updated to CPython 3.10, which includes newer setuptools, maybe it could fix your problem (you may need to remove those pyc files again)

oroppas commented 1 year ago

Fixed by recent update.