Python Module Not Found



  • So I am new to NPP and I am trying to use it as my main code editor for Python. However, I am having trouble importing numpy and seeing its auto-completion. Below is the code that I have already.

    print(‘Hello World’)

    import numpy as np

    np.

    After the np., I would like to see suggestions for different numpy methods. When I try to run the code there is an error on the import numpy as np line. The error is shown below.

    ImportError:
    Importing the multiarray numpy extension module failed. Most
    likely you are trying to import a failed build of numpy.
    If you’re working with a numpy git repo, try git clean -xdf (removes all
    files not under version control). Otherwise reinstall numpy.

    Original error was: DLL load failed: The specified module could not be found.

    Does anybody have any suggestions?

    Thank you!



  • @Ryan-DeVine

    the first question would be if you have numpy installed?
    The second, how do you run the script? Via run menu? NppExec? PythonScript??

    And autocompletion, most likely doesn’t work as expected as there is no such thing
    like LSP client available yet.



  • @Ryan-DeVine said:

    After the np., I would like to see suggestions for different numpy methods.

    Unfortunately, N++ doesn’t work that way with it.

    When I try to run the code there is an error on the import numpy as np line

    Well, that’s not Notepad++ related so this isn’t the best place to ask it.



  • @Ryan-DeVine ,

    Regarding the auto-completion: yeah, that would be awesome. Can you imagine how difficult the task would be of implementing such auto-completion for all the programming languages that Notepad++ natively supports (see the Language menu to see how many there are). From my vague knowledge of LSP (I’ve run across the term a few times, but never used an LSP-enabled system), I think that’s one of the problems that LSP addresses, but I’m not sure.

    For a specific use case (for example, just Python), someone might be able to code up a plugin or automation script (*) to do it, using something like, "check the current filetype: if it’s not python, exit the script; otherwise, parse this file and all the imported modules looking for functions and methods that it currently has access to; once that list is built, edit the AUTOCOMPLETE table to include those functions/methods; repeat ad infinitum. But that’s a pretty big task, too.

    *: there’s even a PythonScript plugin, where a python2.7 dll gets loaded into Notepad++, and gives that specific instance of python access to the internals of Notepad++. That would be pretty meta, making a python auto-complete gizmo that’s written in python, running inside Notepad++, which you could use while editing your other PythonScript scripts from inside of Notepad++. 🤯



  • @PeterJones

    From my vague knowledge of LSP (I’ve run across the term a few times, but never used an LSP-enabled system), I think that’s one of the problems that LSP addresses, but I’m not sure.

    exactly, the goal is to have the “language” responsible to provide such information
    instead of reinventing the wheel by every editor. LSP defines just the protocol how
    a communication of a client and a server has to work, the editor implements
    the client part whereas some other instance provides the server part.


Log in to reply