ubarsc / python-fmask

A set of command line utilities and Python modules that implement the ‘fmask’ algorithm
https://www.pythonfmask.org
GNU General Public License v3.0
74 stars 21 forks source link

run fmask withou conda #36

Closed RobinKohrs closed 4 years ago

RobinKohrs commented 4 years ago

Hi everyone:) I'm really sorry for this little naive and less technical question. I'm kind of new to this. But I'd like to use your great package and include it in a little GRASS-GIS add-on. I already spent way too much time in trying to get this done and didn't achieve anything due to the lack of my knowledge.

So actually my question just is if there is any way in downloading and installing python-fmask via conda-forge and use it without being a conda environment. Probably that's a little strange explication, but what I mean is more or less the following:

I installed python-fmask with conda install -c conda-forge python-fmask in my base environment.

Then I can perfectly run: which fmask_sentinel2Stacked.py

and it gives me: ~/miniconda3/bin/fmask_sentinel2Stacked.py

I then did a conda deactivate. Afterwards I'm unable to find the fmask-commandline-tools.

So is there any chance to get this run without being in a conda environment?

Thank you very much in advance for any help and sorry again about the ingenuous question...

gillins commented 4 years ago

You are right - once you deactivate conda the command line tools will no longer be available.

You can try installing python-fmask outside of conda by running python setup.py install in a copy of the repository. However you will need to ensure all of the required dependencies are installed (GDAL, GDAL Python bindings, RIOS, numpy and scipy). Getting these all installed (especially on Windows) can be difficult hence why we recommend using conda.

Out of interest - how are you planning to distribute your GRASS plugin? It sounds like it will require python-fmask to be available.

neilflood commented 4 years ago

Yes, I am also a bit puzzled as to how this will work in practice.

As @gillins says, you can install all the relevant pieces without conda, if desired, but you still have the same problem that however you install them, their location needs to be accessible. One thought I have is that if you really don't want to keep conda active, you could still use it to do the install (as you have done) and then just manually set the PATH to include the conda bin directory (in your current case that is ~/miniconda3/bin). I have not tried this, but I suspect it would give you everything you need.

It is also better to use a separate conda environment,instead of the base environment, but that is kind of a separate question.

RobinKohrs commented 4 years ago

thank you very very much for the help:)! I actually did what @neilflood said and downloaded it with conda and then added the path to the conda bon to the PATH-variable. Afterwards I can run the functions also when conda is deactivated. But I really wanted to include your python-implementation of the fmask algorithm in a GRASS-Add-on. And for some reason when I run a little test script (basically just the import of fmask and rios), GRASS just doesn't find them anymore. I also created many separate conda-environments, but I just can't get it run. I really tried a lot, but due to the lack of my knowledge it still doesn't work at all. So I really don't know if there ever will be a GRASS-plugin. In case it turns out that it really works, I think there is an official GRASS-Add-on site. I hope that's ok for you. As I'm really new to this I still miss quite some experience. I hope this isn't a too naive approach...

neilflood commented 4 years ago

It sounds like the GRASS installation is running a different version of Python, and looking in a different location for installed Python packages (like rios and fmask). You would need to make sure that everything is part of a consistent build. This would mean either: (1) install everything through conda, from the same channel, including GRASS, Python, GDAL, RIOS and Fmask; or (2) install everything without conda.

I think at this point you should question whether there is any real benefit to having Fmask as a GRASS plugin. It is pretty easy to run using the command line tools,. It may not be worth the effort to have it integrated so closely into GRASS.

RobinKohrs commented 4 years ago

Thank you very much for the answers and my late reply... I will need to rethink the approach and see if this is a good idea at all. Running the command line tools seems to be the easiest and most straight-forward option indeed. Thanks again for all the help!:)

neilflood commented 4 years ago

You're welcome, good luck.