Community
    • Login

    How to use "pip" with Pythonscript plugin?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 4 Posters 1.3k 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.
    • Alan KilbornA
      Alan Kilborn
      last edited by

      If you want to use a Python module that isn’t part of the Pythonscript plugin out of the box, what’s the method for getting it installed? I’m sure it involves pip but I don’t know the details.

      For instance, if I wanted to install the “camelcase” module into my Pythonscript environment, how can I do it so that import camelcase succeeds?

      1 Reply Last reply Reply Quote 1
      • EkopalypseE
        Ekopalypse
        last edited by

        The only way I see currently is to install python 2.7 locally and use pip to install the library.
        Change the setting to prefer local installation from PS config dialog

        a55a0a56-79cb-4c0b-8cac-d03e91f712a8-image.png

        1 Reply Last reply Reply Quote 3
        • hcchenH
          hcchen
          last edited by

          I found this README.txt at “c:\Program Files (x86)\Notepad++\plugins\PythonScript\lib\site-packages\README.txt” and it says:
          “”"
          This directory exists so that 3rd party packages can be installed
          here. Read the source for site.py for more details.
          “”"
          Copy packages from another python 2.7 virtual environment to the above directory should work.

          Michael VincentM 1 Reply Last reply Reply Quote 0
          • Michael VincentM
            Michael Vincent @hcchen
            last edited by

            @hcchen

            I use the 3.0.7-alpha version of PythonScript and I do not have the aforementioned config checkbox checked. I installed the minimal version meaning it has the Npp libraries and not much else. I don’t think I have anything special setup in my startup.py, it just seems to find all my system Python modules. In fact, from the PythonScript console:

            >>> for p in sys.path: print(p)
            ... 
            C:\usr\bin\npp64\plugins\PythonScript\lib
            C:\usr\bin\npp64\plugins\Config\PythonScript\lib
            C:\usr\bin\npp64\plugins\PythonScript\scripts
            C:\usr\bin\npp64\plugins\Config\PythonScript\scripts
            C:\usr\bin\npp64\plugins\PythonScript\lib\lib-tk
            C:\usr\bin\npp64\plugins\PythonScript\python38.zip
            C:\Python3\Lib
            C:\Python3\DLLs
            C:\usr\bin\npp64
            C:\Users\VinsWorldcom\AppData\Roaming\Python\Python38\site-packages
            C:\Users\VinsWorldcom\AppData\Roaming\Python\Python38\site-packages\win32
            C:\Users\VinsWorldcom\AppData\Roaming\Python\Python38\site-packages\win32\lib
            C:\Users\VinsWorldcom\AppData\Roaming\Python\Python38\site-packages\Pythonwin
            C:\Python3
            C:\Python3\lib\site-packages
            

            Is that normal? Because I like this behavior - means I just install stuff in my system Python and I can use it normally as well as in Npp scripts. Makes the simple Python IDE thing Eko gave us a while back and I’ve been tweaking since work very nicely!

            Cheers.

            Michael VincentM 1 Reply Last reply Reply Quote 1
            • Michael VincentM
              Michael Vincent @Michael Vincent
              last edited by

              @michael-vincent said in How to use "pip" with Pythonscript plugin?:

              the simple Python IDE thing Eko gave us a while back

              should have linked that.

              Cheers

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