help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pytorch Versions


From: Richard Sent
Subject: Re: Pytorch Versions
Date: Mon, 13 May 2024 17:35:47 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

Zain Jabbar <zaijab2000@gmail.com> writes:

> QUESTION: Why does Guile Scheme not find some package symbols that the
> command line can?
> 
> ...
> 
> ```
> (use-modules (gnu packages)
>     (gnu packages machine-learning))
>
> (specification->package "python-pytorch") ;; 2.2.1
> python-pytorch ;; 1.13.1
> python-pytorch2 ;; 2.2.1
> python-pytorch-for-r-torch ;; 2.0.1
> ```
>
>
> Instead I get,
>
> ```
> (use-modules (gnu packages)
>     (gnu packages machine-learning))
>
> (specification->package "python-pytorch") ;; 2.0.1
> python-pytorch ;; 1.13.1
> python-pytorch2 ;; Unbound variable: python-pytorch2
> python-pytorch-for-r-torch ;; 2.0.1
> ```

I found that your code did behave as expected when using $ guix repl
instead of $ guile.

--8<---------------cut here---------------start------------->8---
~ $ guix time-machine -q -- repl
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guix-user)> (use-modules (gnu packages) (gnu packages machine-learning))
scheme@(guix-user)> (specification->package "python-pytorch")
$1 = #<package python-pytorch@2.2.1 gnu/packages/machine-learning.scm:4250 
7fa2f439cf20>
scheme@(guix-user)> python-pytorch
$2 = #<package python-pytorch@1.13.1 gnu/packages/machine-learning.scm:4102 
7fa2f4395000>
scheme@(guix-user)> python-pytorch2
$3 = #<package python-pytorch@2.2.1 gnu/packages/machine-learning.scm:4250 
7fa2f439cf20>
scheme@(guix-user)> python-pytorch-for-r-torch
$4 = #<package python-pytorch@2.0.1 gnu/packages/machine-learning.scm:4305 
7fa2f439ce70>
scheme@(guix-user)> 
--8<---------------cut here---------------end--------------->8---

vs.

--8<---------------cut here---------------start------------->8---
~ $ guile
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (use-modules (gnu packages) (gnu packages 
machine-learning))
scheme@(guile-user)> python-pytorch
$1 = #<package python-pytorch@1.13.1 gnu/packages/machine-learning.scm:4102 
7f16595b7370>
scheme@(guile-user)> python-pytorch2
;;; <stdin>:3:0: warning: possibly unbound variable `python-pytorch2'
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
error: python-pytorch2: unbound variable

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
--8<---------------cut here---------------end--------------->8---

My guess is it has to do with the different %load-path values in guix
repl vs guile. From the manual:

> Compared to just launching the ‘guile’ command, ‘guix repl’ guarantees
> that all the Guix modules and all its dependencies are available in
> the search path.

Comparing the load paths (guix-user = guix repl, guile-user = guile):

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> %load-path
$1 =
("/gnu/store/81h1vz3v1naagi1hzb2jgz4d7wsa02km-guix-module-union/share/guile/site/3.0"
;; snip at first entry containing gnu/packages/machine-learning.scm
)
scheme@(guix-user)> 

scheme@(guile-user)> %load-path
$1 = ("/home/richard/.guix-home/profile/share/guile/site/3.0"
"/run/current-system/profile/share/guile/site/3.0"
;; another snip
)
--8<---------------cut here---------------end--------------->8---

Indeed, if we then go through those load path entries looking for the
first file matching (gnu packages machine-learning), I find that guix
repl matches a machine-learning.scm file that contains python-pytorch2.
Guile's repl contains a (presumably) older version of
machine-learning.scm that does NOT contain python-pytorch2, only
python-pytorch.

The matching file for guile is in
/run/current-system/profile/share/guile/site/3.0. I suspect that means
Guile is finding a version of Guix installed via the Guix package (see
(gnu packages package-management)). Meanwhile, guix repl is using the
same version of Guix you find when running $ guix describe.

We can confirm this via:

--8<---------------cut here---------------start------------->8---
~ $ guix shell -C guix guile 
The following derivation will be built:
  /gnu/store/3gv2vzpypxf975a55pnkjgwjalda13j8-profile.drv

building CA certificate bundle...
listing Emacs sub-directories...
building fonts directory...
building directory of Info manuals...
building profile with 2 packages...
richard@gibraltar ~ [env]$ guile
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> ,use (gnu packages machine-learning)
scheme@(guile-user)> python-pytorch
$1 = #<package python-pytorch@1.13.1 gnu/packages/machine-learning.scm:4102 
7fce640359a0>
scheme@(guile-user)> python-pytorch2
;;; <stdin>:3:0: warning: possibly unbound variable `python-pytorch2'
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
error: python-pytorch2: unbound variable

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
--8<---------------cut here---------------end--------------->8---

If this didn't make sense, don't worry. I barely followed what I said
and I very easily might have said something wrong.

Generally speaking use $ guix repl if you want to ensure you're loading
the same modules as $ guix describe.

-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]