[GRASS-user] grass73: python module name issue

   When I start grass73 I see this in a virtual console:

Welcome to GRASS GIS 7.3.svn (r69357)

   ...

Launching <wxpython> GUI in the background, please wait...
GRASS 7.3.svn
(Oregon-Dayton):~/projects/oregon/washington-eichler/data/topography >
Numeric,numarray or NumPy not found.

             This module requires the Numeric/numarray or NumPy module,
             which could not be imported. It probably is not installed
             (it's not part of the standard Python distribution). See the
             Numeric Python site (http://numpy.scipy.org) for information on
             downloading source or binaries.

(Repeated 3 more times.)

   However, that module is installed, but is named numpy, not NumPy:

$ ls /var/log/packages/ | grep numpy
numpy-1.9.1-i486-1_SBo

Python 2.7.5 (default, May 29 2013, 03:26:28) [GCC 4.8.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import numpy

   Can this be quickly fixed?

TIA,

Rich

On Tue, 6 Sep 2016, Rich Shepard wrote:

When I start grass73 I see this in a virtual console:

   Also happens with 7.2.svn (r69323M).

Rich

On Tue, Sep 6, 2016 at 4:39 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

On Tue, 6 Sep 2016, Rich Shepard wrote:

When I start grass73 I see this in a virtual console:

  Also happens with 7.2.svn (r69323M).

Rich

Can you run 'import numpy' for example from GUI Python shell?
The imports in GUI look correct to me.

Anna

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On Tue, 6 Sep 2016, Anna Petrášová wrote:

Can you run 'import numpy' for example from GUI Python shell?
The imports in GUI look correct to me.

Anna,

   Yes:

GRASS 7.3.svn
(Oregon-Dayton):~/projects/oregon/project/data/topography >
python
Python 2.7.5 (default, May 29 2013, 03:26:28) [GCC 4.8.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import numpy

   Does this mean I ignore the startup errors?

Thanks,

Rich

On Tue, Sep 6, 2016 at 7:31 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

On Tue, 6 Sep 2016, Anna Petrášová wrote:

Can you run 'import numpy' for example from GUI Python shell?
The imports in GUI look correct to me.

Anna,

  Yes:

GRASS 7.3.svn
(Oregon-Dayton):~/projects/oregon/project/data/topography >
python
Python 2.7.5 (default, May 29 2013, 03:26:28) [GCC 4.8.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import numpy

  Does this mean I ignore the startup errors?

the error means that 'import numpy' fails, so I am surprised it works
for you otherwise. The import happens in gui_core/wxlibplot.py,
wxplot/profile.py and nviz/wxnvix.py if you want to investigate more.

Thanks,

Rich

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On Tue, 6 Sep 2016, Anna Petrášová wrote:

the error means that 'import numpy' fails,

   Thought so.

... so I am surprised it works for you otherwise. The import happens in gui_core/wxlibplot.py, wxplot/profile.py and nviz/wxnvix.py if you want to
investigate more.

   I'll look at them tomorrow. When I grep'd the source tree it looked like
NumPy is found in many files, but most of those are error message strings.

Thanks, Anna,

Rich

On Tue, 6 Sep 2016, Anna Petrášová wrote:

The import happens in gui_core/wxlibplot.py,

# Needs NumPy
try:
     import numpy as np

   Therefore, this should work.

wxplot/profile.py,

try:
     import numpy

   Therefore, this also should work.

and nviz/wxnvix.py

try:
     from numpy import matrix

   And, this too should work.

if you want to investigate more.

   All three modules call for numpy (lowercase). That's how it's imported
here both within the grass console and a non-grass console.

   What do you suggest as further investigation why the error message appears
when I invoke grass?

Rich

On Tue, Sep 6, 2016 at 8:12 PM, Rich Shepard <rshepard@appl-ecosys.com>
wrote:

  What do you suggest as further investigation why the error message
appears
when I invoke grass?

You can try the following commands in and outside of GRASS GIS session:

echo $GRASS_PYTHON
which python
python -c "import sys; print(sys.path)"
python -c "import numpy"

Vaclav

Anna Petrášová wrote

On Tue, Sep 6, 2016 at 7:31 PM, Rich Shepard &lt;

rshepard@

&gt; wrote:

On Tue, 6 Sep 2016, Anna Petrášová wrote:

Can you run 'import numpy' for example from GUI Python shell?
The imports in GUI look correct to me.

Anna,

  Yes:

GRASS 7.3.svn
(Oregon-Dayton):~/projects/oregon/project/data/topography >
python
Python 2.7.5 (default, May 29 2013, 03:26:28) [GCC 4.8.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import numpy

  Does this mean I ignore the startup errors?

the error means that 'import numpy' fails, so I am surprised it works
for you otherwise. The import happens in gui_core/wxlibplot.py,
wxplot/profile.py and nviz/wxnvix.py if you want to investigate more.

Thanks,

Rich

_______________________________________________
grass-user mailing list

grass-user@.osgeo

http://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list

grass-user@.osgeo

http://lists.osgeo.org/mailman/listinfo/grass-user

there is already a ticket for this in OSGEO4W-winGRASS; the interesting
thing is that this issue isn't in standalone winGRASS of the same version.

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/grass73-python-module-name-issue-tp5284395p5284428.html
Sent from the Grass - Users mailing list archive at Nabble.com.

there is already a ticket for this in OSGEO4W-winGRASS; the interesting

thing is that this issue isn't in >standalone winGRASS of the same version.

https://trac.osgeo.org/grass/ticket/3057

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/grass73-python-module-name-issue-tp5284395p5284452.html
Sent from the Grass - Users mailing list archive at Nabble.com.

On Tue, 6 Sep 2016, Vaclav Petras wrote:

You can try the following commands in and outside of GRASS GIS session:

echo $GRASS_PYTHON
which python
python -c "import sys; print(sys.path)"
python -c "import numpy"

Vaclav,

   External to grass:

$ echo $GRASS_PYTHON

$ which python
/usr/bin/python
$ python -c "import sys; print(sys.path)"
['', '/usr/lib/python2.7/site-packages/python_dateutil-2.2-py2.7.egg',
'/usr/lib/python2.7/site-packages/SQLAlchemy-1.0.8-py2.7-linux-i686.egg',
'/usr/lib/python2.7/site-packages/flake8-2.4.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/mccabe-0.3.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/pep8-1.5.7-py2.7.egg',
'/usr/lib/python2.7/site-packages/pyflakes-0.8.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/gtimelog-0.10.0-py2.7.egg',
'/usr/lib/python27.zip', '/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload',
'/usr/lib/python2.7/site-packages', '/usr/lib/python2.7/site-packages/PIL',
'/usr/lib/python2.7/site-packages/geos',
'/usr/lib/python2.7/site-packages/gtk-2.0',
'/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode']
$ python -c "import numpy"
$

   Using grass72 console:

echo $GRASS_PYTHON

python

which python

/usr/bin/python

python -c "import sys; print(sys.path)"

['', '/usr/lib/python2.7/site-packages/python_dateutil-2.2-py2.7.egg',
  '/usr/lib/python2.7/site-packages/SQLAlchemy-1.0.8-py2.7-linux-i686.egg',
  '/usr/lib/python2.7/site-packages/flake8-2.4.1-py2.7.egg',
  '/usr/lib/python2.7/site-packages/mccabe-0.3.1-py2.7.egg',
  '/usr/lib/python2.7/site-packages/pep8-1.5.7-py2.7.egg',
  '/usr/lib/python2.7/site-packages/pyflakes-0.8.1-py2.7.egg',
  '/usr/lib/python2.7/site-packages/gtimelog-0.10.0-py2.7.egg',
  '/usr/local/grass-7.2.svn/etc/python', '/usr/lib/python27.zip',
  '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2',
  '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
  '/usr/lib/python2.7/lib-dynload', '/usr/lib/python2.7/site-packages',
  '/usr/lib/python2.7/site-packages/PIL',
  '/usr/lib/python2.7/site-packages/geos',
  '/usr/lib/python2.7/site-packages/gtk-2.0',
  '/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode']

python -c "import numpy"

GRASS 7.2.svn

   The environment variable GRASS_PYTHON is set with grass running, but not
otherwise.

Rich

On Wed, 7 Sep 2016, Helmut Kudrnovsky wrote:

there is already a ticket for this in OSGEO4W-winGRASS; the interesting
thing is that this issue isn't in >standalone winGRASS of the same version.

https://trac.osgeo.org/grass/ticket/3057

Helmut,

   This references two Windows flavors. I run Slackware-14.1 (soon to be
upgraded to -14.2).

Rich

On Wed, Sep 7, 2016 at 9:22 AM, Rich Shepard <rshepard@appl-ecosys.com>
wrote:

python -c "import numpy"

GRASS 7.2.svn

I suppose this means no output. No traceback means that it works. So numpy
works in the GRASS GIS session and it works outside.

  The environment variable GRASS_PYTHON is set with grass running, but not
otherwise.

That's correct I think. It is set for consistency. (You could use it to
force some other Python executable.)

OK, still no clues for me. Can you run the GUI (what you get when you start
or/and g.gui from command line - there should be no difference but you can
check), switch to Python tab and execute:

import sys
print (sys.path)
print (sys.version)
import numpy

Also, you can check which Python version is used in the command line:

python --version

Finally, you can try to find where numpy actually is and compare it with
what sys.path is saying.

On Wed, 7 Sep 2016, Vaclav Petras wrote:

I suppose this means no output. No traceback means that it works. So numpy
works in the GRASS GIS session and it works outside.

Vaclav,

   Correct.

OK, still no clues for me. Can you run the GUI (what you get when you start
or/and g.gui from command line - there should be no difference but you can
check), switch to Python tab and execute:

import sys
print (sys.path)
print (sys.version)
import numpy

   Cannot copy from the tab window to here. See attached .png.

Also, you can check which Python version is used in the command line:
python --version

$ python --version
Python 2.7.5

Finally, you can try to find where numpy actually is and compare it with
what sys.path is saying.

/usr/lib/python2.7/site-packages/numpy

   It seems that sys.path is not picking up this package. Interesting.

HTH,

Rich

(attachments)

grass73-python-tab.png

On Wed, Sep 7, 2016 at 11:52 AM, Rich Shepard <rshepard@appl-ecosys.com>
wrote:

  Cannot copy from the tab window to here. See attached .png.

The Python the Python tab in GUI *is* the Python running the GUI. If it is
able to import numpy there, it should be able to import it during startup.
Does the g.gui give you the numpy messages?

Finally, you can try to find where numpy actually is and compare it with

what sys.path is saying.

/usr/lib/python2.7/site-packages/numpy

I can see the `/usr/lib/python2.7/site-packages` path in all the sys.path
lists you posted. If numpy is a subdir with __init__.py, then Python should
pick it up. Although numpy is a bit special since it has also a C part...

  It seems that sys.path is not picking up this package. Interesting.

I can copy with wxPython: 3.0.2.0 (and Python 2.7.10, any GRASS).

On Wed, 7 Sep 2016, Vaclav Petras wrote:

The Python the Python tab in GUI *is* the Python running the GUI.

   And that's what the first line in the tab display box indicates.

If it is able to import numpy there, it should be able to import it during
startup.

   That it is not importing during startup is the problem here that needs
fixing.

Does the g.gui give you the numpy messages?

   Not in the GUI window, but in the virtual console, yes.

Launching <wxpython> GUI in the background, please wait...
GRASS 7.3.svn (Oregon-Dayton):~ > Numeric,numarray or NumPy not found.

             This module requires the Numeric/numarray or NumPy module,
             which could not be imported. It probably is not installed
             (it's not part of the standard Python distribution). See the
             Numeric Python site (http://numpy.scipy.org) for information on
             downloading source or binaries.

   Displayed 3 times, once for each file seeking to access numpy.

I can see the `/usr/lib/python2.7/site-packages` path in all the sys.path
lists you posted. If numpy is a subdir with __init__.py, then Python
should pick it up. Although numpy is a bit special since it has also a C
part...

I can copy with wxPython: 3.0.2.0 (and Python 2.7.10, any GRASS).

   It should also work with wxPython-2.8.12.1 and python-2.7.5. But, when I
highlighted the text with the trackball it would not paste in the alpine
urxvt window. Alpine's a text-based MUA, not a GUI-based one.

Rich

Rich Shepard wrote

On Wed, 7 Sep 2016, Helmut Kudrnovsky wrote:

there is already a ticket for this in OSGEO4W-winGRASS; the interesting
thing is that this issue isn't in >standalone winGRASS of the same
version.

https://trac.osgeo.org/grass/ticket/3057

Helmut,

   This references two Windows flavors. I run Slackware-14.1 (soon to be
upgraded to -14.2).

Rich
_______________________________________________
grass-user mailing list

grass-user@.osgeo

http://lists.osgeo.org/mailman/listinfo/grass-user

Yes, reported on windows, but the same issue.

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/grass73-python-module-name-issue-tp5284395p5284576.html
Sent from the Grass - Users mailing list archive at Nabble.com.

On Wed, 7 Sep 2016, Helmut Kudrnovsky wrote:

Yes, reported on windows, but the same issue.

Helmut,

   Can we who are affected expect a fix soon? I've a client who needs the
results of topographic and hydrologic modeling, and sooner is better than
later.

   If I can assist I'll certainly do so.

Thanks,

Rich

Rich Shepard wrote

On Wed, 7 Sep 2016, Helmut Kudrnovsky wrote:

Yes, reported on windows, but the same issue.

Helmut,

   Can we who are affected expect a fix soon? I've a client who needs the
results of topographic and hydrologic modeling, and sooner is better than
later.

   If I can assist I'll certainly do so.

Thanks,

Rich
_______________________________________________
grass-user mailing list

grass-user@.osgeo

http://lists.osgeo.org/mailman/listinfo/grass-user

all C GRASS modules and most python GRASS modules are working here ; so
modelling should be possible.

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/grass73-python-module-name-issue-tp5284395p5284582.html
Sent from the Grass - Users mailing list archive at Nabble.com.

On Wed, 7 Sep 2016, Helmut Kudrnovsky wrote:

all C GRASS modules and most python GRASS modules are working here ; so
modelling should be possible.

Helmut,

   Good. I'll proceed, then.

Thanks,

Rich