Python development in a jail

Berkyjay

Contributor
Joined
Nov 7, 2015
Messages
100
Version: TrueNAS-13.0-U3.1 Core

So I wrote a set of python tools to manage files on my server. I did most of my development on my windows box. I then am using a git repository in a jail I created specifically for the purpose of running this tool. I am using Python 3.11 which I also installed in my jail. Mostly things have been working fine because I wasn't using any 3rd party modules in my tools. But recently I have been integrating a few 3rd party modules for some updates I'm working on. Specifically a fuzzy search module theFuzz and the TVDB python module. This is when I started running into issues. Both those modules appeared to install without issue. But I noticed that they weren't available when I tried running the tool from the jail.

The more I dug into it I noticed that those modules were actually installed into a 3.9 site-package directory, `.local/lib/python3.9/site-packages`. It seems like I installed python3.11 incorrectly because if I try running python3.11 -m pip --version it tells me that I don't have a module named "pip".

So I need some help sorting things out and setting things up so I can do proper python development in my jail. I use VS Code and would love to be able to remote connect to my jail and work directly on the git repository in the jail. But so far that has eluded me. So I was hoping to find someone here to help me sort these issues out.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Seems to me that the past version of pip (at least on pkg) is for python 3.9, hence where you see it installed.

You can confirm that on your system with pkg search pip and see the results
 

Berkyjay

Contributor
Joined
Nov 7, 2015
Messages
100
Seems to me that the past version of pip (at least on pkg) is for python 3.9, hence where you see it installed.

You can confirm that on your system with pkg search pip and see the results
I'm pretty sure that 3.9 is the default python version from Core. So I'm curious as to how to make the 3.11 version I installed the default version.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
if I try running python3.11 -m pip --version it tells me that I don't have a module named "pip".
Do you need to solve that problem (although you won't be able to)?

Otherwise, you can look at the links from ls -l /usr/local/bin/python* and change those as you require
 

Berkyjay

Contributor
Joined
Nov 7, 2015
Messages
100
Do you need to solve that problem (although you won't be able to)?

Otherwise, you can look at the links from ls -l /usr/local/bin/python* and change those as you require
Well ultimately I'd like to better understand how to properly do python development in this jail in mind. It would be nice to be able to get my VS Code pipeline working with it. But first I feel I need to sort out the Python version discrepancy.

So here's what I got from running the ls command:

Code:
lrwxr-xr-x  1 root  wheel     9 Dec  1 16:31 /usr/local/bin/python3 -> python3.9
lrwxr-xr-x  1 root  wheel    16 Dec  1 16:31 /usr/local/bin/python3-config -> python3.9-config
-r-xr-xr-x  1 root  wheel  5168 Dec  7 17:19 /usr/local/bin/python3.11
-r-xr-xr-x  1 root  wheel  3113 Dec  7 17:20 /usr/local/bin/python3.11-config
-r-xr-xr-x  1 root  wheel  5200 Nov 30 17:10 /usr/local/bin/python3.9
-r-xr-xr-x  1 root  wheel  3153 Nov 30 17:11 /usr/local/bin/python3.9-config


It's obviously pointing to 3.9. But while searching for how to change the symlink, almost everyone says to not do this because it could break other dependencies in the jail. They recommend using an alias, which I already have set up. So the root problem I'm trying to get around is that when I install modules using pip, it's using 3.9. When I try python3.11 -m pip it shows that pip isn't even installed for that version.

So yeah, these are my current issues. I just need some guidance on sorting python out right now and then hopefully that will help me sort out the other issues.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
When I try python3.11 -m pip it shows that pip isn't even installed for that version.
As I have indicated already a couple of times, Python 3.11 doesn't have an available pkg for pip on FreeBSD at this time, so you can't expect that to be fixed (at least for now). Maybe you could use ports to build it for yourself if the source is available.
 

Berkyjay

Contributor
Joined
Nov 7, 2015
Messages
100
As I have indicated already a couple of times, Python 3.11 doesn't have an available pkg for pip on FreeBSD at this time,
Sorry, but that wasn't clear at all. That sucks though. I guess I should really look seriously into upgrading to Scale.
 
Joined
Dec 29, 2014
Messages
1,135
You could also do some flavor of Linux VM for development. It does seem that the FreeBSD packages for anything later than 3.9 aren't there. Just curious, but what are you using that requires 3.11?
 

Berkyjay

Contributor
Joined
Nov 7, 2015
Messages
100
You could also do some flavor of Linux VM for development. It does seem that the FreeBSD packages for anything later than 3.9 aren't there. Just curious, but what are you using that requires 3.11?
Mainly for the speed improvements. I'm parsing some 40TB of files. But that's not the real deal breaker I found. I have 3.11 installed and am using it with my tool. I just use an alias when calling it when I'm ssh'ing into the jail. I'm not able to get theFuzz module working because I am unable to install the levenshtein module that it needs.
 
Top