Python 3 installation in 2022.1

Posted on
Thu May 12, 2022 12:28 pm
Turribeach offline
Posts: 429
Joined: Feb 06, 2015
Location: London, UK

Python 3 installation in 2022.1

So I just installed 2022.1 and it obviously installed Python 3.10 as expected. However I wasn't expecting it to changed my PATH variable whicvh it added the following in front:

/Library/Frameworks/Python.framework/Versions/3.10/bin

This basically made my already existing version of Python 3.9 non-visible to other Python code that I run on my machine. I am not sure adding Indigo's Python install in the path like this is the best solution. I wonder if Indigo could be sourcing the Python binary from a config file or some other place to avoiding impacting people that use Python for other things. While I could use the Indigo 3.10 Python install for my other stuff I would prefer to have them separate so don't install packages for my other dev work in the Indigo Python. Also I would have preferred to have Indigo's Python installation self contained in the Indigo directory so that no toher programs could see it or use it. Not sure if that's possible...

Posted on
Thu May 12, 2022 1:19 pm
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python 3 installation in 2022.1

The vast majority of users who use Indigo won't have/need multiple version of Python 3. Those that do can easily change their shell path to point to the version they want since they will likely have the knowledge/understanding of how to keep python versions separate.

Using the installer directly from the Python Software Foundation means that we get the benefit of all the testing that occurs when a new version of Python is released - something that if we embed python we would be responsible for. That is simply too much work for a tiny company like us.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Mar 02, 2023 1:05 pm
kyphos offline
Posts: 54
Joined: Dec 17, 2014

Re: Python 3 installation in 2022.1

I understand that v2022 installs Python 3. In doing so, does it overwrite/override the existing installation of Python 2.7, in particular, the one that comes with macOS 10.13 ?
I have another HA application that uses Python 2 and there's no immediate path to upgrade it to Python 3.
Will installation of v2022.2 impact the operation of the Python 2 application??

Jay's reply (above) indicates that users needing multiple versions of Python "will likely have the knowledge/understanding of how to keep python versions separate". Unfortunately, that's beyond my pay grade.

Thanks.

:arrow: Indigo 2023.1.1, macOS 10.13.6 (High Sierra), Mac mini5,1 (Intel Core i5), PowerLinc 2413U

Posted on
Thu Mar 02, 2023 1:59 pm
Turribeach offline
Posts: 429
Joined: Feb 06, 2015
Location: London, UK

Re: Python 3 installation in 2022.1

Indigo won't touch your Python 2 install so it will not impact HA. But be aware that the last security update for MacOS Sierra came ~2.5 years ago so you really shouldn't be running anything on that OS yet alone anythng that could potentially interface with the Internet.

Posted on
Thu Mar 02, 2023 3:28 pm
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python 3 installation in 2022.1

Turribeach wrote:
Indigo won't touch your Python 2 install so it will not impact HA. But be aware that the last security update for MacOS Sierra came ~2.5 years ago so you really shouldn't be running anything on that OS yet alone anythng that could potentially interface with the Internet.


Correct - Indigo's installed Python 2.7 doesn't install in the same location as the built-in python. At most, you'll need to make sure that you point to the correct version when you start up your other python app.

Here's what you might see in MacOS Sierra (10.12, which I understand is a release behind you):

Code: Select all
Sierra:~ admin$ /usr/bin/python
Python 2.7.10 (default, Feb  7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> # this is Apple's built-in python 2
... pass
>>> ^D
Sierra:~ admin$ /usr/local/bin/python
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 19 2020, 20:48:48)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> # this is our installed version of python 2
... pass
>>> ^D


The first one starts up the built-in python. The second one starts up the one we install.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Mar 02, 2023 8:12 pm
kyphos offline
Posts: 54
Joined: Dec 17, 2014

Re: Python 3 installation in 2022.1

