Opened 9 years ago

Closed 8 years ago

Last modified 8 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 8 years ago.
content of ~/.grass7/addons/
addons.2.zip (4.6 KB ) - added by lrntct 8 years ago.
content of ~/.grass7/addons/

Download all attachments as: .zip

Change History (30)

comment:1 by mlennert, 9 years ago

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 by Nikos Alexandris, 9 years ago

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 by Nikos Alexandris, 9 years ago

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

in reply to:  3 ; comment:4 by mlennert, 9 years ago

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

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

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.

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

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.

in reply to:  6 comment:7 by mlennert, 9 years ago

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 by mlennert, 9 years ago

Milestone: 7.0.0

comment:9 by Nikos Alexandris, 9 years ago

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 by lrntct, 8 years ago

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

in reply to:  10 comment:11 by martinl, 8 years ago

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 8 years ago by martinl (previous) (diff)

comment:12 by lrntct, 8 years ago

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.

in reply to:  12 comment:13 by martinl, 8 years ago

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 by lrntct, 8 years ago

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.

in reply to:  14 ; comment:15 by martinl, 8 years ago

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.

in reply to:  15 ; comment:16 by lrntct, 8 years ago

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).

in reply to:  16 comment:17 by martinl, 8 years ago

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?

in reply to:  16 comment:18 by martinl, 8 years ago

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 by lrntct, 8 years ago

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/

by lrntct, 8 years ago

Attachment: addons.zip added

content of ~/.grass7/addons/

by lrntct, 8 years ago

Attachment: addons.2.zip added

content of ~/.grass7/addons/

comment:20 by martinl, 8 years ago

Milestone: 7.0.07.0.5

comment:21 by martinl, 8 years ago

In 69190:

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

comment:22 by martinl, 8 years ago

In 69192:

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

comment:23 by martinl, 8 years ago

In 69193:

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

comment:24 by martinl, 8 years ago

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 by wenzeslaus, 8 years ago

In 69389:

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

in reply to:  24 comment:26 by wenzeslaus, 8 years ago

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 by wenzeslaus, 8 years ago

In 69391:

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

comment:28 by wenzeslaus, 8 years ago

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

Note: See TracTickets for help on using tickets.