* [PATCH] Fix h5py.
@ 2015-10-08 11:44 Ricardo Wurmus
2015-10-08 11:49 ` Ricardo Wurmus
2015-10-08 11:52 ` Ludovic Courtès
0 siblings, 2 replies; 4+ messages in thread
From: Ricardo Wurmus @ 2015-10-08 11:44 UTC (permalink / raw)
To: Guix-devel
[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]
Hi Guix,
python-h5py is currently broken.
guix environment --ad-hoc python-2.7.10 python2-h5py
python
>>> import h5py
[weird error]
The immediate reason here is that an Egg archive is built and installed
instead of a directory. Python doesn’t seem to know how to import
modules whose contents are trapped in an Egg archive (or is this only
the case when setuptools are not in the profile?).
I found that removing ‘python-setuptools’ from the ‘native-inputs’ field
changes the behaviour such that no Egg archive is built and the library
files are installed plainly.
Another problem with h5py was that it didn’t actually build against our
hdf5 library, because it looked for the library and the headers under
‘/opt/local’ and ‘/usr/local’. I fixed this by adding an additional
build phase.
The commit message is a little ugly, but I think it is correct. I’m not
a Pythonista but it seems that python-h5py now works fine (at least
there are no weird error messages anymore).
~~ Ricardo
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-python-h5py-python2-h5py-Correct-inputs.patch --]
[-- Type: text/x-patch, Size: 1837 bytes --]
From 5f368af582d3586a7b4e3a353d9bbd75eeb83a61 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Thu, 8 Oct 2015 13:30:23 +0200
Subject: [PATCH 1/2] gnu: python-h5py, python2-h5py: Correct inputs.
* gnu/packages/python.scm (python-h5py)
[inputs]: Remove python-cython and python-numpy.
[propagated-inputs]: New field.
[native-inputs]: Drop python-setuptools and add python-cython.
(python2-h5py): Replace "inputs" with "propagated-inputs".
---
gnu/packages/python.scm | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 46fcb4a..1865477 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -596,12 +596,12 @@ and verifies that it matches the intended target hostname.")
(base32
"0q4f9l8grf6pwp64xbv8bmyxx416s7h4522nnxac056ap3savbps"))))
(build-system python-build-system)
+ (propagated-inputs
+ `(("python-numpy" ,python-numpy)))
(inputs
- `(("python-cython" ,python-cython)
- ("python-numpy" ,python-numpy)
- ("hdf5" ,hdf5)))
+ `(("hdf5" ,hdf5)))
(native-inputs
- `(("python-setuptools" ,python-setuptools)))
+ `(("python-cython" ,python-cython)))
(arguments `(#:tests? #f)) ; no test target
(home-page "http://www.h5py.org/")
(synopsis "Read and write HDF5 files from Python")
@@ -616,11 +616,11 @@ concepts.")
(define-public python2-h5py
(let ((h5py (package-with-python2 python-h5py)))
(package (inherit h5py)
- (inputs
+ (propagated-inputs
`(("python2-numpy" ,python2-numpy)
,@(alist-delete
"python-numpy"
- (package-inputs h5py)))))))
+ (package-propagated-inputs h5py)))))))
(define-public python-lockfile
(package
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix h5py.
2015-10-08 11:44 [PATCH] Fix h5py Ricardo Wurmus
@ 2015-10-08 11:49 ` Ricardo Wurmus
2015-10-08 14:56 ` Ludovic Courtès
2015-10-08 11:52 ` Ludovic Courtès
1 sibling, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2015-10-08 11:49 UTC (permalink / raw)
To: Guix-devel
[-- Attachment #1: Type: text/plain, Size: 288 bytes --]
> Another problem with h5py was that it didn’t actually build against our
> hdf5 library, because it looked for the library and the headers under
> ‘/opt/local’ and ‘/usr/local’. I fixed this by adding an additional
> build phase.
... and that’s done in this patch:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-python-h5py-Fix-path-to-hdf5-library.patch --]
[-- Type: text/x-patch, Size: 1864 bytes --]
From 9a503dbcda17186161d040531b06a0e7cf9b2a0f Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Thu, 8 Oct 2015 13:34:11 +0200
Subject: [PATCH 2/2] gnu: python-h5py: Fix path to hdf5 library.
* gnu/packages/python.scm (python-h5py)[arguments]: Add "fix-hdf5-paths"
phase.
---
gnu/packages/python.scm | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 1865477..cdf0207 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -596,13 +596,28 @@ and verifies that it matches the intended target hostname.")
(base32
"0q4f9l8grf6pwp64xbv8bmyxx416s7h4522nnxac056ap3savbps"))))
(build-system python-build-system)
+ (arguments
+ `(#:tests? #f ; no test target
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'fix-hdf5-paths
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((prefix (assoc-ref inputs "hdf5")))
+ (substitute* "setup_build.py"
+ (("\\['/opt/local/lib', '/usr/local/lib'\\]")
+ (string-append "['" prefix "/lib" "']"))
+ (("'/opt/local/include', '/usr/local/include'")
+ (string-append "'" prefix "/include" "'")))
+ (substitute* "setup_configure.py"
+ (("\\['/usr/local/lib', '/opt/local/lib'\\]")
+ (string-append "['" prefix "/lib" "']")))
+ #t))))))
(propagated-inputs
`(("python-numpy" ,python-numpy)))
(inputs
`(("hdf5" ,hdf5)))
(native-inputs
`(("python-cython" ,python-cython)))
- (arguments `(#:tests? #f)) ; no test target
(home-page "http://www.h5py.org/")
(synopsis "Read and write HDF5 files from Python")
(description
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix h5py.
2015-10-08 11:44 [PATCH] Fix h5py Ricardo Wurmus
2015-10-08 11:49 ` Ricardo Wurmus
@ 2015-10-08 11:52 ` Ludovic Courtès
1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2015-10-08 11:52 UTC (permalink / raw)
To: Ricardo Wurmus; +Cc: Guix-devel
Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:
> python-h5py is currently broken.
>
> guix environment --ad-hoc python-2.7.10 python2-h5py
> python
> >>> import h5py
> [weird error]
>
> The immediate reason here is that an Egg archive is built and installed
> instead of a directory. Python doesn’t seem to know how to import
> modules whose contents are trapped in an Egg archive (or is this only
> the case when setuptools are not in the profile?).
>
> I found that removing ‘python-setuptools’ from the ‘native-inputs’ field
> changes the behaviour such that no Egg archive is built and the library
> files are installed plainly.
OK. We’ll have to see if other packages are affected.
> Another problem with h5py was that it didn’t actually build against our
> hdf5 library, because it looked for the library and the headers under
> ‘/opt/local’ and ‘/usr/local’. I fixed this by adding an additional
> build phase.
Not shown here, right?
> From 5f368af582d3586a7b4e3a353d9bbd75eeb83a61 Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
> Date: Thu, 8 Oct 2015 13:30:23 +0200
> Subject: [PATCH 1/2] gnu: python-h5py, python2-h5py: Correct inputs.
>
> * gnu/packages/python.scm (python-h5py)
> [inputs]: Remove python-cython and python-numpy.
> [propagated-inputs]: New field.
> [native-inputs]: Drop python-setuptools and add python-cython.
> (python2-h5py): Replace "inputs" with "propagated-inputs".
I’m no expert but it makes sense to me. The commit log is OK.
Thanks!
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix h5py.
2015-10-08 11:49 ` Ricardo Wurmus
@ 2015-10-08 14:56 ` Ludovic Courtès
0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2015-10-08 14:56 UTC (permalink / raw)
To: Ricardo Wurmus; +Cc: Guix-devel
Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:
> From 9a503dbcda17186161d040531b06a0e7cf9b2a0f Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
> Date: Thu, 8 Oct 2015 13:34:11 +0200
> Subject: [PATCH 2/2] gnu: python-h5py: Fix path to hdf5 library.
>
> * gnu/packages/python.scm (python-h5py)[arguments]: Add "fix-hdf5-paths"
> phase.
OK!
Ludo'.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-08 14:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-08 11:44 [PATCH] Fix h5py Ricardo Wurmus
2015-10-08 11:49 ` Ricardo Wurmus
2015-10-08 14:56 ` Ludovic Courtès
2015-10-08 11:52 ` Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.