Community
    • Login

    Unable to use MatPlotLib in Python Files

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 2 Posters 662 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • bungoscrungusB
      bungoscrungus
      last edited by

      Despite having installed it, and MatPlotLib seeming to work fine in Thonny and IDLE, I am unable to use MatPlotLib at all in Notepad++. Everytime I do, I get a ModuleNotFoundError.

      It should be noted that other modules I’ve used, like NumPy and math, are completely fine. It’s just MatPlotLib. I’ve tried uninstalling MatPlotLib, reinstalling it, updating it, updating pip, using pip install commands within Notepad++, restarting Notepad++, restarting my computer, and nothing has worked. What’s going on?

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @bungoscrungus
        last edited by PeterJones

        @bungoscrungus ,

        How are you running the python file in Notepad++? Are you using a Run menu entry? Or are you using NppExec Plugin? Or some other plugin to run it? Or some other way?

        Depending on what your answer is, the debug process might be slightly different.

        (It should be noted that while I am a casual user of Python, I am not an expert at library issues. But there are a couple of the regulars here who are probably more familiar with library issues, and once they know how you’re running Python through Notepad++, they might be able to help you figure out why it’s behaving differently than via Thonny or IDLE.)

        bungoscrungusB 1 Reply Last reply Reply Quote 0
        • bungoscrungusB
          bungoscrungus @PeterJones
          last edited by

          @PeterJones I’ve used both the Run menu entry, and the NppExec plugin, and have gotten the same result for both. I’m willing to use either.

          PeterJonesP 2 Replies Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @bungoscrungus
            last edited by

            @bungoscrungus said in Unable to use MatPlotLib in Python Files:

            @PeterJones I’ve used both the Run menu entry, and the NppExec plugin, and have gotten the same result for both. I’m willing to use either.

            Okay, that will be helpful for the Notepad++ regulars who are also Python experts.

            That doesn’t give my limited experience any solid clues. My only guesses would be to check whether there are environment variables that are set differently from within Notepad++'s NppExec console vs the env vars that Thonny or IDLE see. But that’s a pretty lame guess; hopefully one of the others will be able to give you more.

            Given the time zone differences involved, it may be their tomorrow – or yours – before they have a chance to chime in.

            1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @bungoscrungus
              last edited by PeterJones

              @bungoscrungus

              The other ideas I’ve had:

              • if you can share the path to python.exe, the path to NumPy, and the path to MatPlotLib, that might help – if one is in an “unusual” location relative to the others, then some behind-the-scenes difference might not allow the Notepad++ run of python to see the library
              • if you can print out your sys.path entries under IDLE vs under Notepad++, that is probably useful information as well
              • it would probably be good for you to see whether you get it working or the ModuleNotFound error if you run the script from the windows command line (cmd.exe or powershell). If it doesn’t run under the standard command line, then it’s probably a directory/sys.path issue where Thonny and IDLE are better at guessing alternative locations for libraries; if it does run under command line, then I’m out of my depth
              bungoscrungusB 1 Reply Last reply Reply Quote 2
              • bungoscrungusB
                bungoscrungus @PeterJones
                last edited by

                @PeterJones I didn’t think of checking the command line, thanks! The error appeared there, too. This might be the first time I’ve been glad to see a module error – thank you!

                It turns out a program I had also had python.exe, and Notepad++ was using that Python instead. Uninstalled the program, MatPlotLib works perfectly! Thank you!

                1 Reply Last reply Reply Quote 4
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors