Solved default python version

FreeBSD has 3.7 as default Python version. Is it possible and how to rebuild all ports which use now Python 3.6 that they will use version 3.7?
I have in /etc/make.conf"
Code:
DEFAULT_VERSIONS=python=3.6 python2=2.7 python3=3.7
For me is using Portmaster more and more painful.
 
It's quite simple follow the instructions provided by author in /usr/ports/UPDATING. For that you don't need /etc/make.conf, just type in terminal: sh and then for i in $(pkg query -g %n 'py36-*'); do pkg set -yn ${i}:py37-${i#py36-}; done. After that you can rebuild your python ports.
 
It's quite simple follow the instructions provided by author in /usr/ports/UPDATING. For that you don't need /etc/make.conf, just type in terminal: sh and then for i in $(pkg query -g %n 'py36-*'); do pkg set -yn ${i}:py37-${i#py36-}; done. After that you can rebuild your python ports.
Code:
 for i in $(pkg query -g %n 'py36-*'); do pkg set -yn ${i}:py37-${i#py36-}; done
pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2668: UNIQUE constraint failed: packages.name
pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2668: UNIQUE constraint failed: packages.name
pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2668: UNIQUE constraint failed: packages.name
pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2668: UNIQUE constraint failed: packages.name
pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2668: UNIQUE constraint failed: packages.name
I did try this before but didn't work.
I am using ports.
 
Code:
 for i in $(pkg query -g %n 'py36-*'); do pkg set -yn ${i}:py37-${i#py36-}; done
pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2668: UNIQUE constraint failed: packages.name
pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2668: UNIQUE constraint failed: packages.name
pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2668: UNIQUE constraint failed: packages.name
pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2668: UNIQUE constraint failed: packages.name
pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2668: UNIQUE constraint failed: packages.name
I did try this before but didn't work.
I am using ports.
I've also had that error message on one machine but I managed to solve the problem:
# cp -p /var/db/pkg/local.sqlite /var/db/pkg/local.sqlite.safe
# sqlite3 /var/db/pkg/local.sqlite

After that I was able to run without errors the instructions from /usr/ports/UPDATING and then portmaster.
 
I keep trying to get rid of Python 2.7 (don't use Python directly, it gets pulled in as a build dependancy when using portmaster.)

I think it comes from devel/scons:
Code:
grep python /usr/ports/devel/scons/Makefile 
CATEGORIES=    devel python
USES=        python:2.7 shebangfix

I think I get devel/scons from jsoncpp which is pulled in from cmake.

If I delete everything to do with Python and start again (but removing the ":2.7" part) then I get a newer Python and things seem to work.

But not sure why that 2.7 is in the Makefile.
 
# sqlite3 /var/db/pkg/local.sqlite
SQLite version 3.30.1 2019-10-10 20:19:45
Enter ".help" for usage hints.
I've also had that error message on one machine but I managed to solve the problem:
# cp -p /var/db/pkg/local.sqlite /var/db/pkg/local.sqlite.safe
# sqlite3 /var/db/pkg/local.sqlite

After that I was able to run without errors the instructions from /usr/ports/UPDATING and then portmaster.
I got:
Code:
# sqlite3 /var/db/pkg/local.sqlite
SQLite version 3.30.1 2019-10-10 20:19:45
Enter ".help" for usage hints.
And when I rund instructions from UPDATING than I got ann error "wrong variable".
 
You have to run it in the sh shell or bash
=> # sh
# for i in $(pkg query -g %n 'py36-*'); do pkg set -yn ${i}:py37-${i#py36-}; done
 
I keep trying to get rid of Python 2.7 (don't use Python directly, it gets pulled in as a build dependancy when using portmaster.)

I think it comes from devel/scons:
Code:
grep python /usr/ports/devel/scons/Makefile
CATEGORIES=    devel python
USES=        python:2.7 shebangfix

I think I get devel/scons from jsoncpp which is pulled in from cmake.

If I delete everything to do with Python and start again (but removing the ":2.7" part) then I get a newer Python and things seem to work.

But not sure why that 2.7 is in the Makefile.
https://lists.freebsd.org/pipermail/freebsd-python/2019-December/018702.html
 
I rebuilt all ports related to python 3.6 and everything is okay. I have to rebuilt "just" llvm80 and 90. I am not sure if I can remove llvm90 or Firefox will call it...
But there are many Python 2.7 ports (Inscape, GIMP, Blender...related)
 
I've also had that error message on one machine but I managed to solve the problem:
# cp -p /var/db/pkg/local.sqlite /var/db/pkg/local.sqlite.safe
# sqlite3 /var/db/pkg/local.sqlite

After that I was able to run without errors the instructions from /usr/ports/UPDATING and then portmaster.
Is this proceedure done to check the database for errors? Or is the user meant to run queries on the opened database, based on the instructions.
 
Seeing the error reported by @fermendel also.
Could it be that just two ports are causing this error to be thrown? And the other ports are correctly modified correctly but silently.
 
I rebuilt all ports related to python 3.6 and everything is okay. I have to rebuilt "just" llvm80 and 90. I am not sure if I can remove llvm90 or Firefox will call it...
But there are many Python 2.7 ports (Inscape, GIMP, Blender...related)
Glad you made to perform the upgrade. Did you do it manually or it was working in automatic mode?
As for llvm, I have four installed right now on my machine, I really don't understand why we need so many version and why aren't them compatible among them.
 
Glad you made to perform the upgrade. Did you do it manually or it was working in automatic mode?
As for llvm, I have four installed right now on my machine, I really don't understand why we need so many version and why aren't them compatible among them.
I did manually and today is in /usr/ports/UPDATING :).
I have also Python2.7 files but I think I cannot do anything. I try to build math/vtk6 and I did change 2.7 with 3.7 but it didn't work and there are many more.
Thank you for help.
 
Glad you made to perform the upgrade. Did you do it manually or it was working in automatic mode?
As for llvm, I have four installed right now on my machine, I really don't understand why we need so many version and why aren't them compatible among them.
II think www/firefox demands clang9 but mesa requires clang8. Too buggy w/ the higher version IIRC from the bug report. If you've firefox & Xwindows installed that might explain two of your four installed ports.
Cheers
 
Last edited:
Re: <https://cgit.freebsd.org/ports/tree/UPDATING?id=210ee04dd3c3f2e82cd3130e412866a182066859#n8> similarly I get:

pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2643: UNIQUE constraint failed: packages.name

You have to run it in the sh shell or bash

Below, what am I doing wrong? (Why does echo $SHELL never return /bin/sh?)

Code:
% su -
Password:
root@mowa219-gjp4-8570p:~ # sh
# echo $SHELL
/bin/csh
# file /bin/sh
/bin/sh: ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.0 (1400011), FreeBSD-style, stripped
# exit
root@mowa219-gjp4-8570p:~ # /bin/bash
/bin/bash: Command not found.
root@mowa219-gjp4-8570p:~ # which bash
/usr/local/bin/bash
root@mowa219-gjp4-8570p:~ # /usr/local/bin/bash
[root@mowa219-gjp4-8570p ~]# echo $SHELL
/bin/csh
[root@mowa219-gjp4-8570p ~]# exit
exit
root@mowa219-gjp4-8570p:~ #

– and:

Code:
% whoami
grahamperrin
% freebsd-version -kru
14.0-CURRENT
14.0-CURRENT
14.0-CURRENT
% sudo -u root --login /bin/sh
# echo $SHELL
/bin/csh
# exit
% sudo -u root --shell /bin/sh
# echo $SHELL
/bin/tcsh
# exit
%

I'm so confused.
 
Try:
# pw usermod grahamperrin -s /usr/local/bin/bash
# login grahamperrin
$ echo $SHELL

Now this should result in: /usr/local/bin/bash
 
On closer inspection: when I enter sh, I do see a change from csh (my preferred shell for root) to sh in the title bar of Konsole. So it's working, but I'm partly confused by echo $SHELL not returning /bin/sh in this situation.

That aside, back on topic:
  • in simple terms, if I ignore the error then run the recommended pkg upgrade command, will anything bad happen?
Code:
root@mowa219-gjp4-8570p:~ # pw usermod root -s /bin/sh
root@mowa219-gjp4-8570p:~ # exit
logout
% whoami
grahamperrin
% su -
Password:
root@mowa219-gjp4-8570p:~ # echo $SHELL
/bin/sh
root@mowa219-gjp4-8570p:~ # csh
root@mowa219-gjp4-8570p:~ # echo $SHELL
/bin/sh
root@mowa219-gjp4-8570p:~ # exit
exit
root@mowa219-gjp4-8570p:~ # exit
% sudo pw usermod root -s /bin/csh
grahamperrin's password:
% su -
Password:
root@mowa219-gjp4-8570p:~ # sh
# for i in $(pkg query -g %n 'py37-*'); do pkg set -yn ${i}:py38-${i#py37-}; done
pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2643: UNIQUE constraint failed: packages.name
# cp -p /var/db/pkg/local.sqlite /var/db/pkg/local.sqlite.safe
# sqlite3 /var/db/pkg/local.sqlite
SQLite version 3.34.1 2021-01-20 14:10:07
Enter ".help" for usage hints.
sqlite> .help
.archive ...             Manage SQL archives
.auth ON|OFF             Show authorizer callbacks
.backup ?DB? FILE        Backup DB (default "main") to FILE
.bail on|off             Stop after hitting an error.  Default OFF
.binary on|off           Turn binary output on or off.  Default OFF
.cd DIRECTORY            Change the working directory to DIRECTORY
.changes on|off          Show number of rows changed by SQL
.check GLOB              Fail if output since .testcase does not match
.clone NEWDB             Clone data into NEWDB from the existing database
.databases               List names and files of attached databases
.dbconfig ?op? ?val?     List or change sqlite3_db_config() options
.dbinfo ?DB?             Show status information about the database
.dump ?TABLE?            Render database content as SQL
.echo on|off             Turn command echo on or off
.eqp on|off|full|...     Enable or disable automatic EXPLAIN QUERY PLAN
.excel                   Display the output of next command in spreadsheet
.exit ?CODE?             Exit this program with return-code CODE
.expert                  EXPERIMENTAL. Suggest indexes for queries
.explain ?on|off|auto?   Change the EXPLAIN formatting mode.  Default: auto
.filectrl CMD ...        Run various sqlite3_file_control() operations
.fullschema ?--indent?   Show schema and the content of sqlite_stat tables
.headers on|off          Turn display of headers on or off
.help ?-all? ?PATTERN?   Show help text for PATTERN
.import FILE TABLE       Import data from FILE into TABLE
.imposter INDEX TABLE    Create imposter table TABLE on index INDEX
.indexes ?TABLE?         Show names of indexes
.limit ?LIMIT? ?VAL?     Display or change the value of an SQLITE_LIMIT
.lint OPTIONS            Report potential schema issues.
.load FILE ?ENTRY?       Load an extension library
.log FILE|off            Turn logging on or off.  FILE can be stderr/stdout
.mode MODE ?TABLE?       Set output mode
.nullvalue STRING        Use STRING in place of NULL values
.once ?OPTIONS? ?FILE?   Output for the next SQL command only to FILE
.open ?OPTIONS? ?FILE?   Close existing database and reopen FILE
.output ?FILE?           Send output to FILE or stdout if FILE is omitted
.parameter CMD ...       Manage SQL parameter bindings
.print STRING...         Print literal STRING
.progress N              Invoke progress handler after every N opcodes
.prompt MAIN CONTINUE    Replace the standard prompts
.quit                    Exit this program
.read FILE               Read input from FILE
.recover                 Recover as much data as possible from corrupt db.
.restore ?DB? FILE       Restore content of DB (default "main") from FILE
.save FILE               Write in-memory database into FILE
.scanstats on|off        Turn sqlite3_stmt_scanstatus() metrics on or off
.schema ?PATTERN?        Show the CREATE statements matching PATTERN
.selftest ?OPTIONS?      Run tests defined in the SELFTEST table
.separator COL ?ROW?     Change the column and row separators
.sha3sum ...             Compute a SHA3 hash of database content
.shell CMD ARGS...       Run CMD ARGS... in a system shell
.show                    Show the current values for various settings
.stats ?on|off?          Show stats or turn stats on or off
.system CMD ARGS...      Run CMD ARGS... in a system shell
.tables ?TABLE?          List names of tables matching LIKE pattern TABLE
.testcase NAME           Begin redirecting output to 'testcase-out.txt'
.testctrl CMD ...        Run various sqlite3_test_control() operations
.timeout MS              Try opening locked tables for MS milliseconds
.timer on|off            Turn SQL timer on or off
.trace ?OPTIONS?         Output each SQL statement as it is run
.vfsinfo ?AUX?           Information about the top-level VFS
.vfslist                 List all available VFSes
.vfsname ?AUX?           Print the name of the VFS stack
.width NUM1 NUM2 ...     Set minimum column widths for columnar output
sqlite> .quit
# for i in $(pkg query -g %n 'py37-*'); do pkg set -yn ${i}:py38-${i#py37-}; done
pkg: sqlite error while executing UPDATE packages SET name=?1 WHERE id=?2 in file pkgdb.c:2643: UNIQUE constraint failed: packages.name
# exit
root@mowa219-gjp4-8570p:~ #
 
Back
Top