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

Loading pymzn throws syntax error in __init__.py #12

Closed
indrajitsg opened this issue Mar 22, 2017 · 4 comments
Closed

Loading pymzn throws syntax error in __init__.py #12

indrajitsg opened this issue Mar 22, 2017 · 4 comments

Comments

@indrajitsg
Copy link

indrajitsg commented Mar 22, 2017

Hi,
I am using Anaconda Python 2.7.12 in Windows 8.1. I installed pymzn with pip as instructed. When I tried to import the library, it throws me this error:

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    import pymzn
  File "C:\Users\Indrajit\Anaconda2\lib\site-packages\pymzn\__init__.py", line 114
    args.func(**{**vars(args), **args.solver_args})
                  ^
SyntaxError: invalid syntax

Please look into it.

Regards,
Indrajit

@HelgeS
Copy link
Contributor

HelgeS commented Mar 23, 2017

Installing via pip gets the Python 3 version of pymzn, which is unfortunately not working with python 2.

You can install the python 2-compatible branch by: pip install git+https://github.com/paolodragone/pymzn.git@python2
However, it is not up-to-date with the main development, e.g. the example from the readme is not working.

@paolodragone is there a specific reason to have two codebases for python 2 and 3? So far I identified only the subprocess module to be relying on the Python 3-specific version. Are there further dependencies?

@indrajitsg
Copy link
Author

I tried. This is the error I am getting:

Collecting git+https://github.com/paolodragone/pymzn.git@python2
  Cloning https://github.com/paolodragone/pymzn.git (to python2) to c:\users\indraj~2.sen\appdata\local\temp\pip-4gayvz-build
  Error [Error 2] The system cannot find the file specified while executing command git clone -q https://github.com/paolodragone/pymzn.git c:\users\indraj~2.sen\appdata\local\temp\pip-4gayvz-build
Cannot find command 'git'

I do have Git Bash installed.

Regards,
Indrajit

@HelgeS
Copy link
Contributor

HelgeS commented Mar 24, 2017

You need to have the git command on your %PATH% variable, so it can be found by pip (see here).

I also found another alternative: pip install https://github.com/paolodragone/pymzn/archive/python2.zip, this installs the same version as the command above, but does not require git to be available.

@paolodragone
Copy link
Owner

Hi, sorry about the lack of support for both Windows and Python 2. I personally use Python 3 on Linux so I often overlook other platforms. I'll try to put some effort on those now that there are more people using pymzn on them.
@HelgeS As said, I mainly develop in python 3.5, so I often make use of syntactic constructs of the newer versions of python, that is why I keep python 2 and 3 versions on separate branches.

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

3 participants