tulip-control / dd

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

Installation does not work with python3-based pip #3

Closed maweki closed 9 years ago

maweki commented 9 years ago

As it says in the title.

$ pip --version
pip 7.1.2 from /home/maweki/.local/lib/python3.4/site-packages (python 3.4
$ python --version
Python 2.7.10

when I try to install dd via pip install --user dd I get the following error

Collecting dd Using cached dd-0.1.3.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 20, in File "/tmp/pip-build-ew5h83vp/dd/setup.py", line 4, in import download File "/tmp/pip-build-ew5h83vp/dd/download.py", line 7, in import urllib2 ImportError: No module named 'urllib2'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ew5h83vp/dd

It does work with pip2 install --user dd though. So maybe this package should not be available for python3 maybe

slivingston commented 9 years ago

pydot as on PyPI does not work with Python 3. I found a fork that claims Python 3 compatibility.

maweki commented 9 years ago

Pydot isn't a strict requirement for installing. The error was the downloading that was fixed in my branch/pull-request (https://github.com/johnyf/dd/pull/4)

slivingston commented 9 years ago

It is not strict in that an "extra" must be requested, e.g., as in pip install dd[dot]. My comment about pydot compatibility is relevant for this issue insofar as we want dd to be available via pip in both Python 2 and 3. The OP does not preclude the extras.

maweki commented 9 years ago

dd is available via pip for python3 because no supported versions are set within pypi. dd in general doesn't work with python3 which is (probably) a rather easy fix.

But we won't do it because one optional dependency does not support python3? Again ignoring the fact that one can allready (try to) install dd for python3.

I'd think, we'd want to do these things in no particular order:

Edit: I haven't checked out dd's dot support but just outputting a dot-string can be done with some string generation which could be a fallback if pydot were not available giving basic dot-support in any environment.

slivingston commented 9 years ago

I agree that core should be made compatible with Python 3 and then, if @johnyf prefers, released but without supporting the "dot" extra on Python 3. I.e., I am not arguing that @johnyf should wait on dealing with pydot before moving forward with Python 3. My comment was intended to indicate that this issue should stay open until that optional dependency is addressed.

I support abandoning pydot entirely and can contribute a replacement for desired functions.

johnyf commented 9 years ago

I agree that dd can be updated relatively soon to work in Python 3 (the Cython bindings are expected to already do so, due to the Cython transpiler addressing both Python versions from the same source). Branch dev currently contains this candidate update.

About pydot, it cannot be installed from PyPI (at least not w/o a lot of security-overriding options to pip, if that's still possible). So, the only installation is possible separately. Therefore, the user can select to install a Python 3 compatible fork, with the same name. There are several pydot forks already on PyPI.

I will likely contact the author of pydot and ask about the possibility of adding a maintainer, on both GitHub and PyPI. But that is an independent issue. If that fails, then I think it is time to use a fork.

johnyf commented 9 years ago

The author of pydot appears to have a PyPI entry called pydot3k that installs a pydot version that works in Python 3. So, for now, it should suffice to conditionally add pydot or pydot3k to the setup.py requirements, depending on the detected Python version.

johnyf commented 9 years ago

Unlike the pydot entry, the pydot3k entry is uploaded on PyPI. So, the claim above that pydot “cannot be installed from PyPI” does not hold -- at least not in Python 3.

johnyf commented 9 years ago

Cython appears to support some aspects of Python 2 and 3, but not others. In particular, string conversion from Python string objects to Cython that works in both Python 2 and 3 is tricky and fragile (and was a pain to achieve).

johnyf commented 9 years ago

Conditional dependency on pydot or pydot3k introduced in a911167581ba0b5d231a700e16859ca2f25a970c, and fewer unnecessary calls to pydot in 3bb95afdc98faf73eaf9d03a7ce5c6b67837c9af. This fixes the pydot in Python 3 issue (item 3 above).

johnyf commented 9 years ago

4, #5 and #6 address Python 3 compatibility of dd (item 1 above).

johnyf commented 9 years ago

1599c51ea18f3da218e8d5ed15d091ddf2091425 adds language classifiers on PyPI (item 2 above).