Running DEAP programs with pypy and compiling ctools

704 views
Skip to first unread message

Olumide

unread,
Nov 26, 2012, 5:41:29 PM11/26/12
to deap-...@googlegroups.com
I've got two questions:

1. I'm trying to compile ctools following the instructions in INSTALL.txt but I'm getting the following message:

...
running build_ext
building 'deap.cTools' extension
Traceback (most recent call last):
  File "setup.py", line 40, in <module>
    cmdclass = {'build_py': build_py}
  File "C:\Python27\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\lib\distutils\command\install.py", line 563, in run
    self.run_command('build')
  File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\lib\distutils\command\build.py", line 127, in run
    self.run_command(cmd_name)
  File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\lib\distutils\command\build_ext.py", line 340, in run
    self.build_extensions()
  File "C:\Python27\lib\distutils\command\build_ext.py", line 449, in build_extensions
    self.build_extension(ext)
  File "C:\Python27\lib\distutils\command\build_ext.py", line 499, in build_extension
    depends=ext.depends)
  File "C:\Python27\lib\distutils\msvc9compiler.py", line 473, in compile
    self.initialize()
  File "C:\Python27\lib\distutils\msvc9compiler.py", line 383, in initialize
    vc_env = query_vcvarsall(VERSION, plat_spec)
  File "C:\Python27\lib\distutils\msvc9compiler.py", line 299, in query_vcvarsall
    raise ValueError(str(list(result.keys())))
ValueError: [u'path']

What might the problem be?

2. I've downloaded pypy and I'm trying to run the onemax short demo with it but I'm getting the error message:

C:\pypy-1.9>pypy ga_onemax_short.py
Traceback (most recent call last):
  File "app_main.py", line 51, in run_toplevel
  File "ga_onemax_short.py", line 19, in <module>
    from deap import algorithms
ImportError: No module named deap

Again, what am I doing wrong?

Thanks,

- Olumide





Félix-Antoine Fortin

unread,
Nov 26, 2012, 5:50:24 PM11/26/12
to deap-...@googlegroups.com
Hi,

1. The problem seems related to the search for a compiler compatible with your version of Python. This not specific to DEAP, I have found this by googling your error : http://stackoverflow.com/questions/4676728/value-error-trying-to-install-python-for-windows-extensions

2. PyPy is unable to find your installation of deap. Either set the variable PYTHONPATH and make it point to where deap is installed, or install deap again but with pypy (i.e.:  pypy setup.py install).

Félix-Antoine

Olumide

unread,
Nov 30, 2012, 6:56:35 PM11/30/12
to deap-users
Update:

I'm still struggling to get compile ctools with VC++ 2008 Express on
Windows 7 64 bit, so for the time being I've switched to my 32 bit
Windows XP. Now I'm getting the error message:

creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\deap
c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /
Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -I
C:\Python27\PC /Tpdeap/cTools.cpp /Fobuild\temp.win32-2.7\Release\deap/
cTools.obj
cTools.cpp
c1xx : fatal error C1083: Cannot open source file: 'deap/cTools.cpp':
No such file or directory
error: command '"c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
\cl.exe"' failed with exit status 2

Oddly there is no cTools.cpp in the deap subfolder :-/ ... ?

Félix-Antoine Fortin

unread,
Nov 30, 2012, 7:26:47 PM11/30/12
to deap
Oups!

I forgot to modify the script that packages our releases automatically. Since it only searches for .py file, cTools.cpp was not added to the .tar.gz. I will correct this soon.

Until then, you can download the missing file directly from googlecode at :

Thank you for the bug report!

Félix-Antoine Fortin

Olumide

unread,
Nov 30, 2012, 8:41:17 PM11/30/12
to deap-users
On 1 Dec, 00:26, Félix-Antoine Fortin <felix.antoine.for...@gmail.com>
wrote:
> I forgot to modify the script that packages our releases automatically.
> Since it only searches for .py file, cTools.cpp was not added to the
> .tar.gz. I will correct this soon.
>
> Until then, you can download the missing file directly from googlecode at :http://deap.googlecode.com/hg/deap/cTools.cpp

Downloaded. Success.

> Thank you for the bug report!

'More than glad to do my *little* bit - note the emphasis on little :)

Jason Zutty

unread,
Jan 7, 2013, 5:52:29 PM1/7/13
to deap-...@googlegroups.com
I installed my DEAP build using PIP.  Do I need to do something special to get cTools working?  It does not seem to find the module when I run my code.

Thanks,
Jason

François-Michel De Rainville

unread,
Jan 7, 2013, 6:02:07 PM1/7/13
to deap-...@googlegroups.com
pip install --install-option="--with-ctools" deap

should do the trick. Make sure to uninstall DEAP first otherwise it won't install again.

Regards,
François-Michel
Reply all
Reply to author
Forward
0 new messages