OK, thanks! Getting much closer, I think. I tried all three methods you 
suggested; methods (a) and (c) seem comparable in result and seem correct; 
method (b) has the disadvantage that Gwyddion's tools/navigation window buttons 
do not display their icons (rectangles with "cancel symbols" (an O with a slash 
through it) show up instead). In all cases, however, I am still having trouble 
with the Pygwy Console. I know gwy is supposed to be imported automatically 
there, but when I try to use it (such as in the example code shown in the docs, 
http://gwyddion.net/documentation/user-guide-en/pygwy.html) it generates an 
error ("NameError: name 'gwy' is not defined"); if I try to begin the script 
with `import gwy` then I get the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: could not import gobject (error was: 'libpcre.so.1: cannot open 
shared object file: No such file or directory')

I tried to fix this by installing an old version of pcre to my virtual 
environment (`$ conda install -n gwyd conda-forge::pcre`), and this changes the 
error message slightly:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: could not import gobject (error was: 'libffi.so.6: cannot open 
shared object file: No such file or directory')

I then tried to install an older version of libffi (which required that I first 
downgrade the existing setup with `$ conda remove libffi` before doing `$ conda 
install -n gwyd asmeurer::libffi=3.0`), and the error becomes:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: could not import gobject (error was: 'No module named gobject')

This made me think that something is missing from some environment variable 
because it can't find a module. However, if I change the script to instead be 
`import gwyutils`, it does show a path to at least that module in the error 
message:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/jds/miniconda3/envs/gwyd/share/gwyddion/pygwy/gwyutils.py", line 
1, in <module>
    import gwy
ImportError: could not import gobject (error was: 'No module named gobject')

Consequently, now I'm wondering if the installation still had problems. In 
particular, when running `$ make`, I noticed (1) warnings for various .lo files 
about variables being unused, uninitialized, etc. (e.g., "In file included from 
oirfile.c:67: gwyzip.h:36:19: warning: 'gwyzip_open' used but never defined") 
which I assume are not relevant, and (2) seemingly more relevant feecback when 
make goes into gwyddion-2.66/modules/pygwy--it gives a bunch of 
warnings/messages about not being able to write methods (I cut out a bunch of 
analogous messages to make it less long):

[...]
Making all in pygwy
make[3]: Entering directory '/home/jds/Desktop/gwyd/gwyddion-2.66/modules/pygwy'
  GEN      pygwy.defs
/home/jds/miniconda3/envs/gwyd/bin/python2 ./pygwy-fix-defs-1.py 
pygwy.defs.tmp2 >pygwy.defs.tmp
Fix-regexp '\\bGwyCdLine\\b' did not match anything.
/home/jds/miniconda3/envs/gwyd/bin/python2 ./pygwy-fix-defs-2.py 
--codegendir=pygtk-embed/codegen >pygwy.defs
Warning: wrapper for gwy_lawn_get_curves_data does not wrap existing function
rm pygwy.defs.tmp pygwy.defs.tmp2
PYGTK_CODEGENDIR=pygtk-embed/codegen /home/jds/miniconda3/envs/gwyd/bin/python2 
./pygwy-codegen.py \
  --override ./pygwy.override --prefix pygwy pygwy.defs \
  | sed -e 's/^void$/static void/' -e 's/pygwy\.c/pygwywrap\.c/' \
        -e '1s#.*#/* This is a 'GENERATED' file */#' >pygwywrap.c
Could not write method GwyRGBA.to_gdk_color: No ArgType for GdkColor*
Could not write method GwyRGBA.from_gdk_color: No ArgType for const-GdkColor*
Could not write method GwyRGBA.from_gdk_color_and_alpha: No ArgType for 
const-GdkColor*
Warning: generating old-style constructor for:gwy_axis_new
Warning: generating old-style constructor for:gwy_brick_new
Warning: generating old-style constructor for:gwy_color_axis_new
Could not write method GwyColorAxis.set_tick_map_func: No ArgType for 
GwyColorAxisMapFunc
[...]
Could not write function gwy_app_init_common: varargs functions not supported
Could not write function gwy_app_init_nongui: varargs functions not supported
Could not write function gwy_app_data_browser_foreach: No ArgType for 
GwyAppDataForeachFunc
[...]
Could not write function gwy_data_validate: No ArgType for GSList*
Warning: Constructor for GwyAxis needs to be updated to new API
         See http://live.gnome.org/PyGTK_2fWhatsNew28#update-constructors
[...]
Warning: Constructor for GwyVectorLayer needs to be updated to new API
         See http://live.gnome.org/PyGTK_2fWhatsNew28#update-constructors
***INFO*** The coverage of global functions is 72.17% (485/672)
***INFO*** The coverage of methods is 94.76% (1103/1164)
***INFO*** There are no declared virtual proxies.
***INFO*** There are no declared virtual accessors.
***INFO*** There are no declared interface proxies.
make  all-am

I also noticed that the output for the various `make install` analogs included 
the messages...

[...]
Libraries have been installed in:
   /home/jds/miniconda3/envs/gwyd/lib/gwyddion/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:[...]

...and...

[...]
make[3]: Entering directory '/home/jds/Desktop/gwyd/gwyddion-2.66/data'
[...]
Note that '/home/jds/miniconda3/envs/gwyd/share' is not in the search path
set by the XDG_DATA_HOME and XDG_DATA_DIRS
environment variables, so applications may not
be able to find it until you set them. The
directories currently searched are:[...]

...so, I tried the following without success (I get the same error in the Pygwy 
Console and also mess up the icons in the Gwyddion navigation/tools window (the 
images are replaced with little pictures of a page with an X on it)):

$ conda env config vars set 
XDG_DATA_HOME="/home/jds/miniconda3/envs/gwyd/share:$XDG_DATA_HOME"
$ conda env config vars set 
XDG_DATA_DIRS="/home/jds/miniconda3/envs/gwyd/share:$XDG_DATA_DIRS"
$ conda env config vars set 
LD_LIBRARY_PATH=/home/jds/miniconda3/envs/gwyd/lib/gwyddion/modules

What should I do?


________________________________
From: David Nečas (Yeti) <y...@gwyddion.net>
Sent: Sunday, October 13, 2024 1:41 PM
To: Gwyddion use discussion <gwyddion-users@lists.sourceforge.net>
Subject: Re: [Gwyddion-users] Python error when trying to build from source 
with pygwy support

On Sun, Oct 13, 2024 at 04:01:25PM +0000, Smith, Justin wrote:
> Thank you! We are definitely closer now, but something is still not quite
> right. With `make install SUBDIRS=...`, I still run into an error as it (I
> think) tries to find these subdirectories a second time (this time within the
> modules subdirectory). I get this error:
>
> ...
> make[1]: Leaving directory '/home/jds/Desktop/gwyd/gwyddion-2.66/gwyddion'
> Making install in modules
> make[1]: Entering directory '/home/jds/Desktop/gwyd/gwyddion-2.66/modules'
> Making install in m4
> /bin/bash: line 21: cd: m4: No such file or directory

Ah, OK, it does not work from the top-level directory because the
directory structure is too deep and it breaks in further recursion. We
probably need at least a configure option to disable the old plugin
stuff.

So, a few other possible straightforward (but crude) workarounds:

(a) Just tell make to ignore errors, i.e. run make -k install. You need
    to pay attention if you are getting errors elsewhere because it will
    simply ignore all.

(b) Edit the top-level Makefile.am and remove the python, perl, ruby and
    plugins subdirectories from SUBDIRS.

    I did not suggest this orginally because you need to run configure
    with --enable-maintainer-mode and it will complain about missing
    odd maintainer tools. But as long as you have the basics like
    automake and libtool, it should be able to re-generate the
    corresponding files in this case.

(c) Run the installation in a subset of directories manually like

    for x in $SUBDIRS; do make -C $x install; done

    replacing $SUBDIRS with the list I gave (without quotes).

Regards,

Yeti



_______________________________________________
Gwyddion-users mailing list
Gwyddion-users@lists.sourceforge.net
https://urldefense.com/v3/__https://lists.sourceforge.net/lists/listinfo/gwyddion-users__;!!LkSTlj0I!GNrYGLD6AFQvJ3m_NMVL0qyg-_36OBTN6sLfJXmuDdbNS1BjBkPOXC2rgkG3GSCDIGNErYENyVUVGUM9Dn80sg$
_______________________________________________
Gwyddion-users mailing list
Gwyddion-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gwyddion-users

Reply via email to