jsvine / spectra

Easy color scales and color conversion for Python.
http://nbviewer.ipython.org/github/jsvine/spectra/blob/master/docs/walkthrough.ipynb
MIT License
258 stars 12 forks source link

Import failed #9

Closed araichev closed 6 years ago

araichev commented 6 years ago

Just installed Spectra 0.0.8, but couldn't import it. Am i doing something wrong here?

Python 3.5.2 (default, Sep 14 2017, 22:51:06) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import spectra
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/araichev/.virtualenvs/test-7e0rFXCM/lib/python3.5/site-packages/spectra/__init__.py", line 1, in <module>
    from .core import COLOR_SPACES, Color, Scale
  File "/home/araichev/.virtualenvs/test-7e0rFXCM/lib/python3.5/site-packages/spectra/core.py", line 1, in <module>
    from colormath import color_objects, color_conversions
  File "/home/araichev/.virtualenvs/test-7e0rFXCM/lib/python3.5/site-packages/colormath/color_conversions.py", line 167, in <module>
    def Spectral_to_XYZ(cobj, illuminant_override=None, *args, **kwargs):
  File "/home/araichev/.virtualenvs/test-7e0rFXCM/lib/python3.5/site-packages/colormath/color_conversions.py", line 159, in decorator
    _conversion_manager.add_type_conversion(start_type, target_type, f)
  File "/home/araichev/.virtualenvs/test-7e0rFXCM/lib/python3.5/site-packages/colormath/color_conversions.py", line 125, in add_type_conversion
    self.conversion_graph.add_edge(start_type, target_type, {'conversion_function': conversion_function})
TypeError: add_edge() takes 3 positional arguments but 4 were given
jakedowns commented 6 years ago

same here with python 3.4.3, 3.5.0, 3.6.0a2, 3.7.0a2 env: bash on ubuntu on windows 10 tried spectra 0.0.8, 0.0.6

update as mentioned in https://github.com/jsvine/spectra/issues/8 i forced networkx back to 1.11 and it seems to work again.

$ pip3 uninstall networkx
$ pip3 install "networkx==1.11"
jsvine commented 6 years ago

Thanks for reporting this. As you've observed via #8, this problem stems from an incompatibility of colormath==2.1.1 and networkx==2.0. Given that the colormath fix still hasn't been pushed to PyPi, I've gone ahead and pushed a new release of spectra (0.0.9), which pins the colormath and networkx requirements to the most recent compatible versions.

Running pip install -U spectra should now resolve the problem. Let me know if it doesn't.

araichev commented 6 years ago

Works for me. Thanks.