tulip-control / dd

Binary Decision Diagrams (BDDs) in pure Python and Cython wrappers of CUDD, Sylvan, and BuDDy
https://pypi.org/project/dd
Other
182 stars 39 forks source link

Attempt Install dd.cudd on Windows #68

Closed glarange closed 3 years ago

glarange commented 4 years ago

Hi @johnyf

Ran into below while following https://github.com/tulip-control/dd#dd-fetching-cudd. Please advise. Thanks! Gui

(dd) C:\Users\student\dd-0.5.6>python setup.py install --fetch --cudd
`import cython` failed
++ download: https://sourceforge.net/projects/cudd-mirror/files/cudd-3.0.0.tar.gz/download
-- done downloading.
++ unpack: cudd-3.0.0.tar.gz
-- done unpacking.
Traceback (most recent call last):
  File "setup.py", line 172, in <module>
    run_setup()
  File "setup.py", line 127, in run_setup
    download.fetch_cudd()
  File "C:\Users\student\dd-0.5.6\download.py", line 222, in fetch_cudd
    make_cudd()
  File "C:\Users\student\dd-0.5.6\download.py", line 214, in make_cudd
    subprocess.call(cmd, cwd=path)
  File "C:\Users\student\anaconda3\envs\dd\lib\subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Users\student\anaconda3\envs\dd\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\student\anaconda3\envs\dd\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
johnyf commented 4 years ago

The module dd.cudd and the script download.py have been written on GNU/Linux and work also on macOS. The script download.py would need to be modified in order to build dd.cudd on Windows. The error is raised when attempting to run the script configure with ./configure:

https://github.com/tulip-control/dd/blob/24ec9eba335c173e1fe0367a9ac25ec201dee1b5/download.py#L213-L214

The slash / is likely not recognized by Windows as directory separator, so ./configure fails to invoke the script configure. Moreover, CUDD's configure script is a bash script (#! /bin/sh at the top of the file), so it would need to be invoked with bash installed (and instead of ./configure "CFLAGS=-fPIC -std=c99", bash configure "CFLAGS=-fPIC -std=c99" would avoid the slash).

Using WSL or Cygwin may lead to better results. Depending on which of these approaches is used, modifications may be needed at the following lines:

https://github.com/tulip-control/dd/blob/24ec9eba335c173e1fe0367a9ac25ec201dee1b5/download.py#L213

https://github.com/tulip-control/dd/blob/24ec9eba335c173e1fe0367a9ac25ec201dee1b5/download.py#L45

https://github.com/tulip-control/dd/blob/24ec9eba335c173e1fe0367a9ac25ec201dee1b5/download.py#L47-L55

For the configuration, please consult CUDD, which mentions building on Windows in its README file, which can be found also at: https://github.com/tulip-control/cudd (the original link for CUDD is http://vlsi.colorado.edu/~fabio/CUDD/, though this link currently cannot be reached).

Please note that building CUDD can be done directly in a command prompt, it does not need to happen through the script download.py. If so, then building dd is performed with python setup.py --cudd (and optionally --cudd_zdd), i.e., without --fetch, because that option will re-download CUDD and unpack it on top of the already compiled CUDD.

When the correct configuration is found, then download.py could be changed accordingly for installing on that environment.

The dependencies needed include make:

https://github.com/tulip-control/dd/blob/24ec9eba335c173e1fe0367a9ac25ec201dee1b5/download.py#L215

Also, it will be necessary to ensure that the same compiler is run when building CUDD and when building the Cython module dd.cudd (the latter using Python from the script setup.py).

glarange commented 3 years ago

I got a Mac. Then it works fine. I will stick to Mac while using dd in the future. Thanks, G

grgeorgiev commented 2 years ago

Hi @johnyf After some partially successful attempts to install dd.cudd on Windows, I decide to post in this thread again.

First of all, it's worth mentioning that installing dd.cudd on WSL was a success and went with no issues. Next, I tried installing in native Windows environment using minGW64 and here is where the problems started.

Initially, a few changes to the download.py were needed as described above in this thread. ./configure needed to be changed to bash configure and subprocess.call(..) needed shell=True.

cmd = ["bash configure", "CFLAGS=-fPIC -std=c99"]
subprocess.call(cmd, cwd=path,shell=True)
subprocess.call(['make', '-j4'], cwd=path,shell=True)

Then I got to the following error and I'm not sure what to do next.

C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. Any suggestions are highly appreciated.