Turribeach wrote:
Indigo won't touch your Python 2 install so it will not impact HA. But be aware that the last security update for MacOS Sierra came ~2.5 years ago so you really shouldn't be running anything on that OS yet alone anythng that could potentially interface with the Internet.


Understood. My home automation Mac (with 10.13) is not exposed to the internet, and lives on an isolated subnet.

Thanks for the answer re Python 2.

:arrow: Indigo 2023.1.1, macOS 10.13.6 (High Sierra), Mac mini5,1 (Intel Core i5), PowerLinc 2413U

Posted on
Thu Mar 02, 2023 8:33 pm
kyphos offline
Posts: 54
Joined: Dec 17, 2014

Re: Python 3 installation in 2022.1

jay (support) wrote:
Turribeach wrote:
Indigo won't touch your Python 2 install so it will not impact HA. But be aware that the last security update for MacOS Sierra came ~2.5 years ago so you really shouldn't be running anything on that OS yet alone anythng that could potentially interface with the Internet.


Correct - Indigo's installed Python 2.7 doesn't install in the same location as the built-in python. At most, you'll need to make sure that you point to the correct version when you start up your other python app.

Here's what you might see in MacOS Sierra (10.12, which I understand is a release behind you):

Code: Select all
Sierra:~ admin$ /usr/bin/python
Python 2.7.10 (default, Feb  7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> # this is Apple's built-in python 2
... pass
>>> ^D
Sierra:~ admin$ /usr/local/bin/python
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 19 2020, 20:48:48)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> # this is our installed version of python 2
... pass
>>> ^D


The first one starts up the built-in python. The second one starts up the one we install.


Jay,
I thought I read (recent blog post?) that v2022 .2 now installs Python 3, not 2.7.18 as in your example above.

No matter - whatever version Indigo installs, it seems that the existing Python 2 setup that's bundled with macOS won't be impacted, so my legacy Python2 app will continue to run. That's what I was hoping for.

Thanks!

Posted on
Fri Mar 03, 2023 9:30 am
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python 3 installation in 2022.1

kyphos wrote:
I thought I read (recent blog post?) that v2022 .2 now installs Python 3, not 2.7.18 as in your example above.


We install both (one reason why the installer takes so long to run). In the next release (2023.1), we won't install Python 2 and will no longer support plugins that haven't been updated to use Python 3.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Mar 03, 2023 11:59 am
kyphos offline
Posts: 54
Joined: Dec 17, 2014

Re: Python 3 installation in 2022.1

jay (support) wrote:
kyphos wrote:
I thought I read (recent blog post?) that v2022 .2 now installs Python 3, not 2.7.18 as in your example above.


We install both (one reason why the installer takes so long to run). In the next release (2023.1), we won't install Python 2 and will no longer support plugins that haven't been updated to use Python 3.


Thanks for the explanation. The blog post on 2022.2 doesn't explicitly say that you install both Python 2 and 3, but I suppose that fact can be inferred (by those with more knowledge than me) as it mentions that Python 2 plug-ins are still supported for the time being.

The migration to Python 3 sounds great, and you've done a ton of work to make the transition smooth. Thanks.

:arrow: Indigo 2023.1.1, macOS 10.13.6 (High Sierra), Mac mini5,1 (Intel Core i5), PowerLinc 2413U

Posted on
Tue Mar 07, 2023 10:05 am
kyphos offline
Posts: 54
Joined: Dec 17, 2014

Re: Python 3 installation in 2022.1

jay (support) wrote:

We install both (one reason why the installer takes so long to run). In the next release (2023.1), we won't install Python 2 and will no longer support plugins that haven't been updated to use Python 3.


Jay,
I installed 2022.2, upgrading from v6. As you indicated, it installed Python 2.7.18 at /usr/local/bin, and also Python 3.10.2.
For reasons I don't understand, my legacy Python 2 app was not happy when it tried to run against the new 2.7.18, although it worked fine with 2.7.16 (which is what High Sierra ships with). The app is pretty simple, but there's something different between Indigo's 2.7.18 environment and the 'stock' 2.7.16 environment that causes it grief.

