• Login
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.
  • A
    Alan Kilborn
    last edited by Feb 28, 2020, 1:57 PM

    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
    • E
      Ekopalypse
      last edited by Feb 28, 2020, 2:16 PM

      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
      • H
        hcchen
        last edited by Jan 6, 2022, 7:37 AM

        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.

        M 1 Reply Last reply Jan 6, 2022, 12:11 PM Reply Quote 0
        • M
          Michael Vincent @hcchen
          last edited by Jan 6, 2022, 12:11 PM

          @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.

          M 1 Reply Last reply Jan 6, 2022, 2:02 PM Reply Quote 1
          • M
            Michael Vincent @Michael Vincent
            last edited by Jan 6, 2022, 2:02 PM

            @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