Just a follow up on this.
As a last resort and not very guix-like, but I installed the wheel
directly this way
======
(define-public python-panel
(package
(name "python-panel")
(version "1.6.1") ; pinned by python-tsbrowse
(source
(origin
(method url-fetch)
(uri
"https://files.pythonhosted.org/packages/42/11/e98e3b54f4153daeff029522697b69b6b1d7e121487d36095e80b7effcc5/panel-1.6.1-py3-none-any.whl")
(sha256
(base32 "07f6km0frsjfpvfsvbvj1zsvjr74aspzigdn7bccsb67hvazxnrx"))))
(build-system copy-build-system)
(arguments (list
#:phases
#~(modify-phases %standard-phases
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(invoke "pip" "install" "--no-deps"
"--target" "."
"./panel-1.6.1-py3-none-any.whl" )
(mkdir-p (string-append out
"/lib/python3.11/site-packages/panel"))
(mkdir-p (string-append out
"/lib/python3.11/site-packages/panel-1.6.1.dist-info"))
(mkdir-p (string-append out "/bin"))
(copy-recursively "bin" (string-append out "/bin/"))
(copy-recursively "./panel"
(string-append out
"/lib/python3.11/site-packages/panel/"))
(copy-recursively "./panel-1.6.1.dist-info"
(string-append out
"/lib/python3.11/site-packages/panel-1.6.1.dist-info/"))))))))
(propagated-inputs (list python-bleach
python-bokeh
python-linkify-it-py
python-markdown
python-markdown-it-py
python-mdit-py-plugins
python-packaging
python-pandas
python-param
python-pyviz-comms
python-requests
python-tqdm
python-typing-extensions
python-typing-extensions))
(native-inputs (list python-pip))
(home-page #f)
(synopsis "The powerful data exploration & web app framework for
Python.")
(description
"The powerful data exploration & web app framework for Python.")
(license license:bsd-3)))
======
lots could be improved by not hardcoding the versions and names, but for
now it saved me some more headaches.
Alexis
On 22/05/2025 11:10, Alexis Simon wrote:
Thanks a lot for your tips, and splitting into two modules was also
something I considered, if only I could understand how the node
compilation is managed in the python module.
I've tried setting up the HOME to a different place but without success
and I noticed two weird things.
1) When using `guix build -K`, during the build phase, the directory
mentioned is not the right one.
log shows first `Working directory: /tmp/guix-build-python-
panel-1.6.3.drv-0/panel-1.6.3/panel`
And then after it errors out `note: keeping build directory `/tmp/guix-
build-python-panel-1.6.3.drv-1'`
Notice the different number drv-0 and drv-1, as this was the second time
I ran the command, I'm wondering if there is not an issue in the
pyproject-build-system build phase?
2) Whatever folder I'm using as home (tried your solution and also other
locations), the .npm directory for the logs is never created or is removed.
It never exists at the place it indicates
`npm error A complete log of this run can be found in: /tmp/guix-build-
python-panel-1.6.3.drv-0/panel-1.6.3/panel/.npm/
_logs/2025-05-22T08_58_38_641Z-debug-0.log`
So in the end no luck accessing some kind of helpful log.
Best,
Alexis
On 21/05/2025 18:33, Edouard Klein wrote:
Hi Alexis,
I'm out of my depth too, but what I would try to do is package those npm
packages first, and add them as input (probably propagated-inputs ?) to
your package, hoping that the npm call in your build process would see
them installed and not try to download them.
The above is assuming npm tried to download stuff, which may not
actually be the problem.
To get access to the npm logs, add a phase before build changing $HOME
to point somewhere else than /homeless-shelter. This is ugly and should
be removed after but for debugging it'll let you access the logs:
(arguments
'(#:phases
(modify-phases %standard-phases
(add-before 'build 'dont-do-this
(lambda _
(setenv "HOME" ".") ;; untested
)))))
If downloading is not the problem, I solved a similar problem (it was
not python + npm, but Golang + C IIRC, can't find it right now) by
creating two packages with the same source, one with one build system,
and one with the other, the second one depending on the first.
So you could create npm-panel, and then make python-panel depend on
npm-panel, both using the same source.
All of this is quite hacky and untested, maybe somebody else can provide
actual guidance.
Best of luck,
Edouard.
Alexis Simon <alexis.si...@runbox.com> writes:
Hi,
I'm trying to work on a python package depending on python-panel but
I'm out of
my depth trying to package this one.
python-panel is depending on npm compilation and I don't know how to
proceed
from there.
So I have two questions:
- Do anyone know any similar cases that I could take as an example
for the
package definition?
- Is anyone experienced in both python and npm packaging and could
help me?
Here is my current attempt [1]
which fails with:
starting phase `build'
Using 'hatchling.build' to build wheels, auto-detected
'hatchling.build',
override '#f'.
Prepending '[]' to sys.path, auto-detected '#f', override '#f'.
[PANEL] Starting building custom models
Using nodejs v22.14.0 and npm 10.9.2
Working directory: /tmp/guix-build-python-panel-1.6.3.drv-0/
panel-1.6.3/panel
Using different version of bokeh, rebuilding from scratch.
Running npm install.
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error <https://github.com/npm/cli/issues>
npm error Log files were not written due to an error writing to the
directory:
/homeless-shelter/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see
the logs in
your terminal
npm install failed with exit code 1.
I guess npm is trying to download some stuff and I should have a
phase to
compile manually those parts but I don't know where to start.
Thanks for any help you could provide
Best,
Alexis
[1]
https://codeberg.org/alxsim/guix-tsverse/src/commit/
df5d0a55d00dc47471cf5a8e6cb787675dcfba7e/modules/packages/
tsbrowse.scm#L358