[GRASS-user] Install package for add-on in /usr/bin/python3
robin.kohrs at uni-jena.de
Tue Mar 31 00:25:19 PDT 2020
thank you very much for your answer and the help!
Do you have any idea what I could do to make the fmask-package
"locatable" for the python-interpreter that grass is using?
I tried the following options, but I guess I just don't know
sufficiently about how python and grass really work together:
My python-script looks more or less like this:
import grass.script as grass
from rios import fileinfo # that's where it fails
from fmask import fmask
That's why I tried until now:
- I created an environment with conda and installed python-fmask via
"conda install -c conda-forge python-fmask". The function
"fmask_sentinel2Stacked.py" lies in
- When I open an interactive python-shell and import fmask and rios
and the type: "fmask.__file__" it gives me
- I then added
the variable PYTHONPATH in my .bashrc
- When I now start the interpreter that grass uses from the command
line by typing "/usr/bin/pyton3" I can import fmask and rios
- However when I run the script with grass it always says that there
is no package names rios. Moreover the path I added to PYTHONPATH is
not printed when it executes "sys.path" in my grass script
I'm sorry for this little confusing question. But in case someone has
any idea how I could make grass find fmask, would be super highly
thanks a lot in advance! Cheers
Citando Markus Neteler <neteler at osgeo.org>:
> Hi Robin,
> On Sat, Mar 21, 2020 at 6:15 PM Robin Kohrs <robin.kohrs at uni-jena.de> wrote:
>> Hi everyone:)
>> I'm really sorry for this naive question. I'm kind of starting with
>> GRASS and I just can't find a solution...
>> The issue is, that I would like to try to write a little GRASS Add-on
>> and use the python-fmask package. While this package is only
>> downloadable via conda it always installs into
>> `/home/user/miniconda3/bin/python3`. Even when I did `conda
>> deactivate` prior to this.
> I guess that mixing conda packages and "regular" ones is causing troubles.
>> When I then have the import statement `import fask` in the
>> grass-script it always throws an error, saying that fmask is not
>> installed. When I print the `sys.executable` in the grass-script it
>> tells me that the interpreter is in `usr/bin/python3`. So I thought
>> that I'd install the fmask-package in a way that this interpreter can
>> find it while executing the script. But I just don't know how. I can
>> add the fmask-path to sys.path, but I don't think this is the
>> solution. Maybe someone has a pointer what I'm not getting.
> There is also the environment variable PYTHONPATH which could be set
> in the session.
> But again, mixing might cause problems.
> Now I wanted to check
> but the server is down...
>> Hope everyone is good these days:)!
> Good luck everyone,
More information about the grass-user