#python3 and nodejs

11 messages · Page 1 of 1 (latest)

sour bobcat
#

Hello!

Do you have any suggestions on how my nodejs project can also include python3? I've setup a requirements.txt file in the root of my project and have also set a NIXPACKS_PYTHON_VERSION to 3.8 .. but for some reason python 2.7.18 is installed

node gyp build error:

#10 42.82 gyp ERR! find Python - version is 2.7.18 - should be >=3.6.0
#10 42.82 gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
#10 42.82 gyp ERR! find Python

toml:

[phases.setup]
nixPkgs = ['nodejs', 'yarn', 'python']

[phases.install]
# retry up to 5 times on fails
cmd = 'yarn run install-prod'

[phases.build]
cmd = 'yarn run build'

[start] 
cmd = 'yarn run start'
celest bobcatBOT
#

Project ID: 3800ace0-d257-4ff7-94a3-52610b09dbcd

red ridgeBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

sour bobcat
#

Project ID 3800ace0-d257-4ff7-94a3-52610b09dbcd

#

update if python3 is in the toml:

prt 1

#10 56.03 gyp info find Python using Python version 3.10.9 found at "/root/.nix-profile/bin/python3"
#10 56.03 gyp http GET https://nodejs.org/download/release/v18.12.1/node-v18.12.1-headers.tar.gz
 
#10 56.03 gyp http 200 https://nodejs.org/download/release/v18.12.1/node-v18.12.1-headers.tar.gz
#10 56.03 gyp http GET https://nodejs.org/download/release/v18.12.1/SHASUMS256.txt
#10 56.03 gyp http 200 https://nodejs.org/download/release/v18.12.1/SHASUMS256.txt
#10 56.03 gyp info spawn /root/.nix-profile/bin/python3
#10 56.03 gyp info spawn args [
#10 56.03 gyp info spawn args   '/nix/store/7ppnyqmp1c92gkfrixbz99sw7q6ifkg1-nodejs-18.12.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
#10 56.03 gyp info spawn args   'binding.gyp',
#10 56.03 gyp info spawn args   '-f',
#10 56.03 gyp info spawn args   'make',
#10 56.03 gyp info spawn args   '-I',
#10 56.03 gyp info spawn args   '/app/node_modules/hnswlib-node/build/config.gypi',
#10 56.03 gyp info spawn args   '-I',
#10 56.03 gyp info spawn args   '/nix/store/7ppnyqmp1c92gkfrixbz99sw7q6ifkg1-nodejs-18.12.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
#10 56.03 gyp info spawn args   '-I',
#10 56.03 gyp info spawn args   '/root/.cache/node-gyp/18.12.1/include/node/common.gypi',

#

part 2

#10 56.03 gyp info spawn args   '-Dlibrary=shared_library',
#10 56.03 gyp info spawn args   '-Dvisibility=default',
#10 56.03 gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/18.12.1',
#10 56.03 gyp info spawn args   '-Dnode_gyp_dir=/nix/store/7ppnyqmp1c92gkfrixbz99sw7q6ifkg1-nodejs-18.12.1/lib/node_modules/npm/node_modules/node-gyp',
#10 56.03 gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/18.12.1/<(target_arch)/node.lib',
#10 56.03 gyp info spawn args   '-Dmodule_root_dir=/app/node_modules/hnswlib-node',
#10 56.03 gyp info spawn args   '-Dnode_engine=v8',
#10 56.03 gyp info spawn args   '--depth=.',
#10 56.03 gyp info spawn args   '--no-parallel',
#10 56.03 gyp info spawn args   '--generator-output',
#10 56.03 gyp info spawn args   'build',
#10 56.03 gyp info spawn args   '-Goutput_dir=.'
#10 56.03 gyp info spawn args ]
#10 56.03 gyp info spawn make
#10 56.03 gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
#10 56.03 make: g++: No such file or directory
#10 56.03 make: *** [addon.target.mk:109: Release/obj.target/addon/src/addon.o] Error 127
#10 56.03 gyp ERR! build error
#10 56.03 gyp ERR! stack Error: `make` failed with exit code: 2
#10 56.03 gyp ERR! stack     at ChildProcess.onExit (/nix/store/7ppnyqmp1c92gkfrixbz99sw7q6ifkg1-nodejs-18.12.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
#10 56.03 gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
#

prt 3

#10 56.03 gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
#10 56.03 gyp ERR! System Linux 5.10.0-22-cloud-amd64
#10 56.03 gyp ERR! command "/nix/store/7ppnyqmp1c92gkfrixbz99sw7q6ifkg1-nodejs-18.12.1/bin/node" "/nix/store/7ppnyqmp1c92gkfrixbz99sw7q6ifkg1-nodejs-18.12.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
#10 56.03 gyp ERR! cwd /app/node_modules/hnswlib-node
#10 56.03 gyp ERR! node -v v18.12.1
#10 56.03 gyp ERR! node-gyp -v v9.1.0
#10 56.03 gyp ERR! not ok
#10 56.03 make: Entering directory '/app/node_modules/hnswlib-node/build'
#10 56.03   CXX(target) Release/obj.target/addon/src/addon.o
#10 56.03 make: Leaving directory '/app/node_modules/hnswlib-node/build'
 
#10 56.03 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
 
#10 ERROR: process "/bin/bash -ol pipefail -c yarn install --frozen-lockfile" did not complete successfully: exit code: 1
sour bobcat
#

python3 and nodejs

icy mortar
#

NIXPACKS_PYTHON_VERSION is only applicable if you are using the python build provider, you are not.
the python nix package is indeed python 2.7.
python3 is not a nix package.

you want to use the python38 nix package

for future references, this is where you can search nix packages
https://search.nixos.org/packages

sour bobcat
icy mortar
#

try adding gcc to your nixPks array