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

pip installation does not work #455

Closed
chess-bug opened this issue Nov 6, 2024 · 4 comments
Closed

pip installation does not work #455

chess-bug opened this issue Nov 6, 2024 · 4 comments

Comments

@chess-bug
Copy link

Issue type

Bug

How did you install PythonMonkey?

Installed from pip

OS platform and distribution

Ubuntu 20.04.6 LTS (debian bullseye as well)

Python version (python --version)

3.8.10

PythonMonkey version (pip show pythonmonkey)

trying to instal 1.0.0 and nightly build 1.0.1 as well

Bug Description

pip3 install pythonmonkey

ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 186, in _main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 357, in run
resolver.resolve(requirement_set)
File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 282, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 515, in prepare_linked_requirement
abstract_dist = _get_prepared_distribution(
File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 95, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(finder, build_isolation)
File "/usr/lib/python3/dist-packages/pip/_internal/distributions/sdist.py", line 33, in prepare_distribution_metadata
self.req.load_pyproject_toml()
File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 512, in load_pyproject_toml
pyproject_toml_data = load_pyproject_toml(
File "/usr/lib/python3/dist-packages/pip/_internal/pyproject.py", line 75, in load_pyproject_toml
pp_toml = toml.load(f)
File "/usr/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl/toml/decoder.py", line 134, in load
return loads(f.read(), _dict, decoder)
File "/usr/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl/toml/decoder.py", line 455, in loads
ret = decoder.load_line(line, currentlevel, multikey,
File "/usr/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl/toml/decoder.py", line 725, in load_line
value, vtype = self.load_value(pair[1], strictly_valid)
File "/usr/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl/toml/decoder.py", line 802, in load_value
return (self.load_array(v), "array")
File "/usr/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl/toml/decoder.py", line 914, in load_array
a[b] = a[b] + ',' + a[b + 1]
IndexError: list index out of range

It might be regression of #173

Standalone code to reproduce the issue

pip3 install pythonmonkey

Relevant log output or backtrace

ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 357, in run
    resolver.resolve(requirement_set)
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 282, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 515, in prepare_linked_requirement
    abstract_dist = _get_prepared_distribution(
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 95, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/usr/lib/python3/dist-packages/pip/_internal/distributions/sdist.py", line 33, in prepare_distribution_metadata
    self.req.load_pyproject_toml()
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 512, in load_pyproject_toml
    pyproject_toml_data = load_pyproject_toml(
  File "/usr/lib/python3/dist-packages/pip/_internal/pyproject.py", line 75, in load_pyproject_toml
    pp_toml = toml.load(f)
  File "/usr/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl/toml/decoder.py", line 134, in load
    return loads(f.read(), _dict, decoder)
  File "/usr/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl/toml/decoder.py", line 455, in loads
    ret = decoder.load_line(line, currentlevel, multikey,
  File "/usr/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl/toml/decoder.py", line 725, in load_line
    value, vtype = self.load_value(pair[1], strictly_valid)
  File "/usr/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl/toml/decoder.py", line 802, in load_value
    return (self.load_array(v), "array")
  File "/usr/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl/toml/decoder.py", line 914, in load_array
    a[b] = a[b] + ',' + a[b + 1]
IndexError: list index out of range

Additional info if applicable

No response

What branch of PythonMonkey were you developing on? (If applicable)

No response

@wiwichips
Copy link
Collaborator

Huh - pretty surprised to see this bug again! Thanks for filing a report, we'll look into it

@Xmader
Copy link
Member

Xmader commented Nov 6, 2024

File "/usr/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl/toml/decoder.py", line 134, in load
    return loads(f.read(), _dict, decoder)

It looks like your pip is still picking up toml version 0.10.0, which doesn't support homogeneous arrays. (See uiri/toml#270 (comment))

We have the following in PythonMonkey's pyproject.toml file https://github.com/Distributive-Network/PythonMonkey/blob/a9144ea/pyproject.toml#L10-L27. I believe it's better to just fix the file than hoping pip to choose the newer toml version to parse the file properly.

@chess-bug
Copy link
Author

You are right. I had:

pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

And after upgrading with:

python3 -m pip install --upgrade pip

to

pip 24.3.1

Installation succeed. Thank you.

@Xmader
Copy link
Member

Xmader commented Nov 29, 2024

This should be fixed in commit a5cdd79

@Xmader Xmader closed this as completed Nov 29, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done in PythonMonkey Kanban Board Nov 29, 2024
Xmader added a commit that referenced this issue Nov 29, 2024
Python `toml` version 0.10.0 (the older version pip 20 uses) doesn't support homogeneous arrays

See #455 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

3 participants