Jupyter-themes: jupyterthemes==0.9.1 doesn't work for me

Created on 27 Jul 2016  Â·  14Comments  Â·  Source: dunovank/jupyter-themes

Hi no idea whats wrong, i have win7 + python 3

Traceback (most recent call last):
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Dev\Local\env\tools\Miniconda\envs\nb\Scripts\jt.exe\__main__.py", line 9, in <module>
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\jupyterthemes\__init__.py", line 207, in main
    install_theme(args.theme, monofont=args.monofont, monofontsize=args.monofontsize, nbfontfamily=args.nbfontfamily, tc
fontfamily=args.tcfontfamily, cellwidth=int(args.cellwidth),  lineheight=int(args.lineheight), altlayout=args.altlayout,
 toolbar=args.toolbar)
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\jupyterthemes\__init__.py", line 175, in install_them
e
    style_css += compile_less2css(style_less)
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\jupyterthemes\__init__.py", line 46, in compile_less2
css
    style_css = lesscpy.compile(less_tempfile, tabs=True)
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\__init__.py", line 18, in compile
    p.parse(file=file)
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\lessc\parser.py", line 156, in parse
    self.post_parse()
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\lessc\parser.py", line 168, in post_parse
    out.append(pu.parse(self.scope))
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\plib\block.py", line 43, in parse
    inner = list(utility.flatten([p.parse(scope) for p in inner if p]))
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\plib\block.py", line 43, in <listcomp>
    inner = list(utility.flatten([p.parse(scope) for p in inner if p]))
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\plib\property.py", line 39, in parse
    self.parsed = self.process(style, scope)
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\plib\node.py", line 49, in process
    for t in tokens]
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\plib\node.py", line 49, in <listcomp>
    for t in tokens]
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\plib\call.py", line 58, in parse
    result = getattr(color, name)(*args)
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\lessc\color.py", line 237, in lighten
    return self._ophsl(color, diff, 1, operator.add)
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\lessc\color.py", line 428, in _ophsl
    return self._rgbatohex(color)
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\lessc\color.py", line 398, in _rgbatohex
    for h in rgba]
  File "c:\dev\local\env\tools\miniconda\envs\nb\lib\site-packages\lesscpy\lessc\color.py", line 394, in <listcomp>
    return '#%s' % ''.join(["%02x" % v for v in
TypeError: %x format: an integer is required, not float

Most helpful comment

fyi, I made a PR that may fix the upstream issue: https://github.com/lesscpy/lesscpy/pull/86

All 14 comments

Having the same error on OSX.

Can anyone weigh in on if this has been fixed in 0.10.1?

if this has been fixed in 0.10.1?

Nope.

Can you post the traceback for the 10.1 error

here we go: osx + py35

$ jt -t onedork
Installing onedork at /Users/haichit/.jupyter/custom/custom.css
Traceback (most recent call last):
  File "/Users/haichit/miniconda/bin/jt", line 9, in <module>
    load_entry_point('jupyterthemes', 'console_scripts', 'jt')()
  File "/Users/haichit/programs/jupyter/jupyter-themes/jupyterthemes/__init__.py", line 109, in main
    install_theme(args.theme, monofont=args.monofont, monosize=args.monosize, nbfontfam=args.nbfontfam, tcfontfam=args.tcfontfam, cellwidth=int(args.cellwidth),  lineheight=int(args.lineheight), altlayout=args.altlayout, toolbar=args.toolbar)
  File "/Users/haichit/programs/jupyter/jupyter-themes/jupyterthemes/__init__.py", line 78, in install_theme
    style_css += less_to_css(style_less)
  File "/Users/haichit/programs/jupyter/jupyter-themes/jupyterthemes/__init__.py", line 37, in less_to_css
    style_css = lesscpy.compile(tempfile)
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/__init__.py", line 18, in compile
    p.parse(file=file)
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/lessc/parser.py", line 156, in parse
    self.post_parse()
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/lessc/parser.py", line 168, in post_parse
    out.append(pu.parse(self.scope))
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/plib/block.py", line 43, in parse
    inner = list(utility.flatten([p.parse(scope) for p in inner if p]))
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/plib/block.py", line 43, in <listcomp>
    inner = list(utility.flatten([p.parse(scope) for p in inner if p]))
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/plib/property.py", line 39, in parse
    self.parsed = self.process(style, scope)
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/plib/node.py", line 49, in process
    for t in tokens]
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/plib/node.py", line 49, in <listcomp>
    for t in tokens]
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/plib/call.py", line 58, in parse
    result = getattr(color, name)(*args)
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/lessc/color.py", line 237, in lighten
    return self._ophsl(color, diff, 1, operator.add)
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/lessc/color.py", line 428, in _ophsl
    return self._rgbatohex(color)
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/lessc/color.py", line 398, in _rgbatohex
    for h in rgba]
  File "/Users/haichit/miniconda/lib/python3.5/site-packages/lesscpy/lessc/color.py", line 394, in <listcomp>
    return '#%s' % ''.join(["%02x" % v for v in
TypeError: %x format: an integer is required, not float

The recent versions use lesscpy to compile a series of less files into a giant css file that gets saved to your jupyter config dir. Unfortunately lesscpy requires 2.6, 2.7, or 3.3 and conda only supports 2.7, 3.4 and 3.5. When I have time I'll look into a workaround but for the time being it looks like I'll have to remove 3 compatibility. Sorry for any hassle this has caused.

@dunovank how's about distribute the compiled file too? I don't see why jupyter-themes needs lesscpy for end-user.

That will limit the layout, font settings, etc that are able to be set using the CL but I could include a compiled css file for each theme using the default settings so that 3.4 & 3.5 users could still install them.

I'm sure there are clever ways of maintaining the flexibility without using less but I'm frankly not that experienced with css and this makes adding new features vastly simpler. That said, I'm inclined to search for a compiling workaround before I give up on this approach.

Does that sound reasonable? If so, I'll try to release a patch soon with conditional installs if executed in a 3.4 or 3.5 env so that each theme can be installed by copying/pasting from a defaults folder.

That said, I'm inclined to search for a compiling workaround before I give up on this approach.
Does that sound reasonable?

agree.

If so, I'll try to release a patch soon with conditional installs if executed in a 3.4 or 3.5 env so that each theme can be installed by copying/pasting from a defaults folder.

this would be great. thanks.

fwiw, it looks like this is only an issue with python 3.5. I just tried in 3.4 and didn't get this error. Also, lesscpy's setup.py file says it supports 3.4, though it's README doesn't at the moment.

fyi, I made a PR that may fix the upstream issue: https://github.com/lesscpy/lesscpy/pull/86

Awesome, thank you! I'm currently in the process of moving and dont have
internet accesss in my new place yet so I won't be able to look into
anything for a day or two. Very much appreciate all the
feedback/contributions from everyone though.

-kd

On Saturday, July 30, 2016, Michael Heilman [email protected]
wrote:

fyi, I made a PR that may fix the upstream issue: lesscpy/lesscpy#86
https://github.com/lesscpy/lesscpy/pull/86

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dunovank/jupyter-themes/issues/28#issuecomment-236386569,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADqqzqk9sf-Svu0C0mrWezg81xgn1jkXks5qa6qsgaJpZM4JWOqi
.

Sent from my iPhone

Attempted a workaround for 3.5 users in latest release (v0.10.2). Also added a note to the bottom of the readme about the issue.

marking as closed, keeping an eye on lesscpy pypi repo for 3.5 compatibility (git develop branch hasn't been officially released yet. I opened an issue, still waiting on a reply)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AFederici picture AFederici  Â·  7Comments

karimelgazar picture karimelgazar  Â·  4Comments

mlx809593812 picture mlx809593812  Â·  8Comments

ShriRambo picture ShriRambo  Â·  6Comments

suberlak picture suberlak  Â·  4Comments