• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Python 3 in pfsense

Scheduled Pinned Locked Moved pfSense Packages
28 Posts 9 Posters 12.7k 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.
  • J
    jimp Rebel Alliance Developer Netgate
    last edited by Mar 11, 2019, 3:41 PM

    If you edit the shabang line to use the correct path to the binary, yes. If you have more questions, please start your own thread as it isn't related to this topic.

    Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

    Need help fast? Netgate Global Support!

    Do not Chat/PM for help!

    1 Reply Last reply Reply Quote 0
    • J
      jwsi
      last edited by Nov 30, 2019, 12:00 AM

      To solve this I have created a public repo on GitHub with precompiled Python 3 binaries for specific releases of pfSense:

      pfSense Python 3

      If you follow the instructions, it's a very straightforward process and will allow you to choose whatever Python 3 version works for you :)

      G 1 Reply Last reply Jan 21, 2020, 3:39 AM Reply Quote 1
      • G
        guardian Rebel Alliance @jwsi
        last edited by Jan 21, 2020, 3:39 AM

        @jwsi Thanks very much for this. I was wondering how to approach this issue.

        I was wondering if I could simplify the installation procedure... I just want python3.6 for amd64, can I just download from github to /root on my pfSense box?

        curl -L -o Python3.6_pfSense2.4.4-RELEASE-p3_amd64.txz  https://github.com/ultrahorizon/pfSense-Python3/raw/master/2.4.4-RELEASE-p3/amd64/3.6.txz
        pkg add Python3.6_pfSense2.4.4-RELEASE-p3_amd64.txz
        

        I'm assuming that it does not matter that I renamed the file Python3.6_pfSense2.4.4-RELEASE-p3_amd64.txz as long as I use the same file name in the pkg add command.
        (Note the -L option since github redirects the URL obtained by saving the link on the download button.)

        I'm hoping this is OK so I don't need to clone the whole repo and install git.

        If you find my post useful, please give it a thumbs up!
        pfSense 2.7.2-RELEASE

        1 Reply Last reply Reply Quote 0
        • J
          jwsi
          last edited by Jan 21, 2020, 9:09 AM

          Hi @guardian,

          So this is actually documented in the "Easy Installation" section of the README.

          For Python 3.6 on amd64 you can simply execute:

          cd /tmp
          fetch https://github.com/ultrahorizon/pfSense-Python3/raw/master/2.4.4-RELEASE-p3/amd64/3.6.txz
          pkg add 3.6.txz
          

          Then the file will be removed from the /tmp folder in due course. I would probably advise downloading to the tmp folder or deleting the .txz file after install because there's no need to keep it around.

          Let me know if that works for you ☺

          G 1 Reply Last reply Jan 21, 2020, 11:17 PM Reply Quote 2
          • G
            guardian Rebel Alliance @jwsi
            last edited by Jan 21, 2020, 11:17 PM

            @jwsi Thanks... that does the fetch just fine... still working a few things out before I run it.

            I assume this leaves python2.7 Installed and I run the new python as /usr/local/bin/python3.6 correct?

            Does install include pip? If not, how do I install it (I need a couple of extra packages)

            What command do I use to run pip for python3.6 instead of python2.7?

            P.S.: For the benefit of anyone running this that doesn't know their way around the command line, they can just run rm 3.6.txz after the install is done to get rid of the file.

            If you find my post useful, please give it a thumbs up!
            pfSense 2.7.2-RELEASE

            1 Reply Last reply Reply Quote 0
            • J
              jwsi
              last edited by Jan 21, 2020, 11:33 PM

              Great to hear that it works @guardian.

              If you reload the pfSense shell after installing (type exit then hit option 8 again) you will be able to use Python 3.6 by typing python3.6 in the command line. However, the full path you quoted is indeed correct too.

              With regards to pip, this is already bundled as a module. To install simply execute:

              python3.6 -m ensurepip

              Then Python3's pip is available under the command pip3 (another shell reload will likely be required here...). It's also advised to upgrade pip to the latest version too. Therefore, after installation execute:

              pip3 install --upgrade pip

              G 1 Reply Last reply Jan 21, 2020, 11:43 PM Reply Quote 0
              • G
                guardian Rebel Alliance @jwsi
                last edited by Jan 21, 2020, 11:43 PM

                @jwsi said in Python 3 in pfsense:

                Great to hear that it works @guardian.

                If you reload the pfSense shell after installing (type exit then hit option 8 again) you will be able to use Python 3.6 by typing python3.6 in the command line. However, the full path you quoted is indeed correct too.

                With regards to pip, this is already bundled as a module. To install simply execute:

                python3.6 -m ensurepip

                Then Python3's pip is available under the command pip3 (another shell reload will likely be required here...). It's also advised to upgrade pip to the latest version too. Therefore, after installation execute:

                pip3 install --upgrade pip

                @jwsi thank you very much. I've just used default python2.7 on all my systems till now (don't do much dev-just the odd admin/helper script), so now I have to learn how to do things properly so that really helps. I will wait till I upgrade from p2 -> p3 before running, but I'll report back to confirm that everything works OK.

                If you find my post useful, please give it a thumbs up!
                pfSense 2.7.2-RELEASE

                J 1 Reply Last reply Jan 21, 2020, 11:47 PM Reply Quote 0
                • J
                  jwsi @guardian
                  last edited by Jan 21, 2020, 11:47 PM

                  @guardian great! Look forward to hearing how you get on ☺

                  1 Reply Last reply Reply Quote 1
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                    [[user:consent.lead]]
                    [[user:consent.not_received]]