# Port wants python27 but I have python37 installed



## Nogshale (Jul 10, 2018)

Just wondering if anyone can help me with installing some ports.

I'm trying to install Postfix, part of its dependencies are mysql56-client-->cmake-->jsconcpp-->scons-->py27-setuptools-->python27

I already have Python 37 installed and don't want python 27 or its setuptools being installed.

Is there some way I can get scons to install using the already installed python37? 

I have this in /etc/make.conf at the moment.

```
DEFAULT_VERSIONS+=perl5=5.28
DEFAULT_VERSIONS+=python=3.7
DEFAULT_VERSIONS+=python3=python=3.7
```
Thanks


----------



## SirDice (Jul 10, 2018)

devel/scons appears to have a hard dependency on Python 2.7:

```
USES= python:2.7 shebangfix
```
I'm betting the code doesn't work with 3.x, which is why it's forced to 2.7.


----------



## BlueDwarf (Jul 10, 2018)

FreeBSD uses Python2.7 for the base system in many places. You can use Python3 as well, but removing, or not having the 2.7 version as the default one causes many problems (experience speaking here). I'd use/install the default for a build like this (because this will work) and install/use Python3 in a virtualenv for development.


----------



## alexseitsinger (Jul 10, 2018)

Have you considered building your port(s) using ports-mgmt/poudriere and using a custom make.conf? It might not work with python3, as previously stated, but it might be worth a shot.


----------



## SirDice (Jul 10, 2018)

alexseitsinger said:


> Have you considered building your port(s) using ports-mgmt/poudriere and using a custom make.conf?


The port has a hard dependency, so it doesn't matter _how_ you build it, the result is going to be same.


----------



## Beastie (Jul 10, 2018)

Assuming you're using 3.7 for your own scripting needs, you can have both versions installed in parallel.

Otherwise, remove 3.7 and keep 2.7 only. Many ports still depend on 2.7.


----------



## abishai (Jul 10, 2018)

SirDice said:


> The port has a hard dependency, so it doesn't matter _how_ you build it, the result is going to be same.


This port is B-dep, so `pkg autoremove` should help.


----------



## Nogshale (Jul 11, 2018)

Ok thanks all, i guess ill just have both installed.


----------



## xtaz (Jul 12, 2018)

It's not so bad if you use virtual environments. For years I had 2.7 as the default version because of ports requirements, but I had 3.x installed as well. Then whenever I had a new project to code I just made a venv for it using `python3 -m venv venv`. Then you can install stuff using `./venv/bin/pip install <blah>`, and use `#!./venv/bin/python` as your interpreter which will use the things you've installed using that version of pip. Completely separate to the ports system and lets you do what you want to do.

However, personally for me everything that I want to use via ports *does* build and run using 3.x. So I have now changed the default version to 3 and it works well anyway.


----------



## SirDice (Jul 12, 2018)

abishai said:


> This port is B-dep


I don't think so, it would have to be `USES= python:2.7,build` if it was only a _build_ dependency. If it was a build dependency you would indeed be able to remove it once the port has been built. 

Just confirmed it, it's a _run_ dependency:

```
root@molly:/usr/local/poudriere/ports/default/devel/scons # make run-depends-list
/usr/local/poudriere/ports/default/devel/m4
/usr/local/poudriere/ports/default/devel/py-setuptools
/usr/local/poudriere/ports/default/lang/python27
```


----------



## abishai (Jul 12, 2018)

SirDice said:


> I don't think so, it would have to be `USES= python:2.7,build` if it was only a _build_ dependency. If it was a build dependency you would indeed be able to remove it once the port has been built.



I kept in mind _scons_, it's just a make alternative, so I doubt it can be the run dependency.


----------



## SirDice (Jul 12, 2018)

Can't comment on that but if that's the case the port is configured incorrectly because it's now listed as both a _build_ and _run_ dependency.


----------