Fortunately, thanks to your advice, the fix was easy. A quick edit to my legacy shell script /usr/bin/python to explicitly use Apple's built-in python2 resolved the issue. I would have spent ages troubleshooting had you not posted your reply above detailing the location of the two v2 Pythons.
Thanks for the VERY helpful explanation :D

Out of curiosity, when you ship 2023.1, will the installer remove Indigo's python2 (at /usr/local/bin) if it had been installed by a previous Indigo installer? Or will you just leave it be?

:arrow: Indigo 2023.1.1, macOS 10.13.6 (High Sierra), Mac mini5,1 (Intel Core i5), PowerLinc 2413U

Posted on
Tue Mar 07, 2023 10:25 am
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python 3 installation in 2022.1

kyphos wrote:
jay (support) wrote:
For reasons I don't understand, my legacy Python 2 app was not happy when it tried to run against the new 2.7.18, although it worked fine with 2.7.16 (which is what High Sierra ships with). The app is pretty simple, but there's something different between Indigo's 2.7.18 environment and the 'stock' 2.7.16 environment that causes it grief.


Does your script use any external modules? Maybe you just need to install them using /usr/local/bin/pip2. There were definitely some security fixes between the built-in python 2 and the last release of python 2 (2.7.16),

Of course, I recommend upgrading anything using Python to Python 3 - feel free to post your script on this forum and I'm sure that you'll get lots of help converting it.

kyphos wrote:
Out of curiosity, when you ship 2023.1, will the installer remove Indigo's python2 (at /usr/local/bin) if it had been installed by a previous Indigo installer? Or will you just leave it be?


We will leave it in place. The 2023.1+installer won't install it, but we won't remove it either.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Mar 07, 2023 12:12 pm
kyphos offline
Posts: 54
Joined: Dec 17, 2014

Re: Python 3 installation in 2022.1

Jay,
I don't disagree with your recommendation to convert old software from python2 to 3.
However, I took a quick look at the vendor's support site. It's a h/w + s/w offering (Phidgets) that I use to interconnect to my home alarm system as well as monitor my furnace and some other HA gear. They do support Python 3 now, but they completely changed their architecture as part of their technology evolution. As a result, my python2 program would have to be redesigned and rewritten to conform to their new structure. So I'll stick with what I've got for as long as I can keep a Python2 platform in place.
Thanks.

:arrow: Indigo 2023.1.1, macOS 10.13.6 (High Sierra), Mac mini5,1 (Intel Core i5), PowerLinc 2413U

Posted on
Tue Mar 07, 2023 1:39 pm
FlyingDiver offline
User avatar
Posts: 7184
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Python 3 installation in 2022.1

The Python 2 install will remain in the 2023.1 release, but Python 2 plugins will no longer work as the P2 IndigoPluginHost.app will be gone.

If your code isn’t running under IPH then you’re ok.

Sent from my iPhone using Tapatalk

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Mar 08, 2023 8:02 am
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python 3 installation in 2022.1

FlyingDiver wrote:
The Python 2 install will remain in the 2023.1 release


Slight clarification: 2023.1 will not install Python 2. If you are upgrading from a previous version, the Python 2 install from that installation will remain in place - it just won't be used with 2023.1 and beyond.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed May 31, 2023 9:06 pm
hamw offline
Posts: 1212
Joined: Mar 31, 2008

Re: Python 3 installation in 2022.1

Kyphos,

I am also using Phidgets 21 library. I upgraded to 2022.2 and Monterey. Could you let me know what you did to point to the python library? I am not very good at this and while the Fisher 21 library loads, it does not bring the Phidgets boards online.

Jay, if nothing should’ve changed, do you have any idea why the plug-in appears to work but doesn’t see the boards?

Also, I am glad to hear you all are not completely ditching python 2.7. It’s really hard to keep changing things.

Who is online

Users browsing this forum: No registered users and 2 guests

cron