# node16 depends on python310 and python38 simultaneously



## bvgdas (Apr 5, 2022)

I use python310 as system default (/etc/make.conf). When I try to build node16 from ports it tries to build and install dependant python38 port.
I have already HATED python! All packages try to install ALL versions of python to my system at the same time!!! When will this stupid python language die to end this python nightmare?



```
[root:/usr/ports/www/node16]# make all-depends-list| grep python                                                                   (main✱)
/usr/ports/lang/python310
/usr/ports/lang/python38
```


----------



## SirDice (Apr 5, 2022)

www/node16 has a hard dependency on the version of Python, it only accepts 3.6, 3.7, 3.8 or 3.9. 


```
USES=		compiler:c++11-lib gmake python:3.6-3.9,build pkgconfig \
		localbase shebangfix
```



bvgdas said:


> When will this stupid python language die to end this python nightmare?


Stick to the default version of Python (3.8 at this time).


----------



## j77h (Apr 30, 2022)

bvgdas said:


> I use python310 as system default



On all unix and unix-like systems, "system python" *really is part of the system*,
so you need to avoid changing it in any way.

Modules in official ports and packages are set up to run with a specific FreeBSD version,
including the system Python (not modified in any way) that comes with that version.

When using *pip* to install a module for the system's python version, do it as yourself, not root, and include "*--user*" in the pip command, so that the module does *not* go into the system python directory, and instead goes into "~/.local/lib/python3.8/site-packages", which you can fool around with as much as you like.

Whatever you install in "~/.local/.../site-packages" will be run by the *system*'s python *interpreter*, but when the system runs a python script *as root*, it does not look in there, so cannot be affected by it.
When you run python as yourself, it prefers to load a module from *your local* site-packages, if the same module also exists in system site-packages. So it's possible to customize a local module, to get different behaviour when it runs as you (but it has to be for the same python version).

If you need a version of python later than system python, look in freshports;
current latest is 'https://www.freshports.org/lang/python310' (updated a few days ago).
You'll need to install it in a custom location so it does not conflict with system python,
but I don't yet know how to do that on FreeBSD.

On the command line, 'python' must always run system python,
so you run a non-system python by giving the whole path to its executable,
or by giving its executable another name so that you can put it in the path,
or by putting a symlink or a script that calls it in the path.
(The other name can be anything you like, as long as it doesn't conflict with something else.)

On Linux, I found that I couldn't simply copy the system python to another place and run it separately,
as it seemed to be hard-coded to use the system's "/lib/pythonN.N" directory.
Maybe it's like that in all unix-type OSes -- in Windows it's not.

Apart from that, python is very flexible about how and where you run it.

On Linux I used pyenv to install an independent python interpreter (any version);
it downloads the source and compiles it to run from any location that you specify.


----------



## Alain De Vos (Apr 30, 2022)

I use node17 together with python39


----------

