0

I tried to install TPOT as per http://epistasislab.github.io/tpot/installing/

I had trouble installing DEAP, so I had installed setuptools==58. Both tpot and DEAP installed.

After installation, when I ran "import tpot", I get the following error:

Traceback (most recent call last):

  File ~\AppData\Roaming\Python\Python310\site-packages\IPython\core\interactiveshell.py:3251 in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  Input In [1] in <module>
    import tpot

  File ~\AppData\Roaming\Python\Python310\site-packages\tpot\__init__.py:27 in <module>
    from .tpot import TPOTClassifier, TPOTRegressor

  File ~\AppData\Roaming\Python\Python310\site-packages\tpot\tpot.py:31 in <module>
    from .base import TPOTBase

  File ~\AppData\Roaming\Python\Python310\site-packages\tpot\base.py:46 in <module>
    from deap import base, creator, tools, gp

  File ~\AppData\Roaming\Python\Python310\site-packages\deap\base.py:192
    raise TypeError, ("Both weights and assigned values must be a "
                   ^
SyntaxError: invalid syntax

Uninstalled and reinstalled DEAP, setuptools, and tpot; no change

I am using Python 3.10.2 64-bit, with Visual Studio Code IDE on a Windows 10 machine. tpot version 0.11.7, deap version 1.3.1.

Any suggestions please?

Progman
  • 16,827
  • 6
  • 33
  • 48
geoabram
  • 125
  • 2
  • 11

1 Answers1

0

There are two errors here.

  1. tpot only appears to be compatible with Python 3.7 (see the .travis.yml build matrix)
  2. DEAP seems to have been designed for Python 2.6, with limited support for Python 3 using 2to3.

From the DEAP README:

The most basic features of DEAP requires Python2.6.
In order to combine the toolbox and the multiprocessing module Python2.7 is
needed for its support to pickle partial functions. ...

Since version 0.8, DEAP is compatible out of the box with Python 3.
The installation procedure automatically translates the source to 
Python 3 with 2to3.

Someone reported the SyntaxError on 2021-01-14 (https://github.com/DEAP/deap/issues/537), so this has been a problem for ~2 years.

Alexander L. Hayes
  • 3,892
  • 4
  • 13
  • 34
  • Thanks a lot for the clarification. Let me try with a different env with Python 3.7. Will post results here – geoabram Jul 11 '22 at 07:46