Opened 5 years ago

Closed 3 years ago

Last modified 3 years ago

#2480 closed defect (fixed)

v.class.ml: ImportError: No module named training_extraction

Reported by: mlennert Owned by: grass-dev@…
Priority: normal Milestone: 7.0.5
Component: Addons Version: svn-releasebranch70
Keywords: v.class.ml g.extension Cc:
CPU: Unspecified Platform: Unspecified

Description

Using g.extension to install v.class.ml in a fresh grass70release compile, I get:

g.extension extension=v.class.ml svnurl=http://svn.osgeo.org/grass/grass-addons/grass7
Fetching <v.class.ml> from GRASS-Addons SVN repository (be patient)...
Compiling...
Traceback (most recent call last):
  File "/tmp/tmpj4o0hW/v.class.ml/scripts/v.class.ml", line
375, in <module>
    from training_extraction import extract_training
ImportError: No module named training_extraction
make: *** [v.class.ml.tmp.html] Error 1
ERROR: Compilation failed, sorry. Please check above error messages.

Attachments (2)

addons.zip (4.6 KB) - added by lrntct 4 years ago.
content of ~/.grass7/addons/
addons.2.zip (4.6 KB) - added by lrntct 4 years ago.
content of ~/.grass7/addons/

Download all attachments as: .zip

Change History (30)

comment:1 Changed 5 years ago by mlennert

To complete, compiling from the grass-addons tree works fine;

~/SRC/GRASS/grass-addons/grass7/vector/v.class.ml > make MODULE_TOPDIR=~/SRC/GRASS/grass70release/dist.x86_64-unknown-linux-gnu/

comment:2 Changed 5 years ago by Nikos Alexandris

I can't work this out. Also, I have the same, I think, problem with a new script of mine from which I import an external .py file. Any ideas?

comment:3 Changed 5 years ago by Nikos Alexandris

I guess after cleaning old compiled stuff, and installing sklearn, all works fine now.

comment:4 in reply to:  3 ; Changed 5 years ago by mlennert

Replying to nikosa:

I guess after cleaning old compiled stuff, and installing sklearn, all works fine now.

Could you explain what exactly you did to make it work ? Did you use g.extension, or compiled it from a source tree on your machine ?

When I compile manually with MODULE_TOPDIR set to my source dir, everything works fine, i.e. the main v.class.ml ends up in scripts/ and all the additional files get copied to etc/v.class.ml/.

However, when I use g.extension, only the main script gets copied to .grass7/addons/scripts whereas nothing is copied to .grass7/addons/etc.

Moritz

comment:5 in reply to:  4 ; Changed 5 years ago by Nikos Alexandris

Replying to mlennert:

Replying to nikosa:

I guess after cleaning old compiled stuff, and installing sklearn, all works fine now.

Could you explain what exactly you did to make it work ? Did you use g.extension, or compiled it from a source tree on your machine ?

I compiled from a local copy of the source tree (v.70)

When I compile manually with MODULE_TOPDIR set to my source dir, everything works fine, i.e. the main v.class.ml ends up in scripts/ and all the additional files get copied to etc/v.class.ml/.

However, when I use g.extension, only the main script gets copied to .grass7/addons/scripts whereas nothing is copied to .grass7/addons/etc.

g.extension fails here too.

comment:6 in reply to:  5 ; Changed 5 years ago by martinl

Replying to nikosa:

However, when I use g.extension, only the main script gets copied to .grass7/addons/scripts whereas nothing is copied to .grass7/addons/etc.

g.extension fails here too.

please try recent version, this issue should be fixed also in g70.

comment:7 in reply to:  6 Changed 5 years ago by mlennert

Replying to martinl:

Replying to nikosa:

However, when I use g.extension, only the main script gets copied to .grass7/addons/scripts whereas nothing is copied to .grass7/addons/etc.

g.extension fails here too.

please try recent version, this issue should be fixed also in g70.

Trunk, make distcleaned, updated, and compiled yesterday (r63985):

