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

2to3 will fail silently when building deap from sources using Python 3 #310

Open
krypty opened this issue Oct 31, 2018 · 0 comments
Open

Comments

@krypty
Copy link

krypty commented Oct 31, 2018

When I try to build deap from sources using Python 3 inside a freshly created virtualenv, setuptools will simply ignore to run 2to3 if it is not installed in this virtualenv (proof: https://github.com/pypa/setuptools/blob/master/setuptools/command/build_py.py#L14). The result is that deap is built as a Python 2 package that is incompatible with Python 3.

Steps to reproduce

  1. Create a new Python 3 virtualenv pyenv virtualenv 3.5.5 deap_creator
  2. Activate it pyenv activate deap_creator
  3. Run pip freeze and see that 2to3 is not installed
  4. Install deap python setup.py install
  5. Start a Python console and type from deap import creator
  6. Then try to create a new class using creator : creator.create("Foo", list)
  7. See the Python 2 error: AttributeError: 'dict' object has no attribute 'iteritems'

Proposed solution 1

Specify 2to3 as a requirement in setup.py. But I think this is not what deap is used to because otherwise other needed packages would be listed there too e.g. numpy.

Proposed solution 2

Add in the README if one wants to build deap from sources using Python 3 then one must install 2to3 package before and run the following commands:

pip install 2to3
2to3 -w .
python setup.py install
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

1 participant