polybar: ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python3.9/fractions.py)
Checklist
- [X ] I have followed every step on the compiling wiki page and installed all necessary dependencies.
- [X ] My problem is not described on the known issues page
- [X ] I have searched for other open and closed issues that may have already reported this problem.
- [X ] I was able to reproduce this build issue in a clean build
Build Process
How did you build polybar?
- [X ] From a release archive (Which version?)
- By cloning this repository (What is the output of
git describe --tags?) - Some other way (How?)
Build Log
#make -j$(nproc)[ 0%] sphinx-build html: see doc/builder-html.log [ 1%] sphinx-build man: see doc/builder-man.log [ 1%] Built target doc_html [ 2%] Generating generated-sources/include/xpp/proto/x.hpp [ 2%] Built target doc_man [ 5%] Built target i3ipc++ Traceback (most recent call last): File “/opt/polybar/lib/xpp/generators/cpp_client.py”, line 3096, in <module> from xcbgen.state import Module File “/usr/lib/python3/dist-packages/xcbgen/state.py”, line 7, in <module> from xcbgen import matcher File “/usr/lib/python3/dist-packages/xcbgen/matcher.py”, line 12, in <module> from xcbgen.xtypes import * File “/usr/lib/python3/dist-packages/xcbgen/xtypes.py”, line 5, in <module> from xcbgen.align import Alignment, AlignmentLog File “/usr/lib/python3/dist-packages/xcbgen/align.py”, line 5, in <module> from fractions import gcd ImportError: cannot import name ‘gcd’ from ‘fractions’ (/usr/lib/python3.9/fractions.py) make[2]: *** [lib/xpp/CMakeFiles/xpp.dir/build.make:93: lib/xpp/generated-sources/include/xpp/proto/x.hpp] Error 1 make[2]: *** Se borra el archivo ‘lib/xpp/generated-sources/include/xpp/proto/x.hpp’ make[1]: *** [CMakeFiles/Makefile2:540: lib/xpp/CMakeFiles/xpp.dir/all] Error 2 make[1]: *** Se espera a que terminen otras tareas… [ 10%] Built target polybar-msg make: *** [Makefile:149: all] Error 2
Environment:
- debian : 4.10
Additional context
I’m alredy install al dependencies
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (6 by maintainers)
Saw same issue. The cause is gcd is not supported by fractions anymore.
sudo vim /usr/lib/python3/dist-packages/xcbgen/align.pyAnd update
from fractions import gcdto
from math import gcdWorks for me.
Exactly the same error here! No idea of how to go on.
Build Log
make -j$(nproc) [ 1%] Generating generated-sources/include/xpp/proto/x.hpp Scanning dependencies of target doc_html Scanning dependencies of target doc_man Scanning dependencies of target i3ipc++ [ 1%] sphinx-build html: see doc/builder-html.log [ 2%] sphinx-build man: see doc/builder-man.log [ 3%] Building CXX object lib/i3ipcpp/CMakeFiles/i3ipc++.dir/src/ipc.cpp.o Traceback (most recent call last): File “/opt/polybar-3.5.1/lib/xpp/generators/cpp_client.py”, line 3096, in <module> from xcbgen.state import Module File “/usr/lib/python3/dist-packages/xcbgen/state.py”, line 7, in <module> from xcbgen import matcher File “/usr/lib/python3/dist-packages/xcbgen/matcher.py”, line 12, in <module> from xcbgen.xtypes import * File “/usr/lib/python3/dist-packages/xcbgen/xtypes.py”, line 5, in <module> from xcbgen.align import Alignment, AlignmentLog File “/usr/lib/python3/dist-packages/xcbgen/align.py”, line 5, in <module> from fractions import gcd ImportError: cannot import name ‘gcd’ from ‘fractions’ (/usr/lib/python3.9/fractions.py) make[2]: *** [lib/xpp/CMakeFiles/xpp.dir/build.make:93: lib/xpp/generated-sources/include/xpp/proto/x.hpp] Error 1 make[2]: *** Se borra el archivo ‘lib/xpp/generated-sources/include/xpp/proto/x.hpp’ make[1]: *** [CMakeFiles/Makefile2:540: lib/xpp/CMakeFiles/xpp.dir/all] Error 2 make[1]: *** Se espera a que terminen otras tareas… [ 4%] Building CXX object lib/i3ipcpp/CMakeFiles/i3ipc++.dir/src/ipc-util.cpp.o [ 4%] Built target doc_man [ 4%] Built target doc_html [ 5%] Linking CXX static library libi3ipc++.a [ 5%] Built target i3ipc++ make: *** [Makefile:149: all] Error 2
I change the name of fractions.py in directory /usr/lib/python3.9 to fractions .pyc and copy fractions.py of directory /usr/lib/python3.8 to /usr/lib/python3.9 and run the conmands make -j$(nproc) and sudo make instal. After that i just delete fractions.py of directory /usr/lib/python3.9 and rename fractions.pyc to fractions.py of the same directory.
Thank you for your help.