g.extension extension=v.class.ml svnurl=http://svn.osgeo.org/grass/grass-addons/grass7
Fetching <v.class.ml> from GRASS-Addons SVN repository (be patient)...
Compiling...
Traceback (most recent call last):
  File "/tmp/tmpJCQjBq/v.class.ml/scripts/v.class.ml", line
387, in <module>
    from training_extraction import extract_training
ImportError: No module named training_extraction
make: *** [v.class.ml.tmp.html] Error 1
ERROR: Compilation failed, sorry. Please check above error messages.

Moritz

comment:8 Changed 5 years ago by mlennert

Milestone: 7.0.0

comment:9 Changed 5 years ago by Nikos Alexandris

Any news for this one? I have the same problem when tryin to compile i.segment.hierarchical (#2534) and a new script of mine as well.

comment:10 Changed 4 years ago by lrntct

I have the same problem. Installing v.class.ml with g.extension worked once, then stopped working:

GRASS 7.1.svn (nc_spm_08_grass7):~ > g.extension ext=v.class.ml
Fetching <v.class.ml> from GRASS GIS Addons repository (be patient)...
Compiling...
Traceback (most recent call last):
  File "/tmp/grass7-laurent-26795/tmpHjMas6/v.class.ml/scripts/v.class.ml", line 386, in <module>
    from training_extraction import extract_training
ImportError: No module named training_extraction
make: *** [v.class.ml.tmp.html] Error 1
ERROR: Compilation failed, sorry. Please check above error messages.

I opened a new ticket because it seems more general than just v.class.ml: #2968

comment:11 in reply to:  10 Changed 4 years ago by martinl

Replying to lrntct:

I have the same problem. Installing v.class.ml with g.extension worked once, then stopped working:

I cannot reproduce this error with fresh trunk:

Fetching <v.class.ml> from GRASS GIS Addons repository (be patient)...
CompilinFetching <v.class.ml> from GRASS GIS Addons repository (be patient)...
Compiling...
Installing...
Updating addons metadata file...
Installation of <v.class.ml> successfully finished

Do you have fresh GRASS installation?

Last edited 4 years ago by martinl (previous) (diff)

comment:12 Changed 4 years ago by lrntct

I just updated to last daily build from grass-devel Ubuntu ppa. I still have the same issue:

Fetching <v.class.ml> from GRASS GIS Addons repository (be patient)...
Compiling...
Traceback (most recent call last):
  File "/tmp/grass7-laurent-30486/tmpOu93Rh/v.class.ml/scrip
ts/v.class.ml", line 386, in <module>
    from training_extraction import extract_training
ImportError: No module named training_extraction
make: *** [v.class.ml.tmp.html] Error 1
ERROR: Compilation failed, sorry. Please check above error messages.

comment:13 in reply to:  12 Changed 4 years ago by martinl

Replying to lrntct:

I just updated to last daily build from grass-devel Ubuntu ppa.

Please try the next build, some time ago I fixed related issue (hopefully it could solve also your buggy behaviour). See #2968

comment:14 Changed 4 years ago by lrntct

I tried with build r68156 and still have the same error:

Fetching <v.class.ml> from GRASS GIS Addons repository (be patient)...
Compiling...
Traceback (most recent call last):
  File "/tmp/grass7-laurent-20103/tmpx5FmGI/v.class.ml/scrip
ts/v.class.ml", line 386, in <module>
    from training_extraction import extract_training
ImportError: No module named training_extraction
make: *** [v.class.ml.tmp.html] Error 1
ERROR: Compilation failed, sorry. Please check above error messages.

comment:15 in reply to:  14 ; Changed 4 years ago by martinl

Replying to lrntct:

I tried with build r68156 and still have the same error:

are you sure that you don't have any local changes in the source code, any conflicts? Please remove ~.grass7/addons dir and try again.

I am not able to reproduce it even with grass-daily package or self-compiled relbr70.

comment:16 in reply to:  15 ; Changed 4 years ago by lrntct

Replying to martinl:

Replying to lrntct:

I tried with build r68156 and still have the same error:

are you sure that you don't have any local changes in the source code, any conflicts? Please remove ~.grass7/addons dir and try again.

I am not able to reproduce it even with grass-daily package or self-compiled relbr70.

I haven't done any change to the source code. Just tried to install it because I have similar issues with other python modules containing various files (cf. #2968). I did remove ~.grass7/addons and the installation of v.class.ml worked. But it might worth investigating because a similar issue is still happening with other modules (cf. #2968).

comment:17 in reply to:  16 Changed 4 years ago by martinl

Replying to lrntct:

I did remove ~.grass7/addons and the installation of v.class.ml worked. But it might worth investigating because a similar issue is still happening with other modules (cf. #2968).

it will similar issue. Are you able to install now r.agent?

comment:18 in reply to:  16 Changed 4 years ago by martinl

Replying to lrntct:

I did remove ~.grass7/addons and the installation of v.class.ml worked. But it might worth investigating because a similar issue is still happening with other modules (cf. #2968).

do you have copy of your original addons dir?

comment:19 Changed 4 years ago by lrntct

Here what happen with last svn build when trying to install r.agent:

GRASS 7.1.svn (nc_spm_08_grass7):~ > rm -rf ~/.grass7/addons/
GRASS 7.1.svn (nc_spm_08_grass7):~ > g.extension r.agent
Fetching <r.agent> from GRASS GIS Addons repository (be patient)...
Compiling...
Traceback (most recent call last):
  File "/tmp/grass7-laurent-18761/tmpfpR4tp/r.agent/scripts/r.agent.aco", line 234, in <module>
    import error, grassland, anthill
ImportError: No module named error
make[1]: *** [r.agent.aco.tmp.html] Error 1
/bin/sh: 1: cannot create /usr/lib/grass71/error.log: Permission denied
make: *** [r.agent.aco] Error 2
ERROR: Compilation failed, sorry. Please check above error messages.

I will upload the resulting content of ~/.grass7/addons/

Changed 4 years ago by lrntct

Attachment: addons.zip added

content of ~/.grass7/addons/

Changed 4 years ago by lrntct

Attachment: addons.2.zip added

content of ~/.grass7/addons/

comment:20 Changed 4 years ago by martinl

Milestone: 7.0.07.0.5

comment:21 Changed 3 years ago by martinl

In 69190:

r.agent: compile lib first (see #2480)

comment:22 Changed 3 years ago by martinl

In 69192:

r.agent: attempt to fix compilation (see #2480)

comment:23 Changed 3 years ago by martinl

In 69193:

r.agent: another attempt to fix compilation (see #2480)

comment:24 Changed 3 years ago by martinl

Resolution: fixed
Status: newclosed

Since r69193 r.agent is installed by g.extension properly. Also v.class.ml can be installed successfully. I am taking liberty to close this ticket. Feel free to re-open if needed.

comment:25 Changed 3 years ago by wenzeslaus

In 69389:

v.class.ml: use set_path with parent dir as in r.agent instead of get_lib_path (see #2480)

comment:26 in reply to:  24 Changed 3 years ago by wenzeslaus

v.class.ml was not compiling for me with g.extension:

> g.extension v.class.ml
Fetching <v.class.ml> from GRASS GIS Addons repository (be patient)...
Compiling...
Traceback (most recent call last):
  File "/tmp/grass7-vpetras-6663/tmpXvI6fK/v.class.ml/scripts/v.class.ml", line 386, in <module>
    from training_extraction import extract_training
ImportError: No module named training_extraction
make: *** [v.class.ml.tmp.html] Error 1
ERROR: Compilation failed, sorry. Please check above error messages.

Thanks to g.extension -d I was able to test the code from r.agent and use it in r69389. g.extension v.class.ml works for me now.

comment:27 Changed 3 years ago by wenzeslaus

In 69391:

v.class.ml: script is not in subdir unlike r.agent (fixes r69389, see #2480)

comment:28 Changed 3 years ago by wenzeslaus

After r69391 v.class.ml also runs (r69389 fixed just the g.extension).

Note: See TracTickets for help on using tickets.