Skip to content

Incompatibility with python2 and python3 #10

@ning-y

Description

@ning-y

I could not install GIM3E on either python2 or python3. On python2, GIM3E's dependencies have since moved to python3 causing syntax errors during their installations (in particular, swiglpk uses a sep argument in its print in its setup.py). On python3, GIM3E uses several python2-specific syntaxes which are no longer valid in python3.

Thus far I have almost overcome this by automatic conversion of python2-specific syntax to syntax that is compatible with both python2 and python3 using the modernize module in combination with the autopep8 module. The former modernize does well enough except one from __future__ import ... statement must be reordered in gime3e/core/gime3e.py (see PyCQA/modernize#263). The latter autopep8 is necessary because there are mixed tabs and spaces in the GIM3E source code but modernize does not handle those.

I've also found that on Termux but not on Debian, GLPK and SWIG must be installed at a system-level (pkg install swig glpk), because pre-built wheels for swiglpk seem to be unavailable (so it builds from source, but building from source requires GLPK and SWIG as dependencies). I doubt anyone else would run into this issue, though.

For Debian,

# Start in the GIM3E repository
python3 -m venv venv
source venv/bin/activate
pip install modernize autopep8
modernize -w ez_setup.py setup.py gim3e/
autopep8 -r --aggressive --in-place gim3e
# Fix the `from __future__ import ...` not being at top of file; you can use a text editor too
printf '%s\n' 3m1 w q | ed -s gim3e/core/gim3e.py
pip install .

I will update this issue if/when I progress further.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions