Can't use pyplot due to _tkinter.TclError: unknown color name












0















I've got a simple code:



from matplotlib import pyplot as plt
plt.plot([1,2,5])
plt.show()


It works fine in jupyter notebook, however when I try to run it using command line:



$ python3 main.py


It throws an error:



_tkinter.TclError: unknown color name "[97]#282a36"


The whole trackeback:



Traceback (most recent call last):
File "main.py", line 2, in <module>
plt.plot([1,2,5])
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 2811, in plot
return gca().plot(
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 935, in gca
return gcf().gca(**kwargs)
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 578, in gcf
return figure()
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 525, in figure
**kwargs)
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 3218, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/backends/_backend_tk.py", line 1008, in new_figure_manager_given_figure
window = Tk.Tk(className="matplotlib")
File "/usr/lib/python3.6/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: unknown color name "[97]#282a36"




I already tried changing matplotlib's backend:



import matplotlib
matplotlib.use('pdf') # Or using other arguments matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.plot([1,2,5])
plt.show()


It gives me the same error message.



I also tried installing matplotlib using pip and my distribution package manager, both giving me the same error.



tkinter has been installed from my distribution repositories.



Any suggest would be helpful, I couldn't find any solution on similar questions.










share|improve this question

























  • I think you would want to share the complete traceback, not just the last line of it.

    – ImportanceOfBeingErnest
    Nov 24 '18 at 14:44











  • @ImportanceOfBeingErnest Emptying .Xresources fixed the issue... don't know why. from here. And updated the question using the whole traceback.

    – Ravexina
    Nov 24 '18 at 14:48
















0















I've got a simple code:



from matplotlib import pyplot as plt
plt.plot([1,2,5])
plt.show()


It works fine in jupyter notebook, however when I try to run it using command line:



$ python3 main.py


It throws an error:



_tkinter.TclError: unknown color name "[97]#282a36"


The whole trackeback:



Traceback (most recent call last):
File "main.py", line 2, in <module>
plt.plot([1,2,5])
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 2811, in plot
return gca().plot(
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 935, in gca
return gcf().gca(**kwargs)
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 578, in gcf
return figure()
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 525, in figure
**kwargs)
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 3218, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/backends/_backend_tk.py", line 1008, in new_figure_manager_given_figure
window = Tk.Tk(className="matplotlib")
File "/usr/lib/python3.6/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: unknown color name "[97]#282a36"




I already tried changing matplotlib's backend:



import matplotlib
matplotlib.use('pdf') # Or using other arguments matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.plot([1,2,5])
plt.show()


It gives me the same error message.



I also tried installing matplotlib using pip and my distribution package manager, both giving me the same error.



tkinter has been installed from my distribution repositories.



Any suggest would be helpful, I couldn't find any solution on similar questions.










share|improve this question

























  • I think you would want to share the complete traceback, not just the last line of it.

    – ImportanceOfBeingErnest
    Nov 24 '18 at 14:44











  • @ImportanceOfBeingErnest Emptying .Xresources fixed the issue... don't know why. from here. And updated the question using the whole traceback.

    – Ravexina
    Nov 24 '18 at 14:48














0












0








0








I've got a simple code:



from matplotlib import pyplot as plt
plt.plot([1,2,5])
plt.show()


It works fine in jupyter notebook, however when I try to run it using command line:



$ python3 main.py


It throws an error:



_tkinter.TclError: unknown color name "[97]#282a36"


The whole trackeback:



Traceback (most recent call last):
File "main.py", line 2, in <module>
plt.plot([1,2,5])
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 2811, in plot
return gca().plot(
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 935, in gca
return gcf().gca(**kwargs)
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 578, in gcf
return figure()
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 525, in figure
**kwargs)
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 3218, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/backends/_backend_tk.py", line 1008, in new_figure_manager_given_figure
window = Tk.Tk(className="matplotlib")
File "/usr/lib/python3.6/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: unknown color name "[97]#282a36"




I already tried changing matplotlib's backend:



import matplotlib
matplotlib.use('pdf') # Or using other arguments matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.plot([1,2,5])
plt.show()


It gives me the same error message.



I also tried installing matplotlib using pip and my distribution package manager, both giving me the same error.



tkinter has been installed from my distribution repositories.



Any suggest would be helpful, I couldn't find any solution on similar questions.










share|improve this question
















I've got a simple code:



from matplotlib import pyplot as plt
plt.plot([1,2,5])
plt.show()


It works fine in jupyter notebook, however when I try to run it using command line:



$ python3 main.py


It throws an error:



_tkinter.TclError: unknown color name "[97]#282a36"


The whole trackeback:



Traceback (most recent call last):
File "main.py", line 2, in <module>
plt.plot([1,2,5])
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 2811, in plot
return gca().plot(
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 935, in gca
return gcf().gca(**kwargs)
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 578, in gcf
return figure()
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 525, in figure
**kwargs)
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 3218, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
File "/home/user/.local/lib/python3.6/site-packages/matplotlib/backends/_backend_tk.py", line 1008, in new_figure_manager_given_figure
window = Tk.Tk(className="matplotlib")
File "/usr/lib/python3.6/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: unknown color name "[97]#282a36"




I already tried changing matplotlib's backend:



import matplotlib
matplotlib.use('pdf') # Or using other arguments matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.plot([1,2,5])
plt.show()


It gives me the same error message.



I also tried installing matplotlib using pip and my distribution package manager, both giving me the same error.



tkinter has been installed from my distribution repositories.



Any suggest would be helpful, I couldn't find any solution on similar questions.







python python-3.x matplotlib






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 14:58







Ravexina

















asked Nov 24 '18 at 14:34









RavexinaRavexina

4961621




4961621













  • I think you would want to share the complete traceback, not just the last line of it.

    – ImportanceOfBeingErnest
    Nov 24 '18 at 14:44











  • @ImportanceOfBeingErnest Emptying .Xresources fixed the issue... don't know why. from here. And updated the question using the whole traceback.

    – Ravexina
    Nov 24 '18 at 14:48



















  • I think you would want to share the complete traceback, not just the last line of it.

    – ImportanceOfBeingErnest
    Nov 24 '18 at 14:44











  • @ImportanceOfBeingErnest Emptying .Xresources fixed the issue... don't know why. from here. And updated the question using the whole traceback.

    – Ravexina
    Nov 24 '18 at 14:48

















I think you would want to share the complete traceback, not just the last line of it.

– ImportanceOfBeingErnest
Nov 24 '18 at 14:44





I think you would want to share the complete traceback, not just the last line of it.

– ImportanceOfBeingErnest
Nov 24 '18 at 14:44













@ImportanceOfBeingErnest Emptying .Xresources fixed the issue... don't know why. from here. And updated the question using the whole traceback.

– Ravexina
Nov 24 '18 at 14:48





@ImportanceOfBeingErnest Emptying .Xresources fixed the issue... don't know why. from here. And updated the question using the whole traceback.

– Ravexina
Nov 24 '18 at 14:48












1 Answer
1






active

oldest

votes


















1














After reading this issue on matplotlib's Github page, I emptied out my .Xresources and it fixed the issue.



So I looked a little bit more into the .Xresources file and I found out a line:



*background:   [97]#282a36


Which was the cause of matplotlib complaining about a color nameed: [97]#282a36:



_tkinter.TclError: unknown color name "[97]#282a36"


Removing [97] from the line fixed the issue. remember that you have to run:



xrdb -merge .Xresources


To make the changes take place.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459224%2fcant-use-pyplot-due-to-tkinter-tclerror-unknown-color-name%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    After reading this issue on matplotlib's Github page, I emptied out my .Xresources and it fixed the issue.



    So I looked a little bit more into the .Xresources file and I found out a line:



    *background:   [97]#282a36


    Which was the cause of matplotlib complaining about a color nameed: [97]#282a36:



    _tkinter.TclError: unknown color name "[97]#282a36"


    Removing [97] from the line fixed the issue. remember that you have to run:



    xrdb -merge .Xresources


    To make the changes take place.






    share|improve this answer




























      1














      After reading this issue on matplotlib's Github page, I emptied out my .Xresources and it fixed the issue.



      So I looked a little bit more into the .Xresources file and I found out a line:



      *background:   [97]#282a36


      Which was the cause of matplotlib complaining about a color nameed: [97]#282a36:



      _tkinter.TclError: unknown color name "[97]#282a36"


      Removing [97] from the line fixed the issue. remember that you have to run:



      xrdb -merge .Xresources


      To make the changes take place.






      share|improve this answer


























        1












        1








        1







        After reading this issue on matplotlib's Github page, I emptied out my .Xresources and it fixed the issue.



        So I looked a little bit more into the .Xresources file and I found out a line:



        *background:   [97]#282a36


        Which was the cause of matplotlib complaining about a color nameed: [97]#282a36:



        _tkinter.TclError: unknown color name "[97]#282a36"


        Removing [97] from the line fixed the issue. remember that you have to run:



        xrdb -merge .Xresources


        To make the changes take place.






        share|improve this answer













        After reading this issue on matplotlib's Github page, I emptied out my .Xresources and it fixed the issue.



        So I looked a little bit more into the .Xresources file and I found out a line:



        *background:   [97]#282a36


        Which was the cause of matplotlib complaining about a color nameed: [97]#282a36:



        _tkinter.TclError: unknown color name "[97]#282a36"


        Removing [97] from the line fixed the issue. remember that you have to run:



        xrdb -merge .Xresources


        To make the changes take place.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 24 '18 at 14:56









        RavexinaRavexina

        4961621




        4961621
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459224%2fcant-use-pyplot-due-to-tkinter-tclerror-unknown-color-name%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            Refactoring coordinates for Minecraft Pi buildings written in Python