Python

Status
Not open for further replies.

NASbox

Guru
Joined
May 8, 2012
Messages
650
Sorry this might be a bit off topic, but I don't see a better place for this as the only one who could answer this question is going to be a developer who knows FreeNAS/BSD build "politics".

Any idea when Python2 is likely to be removed from FreeNAS?

The reason for my question is that I am currently running custom scripts written in Python2 on my FreeNAS box.

I have been reading that support for Python2 will be dropped in 2020, so unless the BSD folks decide to fork and continue support, some sort of change is going to be necessary. I noticed that Python3 is currently available, so that paves the way for the removal of Python2 on FreeNAS once it's no longer needed for either FreeNAS/BSD. Is Python2 used internally either by the OS/FreeNAS? If so, how much effort is being put into upgrading Python versons.

It would be nice to have some idea how much time I have to convert everything.

Thanks in advance. Any insights would be greatly appreciated.
 

rvassar

Guru
Joined
May 2, 2018
Messages
972

NASbox

Guru
Joined
May 8, 2012
Messages
650
It's not FreeNAS, or the upstream BSD crew... It's the Python devs themselves.

https://pythonclock.org/

Thanks @rvassar for the link. There is some good reference there. I'm well aware that this is being driven by the Python team, but I have seen discussion that implied that a possible response may be a "fork" that at least provides security updates. There is a long list of projects that are promissing to move to Python3 by 2020, but noticeably missing from that list are all Linux distros/FreeBSD.
 

rvassar

Guru
Joined
May 2, 2018
Messages
972
I have seen discussion that implied that a possible response may be a "fork" that at least provides security updates.


At this stage of the game, with EOL first announced back on November 3, 2008... You're kind of past the "implied possible response" wishful thinking phase of things, and are off into the panic'ed "port my scripts" phase. You need to get moving and port your scripts to Python 3.x. If that's not possible, you need to plan on building and supporting your own Python 2.7 package. That is entirely possible, and you can then connect with others that also need security patches, etc... But to expect entire distros to follow along with you is quite frankly, folly. The distros are going to abandon you without so much as a statement.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
At this stage of the game, with EOL first announced back on November 3, 2008... You're kind of past the "implied possible response" wishful thinking phase of things, and are off into the panic'ed "port my scripts" phase. You need to get moving and port your scripts to Python 3.x. If that's not possible, you need to plan on building and supporting your own Python 2.7 package. That is entirely possible, and you can then connect with others that also need security patches, etc... But to expect entire distros to follow along with you is quite frankly, folly. The distros are going to abandon you without so much as a statement.

@rvassar - you are likely right, as long as there isn't so much of it that time to convert/prerequisites become an issue. FreeNAS is pretty good in that both 2 & 3 exist at the moment, so it's easy to transition. pfSense only has Python 2 at this time which is going to make life a bit difficult (as I have a couple of small scripts running on pfSense which I won't be able to debug). I was wondering how much python 2 "glue" is being used in FreeBSD and what the state of the conversion project is (if it isn't already done)?
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
Much of FreeNAS' code has moved to Python 3 or is planned to. So, I'd say that it might not be around for much longer.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Much of FreeNAS' code has moved to Python 3 or is planned to. So, I'd say that it might not be around for much longer.

Thanks for the input @Ericloewe - Is it practical for me to install Python3 alongside Python2 so I can test my changes?

The scripts depend on hardware/names that only exist on the live box (Test for link down/cable disconnected etc) Unfortunately I don't have the luxury of a development box, so I have to work on my live firewall.

I'd rather not have an update kill my scripts and then have to scramble to figure out what to do.
 

rvassar

Guru
Joined
May 2, 2018
Messages
972
Is it practical for me to install Python3 alongside Python2 so I can test my changes?

My 11.1-U6 already has Python 3, but this is probably from my Plex plugin. Most Linux distro's are still shipping both. It's not only practical, but common. They're usually separated by using symlinks.

Code:
root@nas:~ # which python
/usr/local/bin/python
root@nas:~ # python --version
Python 3.6.3
root@nas:~ # ls -l /usr/local/bin/python
lrwxr-xr-x  1 root  wheel  7 Aug 22 08:04 /usr/local/bin/python -> python3


If you require modules outside the standard distribution, you may have to compile your own. But that should be pretty easy.
 
Last edited:

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
My 11.1-U6 already has Python 3, but this is probably from my Plex plugin.
No, your jails wouldn't affect the base system. As I said, FreeNAS already uses Python 3 substantially, if not completely.
 

rvassar

Guru
Joined
May 2, 2018
Messages
972
No, your jails wouldn't affect the base system. As I said, FreeNAS already uses Python 3 substantially, if not completely.

So you're saying the "/usr/local" stuff is part of the base system? I admit I haven't poked around in the FreeNAS core as much as I should, when I'm in there it's just another *nix to me. I was assuming the /usr/local tree was populated via the FreeBSD ports system.

If that's the case, both versions are already installed, and the default is Python 3.
Code:
root@nas:/ # ls -l `which python`
lrwxr-xr-x  1 root  wheel  7 Aug 22 08:04 /usr/local/bin/python -> python3
root@nas:/ # ls -l `which python2`
lrwxr-xr-x  1 root  wheel  9 Aug 22 08:04 /usr/local/bin/python2 -> python2.7
root@nas:/ # 
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
Everything the jails do is contained in their datasets. That's the whole point of jails and why they're called jails.
 

rvassar

Guru
Joined
May 2, 2018
Messages
972
Everything the jails do is contained in their datasets. That's the whole point of jails and why they're called jails.

My Plex jail dataset contains python 2.7 in its version of /usr/local, but not Python 3. The root system /usr/local on my 11.1-U6 contains both. I installed Plex via "plugin" facility in the UI. It lives in a "jail", which was constructed, presumably from bits and pieces the install scripts had available to it. Which leaves the providence of /usr/local a valid question. Does the Plex install script pull in Python 2.7 from BSD Ports and then copy it into the jail? Or is /usr/local simply where both versions of Python live in FreeNAS? That's the question I can't answer without a fresh install, and that's the only thing our original poster is likely to care about. ;)
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
The Plex install script, being jailed, cannot do anything to the host (certain exceptions apply).

The Plex installer presumably runs pkg install list of packages needed, and that operates on the jail's filesystem.


Or is /usr/local simply where both versions of Python live in FreeNAS?
This.
 

Kelly Hays

Dabbler
Joined
Apr 25, 2017
Messages
16
Any version of FreeNAS that supports iocage will have python3 since iocage requires python3.
 
Status
Not open for further replies.
Top