3

In a jail, I have installed python3.6 along python3.4. Both were installed using pkg install, no ports. I want to keep the 3.4 version for some time, but set the 3.6 as default.

Answers found in internet, like this one or this one either involve to myself link /usr/local/bin/python to python3.6 (what must be done again after any upgrade of the default python, what I'd like to avoid; plus there's no such link anyway); or to set DEFAULT_VERSIONS in /etc/make.conf, what has no effects on binaries installation (I've tried, nevertheless).

Moreover, the virtual environment is not an option, since I want to run uwsgi, what requires the system wide default python to match the one in the python virtual environment of the python application it "monitors" (in my case, Django), in order to start correctly. Even if I start from inside the Django's virtual environment (providing python3.6), uwsgi detects python3.4 as the default python version.

Cannot find if there is any environment variable missing neither.

For information, inside the jail (and virtual environment):

# printenv 
USER=root
LOGNAME=root
HOME=/root
SHELL=/bin/csh
BLOCKSIZE=K
MAIL=/var/mail/root
PATH=/usr/local/venv/dj1/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
TERM=xterm-256color
HOSTTYPE=FreeBSD
VENDOR=amd
OSTYPE=FreeBSD
MACHTYPE=x86_64
SHLVL=1
PWD=/var/log
GROUP=wheel
HOST=dev_web0
EDITOR=vi
LANG=fr_FR.UTF-8
MM_CHARSET=UTF-8
PAGER=more
VIRTUAL_ENV=/usr/local/venv/dj1
4
  • 1st possible workaround for uwsgi: instead of installing it in the jail with pkg, install it along with Django in the same virtual environment (inside the venv: pip install uwsgi). If it is run as a service, edit the relevant startup script (like /usr/local/etc/rc.d/uwsgid) to let it start/stop/reload... uwsgi in the right venv.
    – zezollo
    May 4, 2017 at 8:41
  • 2d possible workaround for uwsgi (just a guess, I didn't try): create the desired plugins (see uwsgi-docs.readthedocs.io/en/latest/…) and force uwsgi to use the right version in uwsgi.ini (for instance, add: plugins = python36)
    – zezollo
    May 4, 2017 at 8:47
  • Yet none of my 2 workarounds above do answer the question. For instance, when I install python36, it ends up mentionning: """" Message from py36-setuptools-32.1.0_1: ******************************************************************* Only /usr/local/bin/easy_install-3.6 script has been installed since Python 3.6 is not the default Python version. """
    – zezollo
    May 4, 2017 at 8:48
  • Have you tried to set your PYTHONPATH to the desired python install?
    – tupui
    Jul 25, 2017 at 10:00

1 Answer 1

0

All binaries were prebuilt with default settings and current default Python is 3.6.

To achieve your goal you can install desired Python version as a binary then you can set it in DEFAULT_VERSIONS in /etc/make.conf and then install uwsgi from ports using this version. I do this procedure in automated way with Python3.7 which is't default ATM.

Alternatively, you can test if your application works fine under Python 3.6 (upgrade to your code should be minimal if any) and continue with default binaries.

2
  • So far, I just use my 1st workaround, even if it does not really solve the case, because at least it lets things work. I do not want to use the ports on this box, that's why I did not set DEFAULT_VERSIONS in /etc/make.conf (or, rather, I did, but in vain). I do not remember why keeping 3.4 was required (would indeed solve everything if I could simply remove it), but it was not by my application, what required 3.6.
    – zezollo
    Aug 20, 2018 at 8:50
  • Actually, I use it on a virtual build environment to build packages with my own settings. Later I install them to a few target machines.
    – Eir Nym
    Aug 20, 2018 at 13:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .