Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Py6S.sixs_exceptions.ExecutionError: 6S executable not found #52

Closed
rohitsharma0201 opened this issue Jul 8, 2019 · 18 comments
Closed

Comments

@rohitsharma0201
Copy link

Python 3.7.3 (default, Mar 27 2019, 22:11:17)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.
PyDev console: using IPython 7.4.0
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] on linux
from Py6S import *
s = SixS()
s.wavelength = Wavelength(0.675)
s.aero_profile = AeroProfile.PredefinedType(AeroProfile.Maritime)
s.run()
Traceback (most recent call last):
File "/home/rohit/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
s.run()
File "/home/rohit/Downloads/Py6S-master (1)/Py6S/sixs.py", line 322, in run
raise ExecutionError("6S executable not found.")
Py6S.sixs_exceptions.ExecutionError: 6S executable not found.

@robintw
Copy link
Owner

robintw commented Jul 9, 2019

Hi - this error means that Py6S cannot find the underlying 6S software.

How did you install Py6S? Did you follow the instructions at https://py6s.readthedocs.io/en/latest/installation.html, and did you use conda, or install using pip?

@robintw robintw closed this as completed Apr 18, 2020
@torna4o
Copy link

torna4o commented Sep 2, 2020

I had a similar issue. Windows 10, 64-bit. Spyder 3.8

The actual problem is I installed Py6S according to conda-forge you mention in your https://py6s.readthedocs.io/en/latest/installation.html

It was ok. Later in testing part the first test was ok again, but when I do recommended full test at the last part it generated errors. And since I did not see any work around or issues regarding that in your https://py6s.readthedocs.io/en/latest/installation.html#testing-py6s
I was stuck at there. I naively tried to quick start part but it produced following problem after not even giving any suggestions to writing s.a and pressing tab:

wavelengths, results = SixSHelpers.Wavelengths.run_vnir(s, output_name="pixel_radiance")
Running for many wavelengths - this may take a long time
Traceback (most recent call last):

  File "<ipython-input-6-b8b7908c0594>", line 1, in <module>
    wavelengths, results = SixSHelpers.Wavelengths.run_vnir(s, output_name="pixel_radiance")

  File "C:\ProgramData\Anaconda3\lib\site-packages\Py6S\SixSHelpers\all_wavelengths.py", line 129, in run_vnir
    return cls.run_wavelengths(s, wv, **kwargs)

  File "C:\ProgramData\Anaconda3\lib\site-packages\Py6S\SixSHelpers\all_wavelengths.py", line 88, in run_wavelengths
    results = pool.map(f, wavelengths)

  File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()

  File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 771, in get
    raise self._value

  File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))

  File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 48, in mapstar
    return list(map(*args))

  File "C:\ProgramData\Anaconda3\lib\site-packages\Py6S\SixSHelpers\all_wavelengths.py", line 68, in f
    a.run()

  File "C:\ProgramData\Anaconda3\lib\site-packages\Py6S\sixs.py", line 322, in run
    raise ExecutionError("6S executable not found.")

ExecutionError: 6S executable not found.

@robintw
Copy link
Owner

robintw commented Sep 2, 2020

Are you running this from within the Spyder development environment? If so, could you try running from a standard Python interactive console on the command line? With a conda install, the 6S executable should be installed in a place that can be found automatically. I think both you and the person posting above were running from Spyder, and so there's a possibility that a configuration issue with Spyder is causing the problem.

Also, could you try running sixs on the command line? If you get a message saying that it can't find sixs then that suggests a deeper problem. If, however, something seems to start running and then do nothing, then it means that 6S has been found - just press Ctrl-C to exit it.

@torna4o
Copy link

torna4o commented Sep 2, 2020

First, the problem starts from here, when I try to do the full test to see both 6S and Py6S working properly;

>>> import os.path
>>> import Py6S; print(os.path.dirpath(Py6S.__file__))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'ntpath' has no attribute 'dirpath'
>>>

I have done this from Anaconda3 Prompt, the place you suggest.
Then, the following part:

>>> from Py6S import *
>>> s= SixS()
>>> wavelengths, results = SixSHelpers.Wavelengths.run_vnir(s, output_name="pixel_radiance")
Running for many wavelengths - this may take a long time
The system cannot execute the specified program.

The system cannot execute the specified program.

The system cannot execute the specified program.

The system cannot execute the specified program.

The system cannot execute the specified program.

The system cannot execute the specified program.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\envs\py6s-env\lib\site-packages\Py6S\SixSHelpers\all_wavelengths.py", line 129, in run_vnir
    return cls.run_wavelengths(s, wv, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\py6s-env\lib\site-packages\Py6S\SixSHelpers\all_wavelengths.py", line 88, in run_wavelengths
    results = pool.map(f, wavelengths)
  File "C:\ProgramData\Anaconda3\envs\py6s-env\lib\multiprocessing\pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "C:\ProgramData\Anaconda3\envs\py6s-env\lib\multiprocessing\pool.py", line 771, in get
    raise self._value
  File "C:\ProgramData\Anaconda3\envs\py6s-env\lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "C:\ProgramData\Anaconda3\envs\py6s-env\lib\multiprocessing\pool.py", line 48, in mapstar
    return list(map(*args))
  File "C:\ProgramData\Anaconda3\envs\py6s-env\lib\site-packages\Py6S\SixSHelpers\all_wavelengths.py", line 68, in f
    a.run()
  File "C:\ProgramData\Anaconda3\envs\py6s-env\lib\site-packages\Py6S\sixs.py", line 330, in run
    self.outputs = Outputs(outputs[0], outputs[1])
  File "C:\ProgramData\Anaconda3\envs\py6s-env\lib\site-packages\Py6S\outputs.py", line 68, in __init__
    raise OutputParsingError("6S returned an error (shown above) - check for invalid parameter inputs")
Py6S.sixs_exceptions.OutputParsingError: 6S returned an error (shown above) - check for invalid parameter inputs
>>>

I don't quite understand to run sixs command on commandline but when I do this happens.

>>> sixs
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'sixs' is not defined
>>>

But the first test is ok:

(base) C:\WINDOWS\system32>conda activate py6s-env

(py6s-env) C:\WINDOWS\system32>python
Python 3.8.5 | packaged by conda-forge | (default, Aug 29 2020, 00:43:28) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from Py6S import *
>>> SixS.test()
6S wrapper script by Robin Wilson
Using 6S located at C:\ProgramData\Anaconda3\envs\py6s-env\Library\bin\sixs.exe
Running 6S using a set of test parameters
6sV version: 1.1
The results are:
Expected result: 619.158000
Actual result: 619.158000
#### Results agree, Py6S is working correctly
0

@robintw
Copy link
Owner

robintw commented Sep 3, 2020

Huh, that's really strange - it is working for the test, but not when you actually use it.

Presumably you're running all of these tests from the same Anaconda prompt?

Can you try running the following in the interactive Python prompt, and send me the output:

from Py6S import *
SixS.test()
s = SixS()
s.run()
print s.outputs.apparent_radiance

That tests running it using the built-in self-test that you've run already, and then running it manually. Theoretically if it works for the first one then it should work for the second - but it'll be interesting to see.

Then can you also try this:

from Py6S import *
s= SixS()
wavelengths, results = SixSHelpers.Wavelengths.run_vnir(s, output_name="pixel_radiance", n=1, verbose=True)

and then send me the output of that.

@robintw robintw reopened this Sep 3, 2020
@torna4o
Copy link

torna4o commented Sep 3, 2020

By the way, Robin, thanks for your rapid answers, I am very glad about that.

Yes, I am using Anaconda Prompt (Anaconda3) then and now.

>>> from Py6S import *
>>> SixS.test()
6S wrapper script by Robin Wilson
Using 6S located at C:\ProgramData\Anaconda3\envs\py6s-env\Library\bin\sixs.exe
Running 6S using a set of test parameters
6sV version: 1.1
The results are:
Expected result: 619.158000
Actual result: 619.158000
#### Results agree, Py6S is working correctly
0
>>> s=SixS()
>>> s.run()
>>> print s.outputs.apparent_radiance
  File "<stdin>", line 1
    print s.outputs.apparent_radiance
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(s.outputs.apparent_radiance)?
>>> print(s.outputs.apparent_radiance)
134.632

I tweaked the print part a bit and it produced a number as 134.632, for the following trial:

>>> from Py6S import *
>>> s= SixS()
>>> wavelengths, results = SixSHelpers.Wavelengths.run_vnir(s, output_name="pixel_radiance", n=1, verbose=True)
wavelengths pass:
[0.4   0.405 0.41  0.415 0.42  0.425 0.43  0.435 0.44  0.445 0.45  0.455
 0.46  0.465 0.47  0.475 0.48  0.485 0.49  0.495 0.5   0.505 0.51  0.515
 0.52  0.525 0.53  0.535 0.54  0.545 0.55  0.555 0.56  0.565 0.57  0.575
 0.58  0.585 0.59  0.595 0.6   0.605 0.61  0.615 0.62  0.625 0.63  0.635
 0.64  0.645 0.65  0.655 0.66  0.665 0.67  0.675 0.68  0.685 0.69  0.695
 0.7   0.705 0.71  0.715 0.72  0.725 0.73  0.735 0.74  0.745 0.75  0.755
 0.76  0.765 0.77  0.775 0.78  0.785 0.79  0.795 0.8   0.805 0.81  0.815
 0.82  0.825 0.83  0.835 0.84  0.845 0.85  0.855 0.86  0.865 0.87  0.875
 0.88  0.885 0.89  0.895 0.9   0.905 0.91  0.915 0.92  0.925 0.93  0.935
 0.94  0.945 0.95  0.955 0.96  0.965 0.97  0.975 0.98  0.985 0.99  0.995
 1.    1.005 1.01  1.015 1.02  1.025 1.03  1.035 1.04  1.045 1.05  1.055
 1.06  1.065 1.07  1.075 1.08  1.085 1.09  1.095 1.1   1.105 1.11  1.115
 1.12  1.125 1.13  1.135 1.14  1.145 1.15  1.155 1.16  1.165 1.17  1.175
 1.18  1.185 1.19  1.195 1.2   1.205 1.21  1.215 1.22  1.225 1.23  1.235
 1.24  1.245 1.25  1.255 1.26  1.265 1.27  1.275 1.28  1.285 1.29  1.295
 1.3   1.305 1.31  1.315 1.32  1.325 1.33  1.335 1.34  1.345 1.35  1.355
 1.36  1.365 1.37  1.375 1.38  1.385 1.39  1.395]
<class 'numpy.ndarray'>
Running for many wavelengths - this may take a long time
0.4
0.405
0.41000000000000003
0.41500000000000004
0.42000000000000004
0.42500000000000004
0.43000000000000005
0.43500000000000005
0.44000000000000006
0.44500000000000006
0.45000000000000007
0.45500000000000007
0.4600000000000001
0.4650000000000001
0.4700000000000001
0.4750000000000001
0.4800000000000001
0.4850000000000001
0.4900000000000001
0.4950000000000001
0.5000000000000001
0.5050000000000001
0.5100000000000001
0.5150000000000001
0.5200000000000001
0.5250000000000001
0.5300000000000001
0.5350000000000001
0.5400000000000001
0.5450000000000002
0.5500000000000002
0.5550000000000002
0.5600000000000002
0.5650000000000002
0.5700000000000002
0.5750000000000002
0.5800000000000002
0.5850000000000002
0.5900000000000002
0.5950000000000002
0.6000000000000002
0.6050000000000002
0.6100000000000002
0.6150000000000002
0.6200000000000002
0.6250000000000002
0.6300000000000002
0.6350000000000002
0.6400000000000002
0.6450000000000002
0.6500000000000002
0.6550000000000002
0.6600000000000003
0.6650000000000003
0.6700000000000003
0.6750000000000003
0.6800000000000003
0.6850000000000003
0.6900000000000003
0.6950000000000003
0.7000000000000003
0.7050000000000003
0.7100000000000003
0.7150000000000003
0.7200000000000003
0.7250000000000003
0.7300000000000003
0.7350000000000003
0.7400000000000003
0.7450000000000003
0.7500000000000003
0.7550000000000003
0.7600000000000003
0.7650000000000003
0.7700000000000004
0.7750000000000004
0.7800000000000004
0.7850000000000004
0.7900000000000004
0.7950000000000004
0.8000000000000004
0.8050000000000004
0.8100000000000004
0.8150000000000004
0.8200000000000004
0.8250000000000004
0.8300000000000004
0.8350000000000004
0.8400000000000004
0.8450000000000004
0.8500000000000004
0.8550000000000004
0.8600000000000004
0.8650000000000004
0.8700000000000004
0.8750000000000004
0.8800000000000004
0.8850000000000005
0.8900000000000005
0.8950000000000005
0.9000000000000005
0.9050000000000005
0.9100000000000005
0.9150000000000005
0.9200000000000005
0.9250000000000005
0.9300000000000005
0.9350000000000005
0.9400000000000005
0.9450000000000005
0.9500000000000005
0.9550000000000005
0.9600000000000005
0.9650000000000005
0.9700000000000005
0.9750000000000005
0.9800000000000005
0.9850000000000005
0.9900000000000005
0.9950000000000006
1.0000000000000004
1.0050000000000006
1.0100000000000007
1.0150000000000006
1.0200000000000005
1.0250000000000006
1.0300000000000007
1.0350000000000006
1.0400000000000005
1.0450000000000006
1.0500000000000007
1.0550000000000006
1.0600000000000005
1.0650000000000006
1.0700000000000007
1.0750000000000006
1.0800000000000005
1.0850000000000006
1.0900000000000007
1.0950000000000006
1.1000000000000005
1.1050000000000006
1.1100000000000008
1.1150000000000007
1.1200000000000006
1.1250000000000007
1.1300000000000008
1.1350000000000007
1.1400000000000006
1.1450000000000007
1.1500000000000008
1.1550000000000007
1.1600000000000006
1.1650000000000007
1.1700000000000008
1.1750000000000007
1.1800000000000006
1.1850000000000007
1.1900000000000008
1.1950000000000007
1.2000000000000006
1.2050000000000007
1.2100000000000009
1.2150000000000007
1.2200000000000006
1.2250000000000008
1.2300000000000009
1.2350000000000008
1.2400000000000007
1.2450000000000008
1.2500000000000009
1.2550000000000008
1.2600000000000007
1.2650000000000008
1.270000000000001
1.2750000000000008
1.2800000000000007
1.2850000000000008
1.290000000000001
1.2950000000000008
1.3000000000000007
1.3050000000000008
1.310000000000001
1.3150000000000008
1.3200000000000007
1.3250000000000008
1.330000000000001
1.3350000000000009
1.3400000000000007
1.3450000000000009
1.350000000000001
1.3550000000000009
1.3600000000000008
1.3650000000000009
1.370000000000001
1.3750000000000009
1.3800000000000008
1.385000000000001
1.390000000000001
1.395000000000001

I did not get what happened there, seems to me it just repeated the wavelengths worked on.

@robintw
Copy link
Owner

robintw commented Sep 3, 2020

Ah sorry about the print statement - I missed out the brackets!

That all seems to be working fine: the run_vnir function seemed to run without any errors. If you then looked at the results variable (just print(results)) then you'd see the actual results - it was just printing out the wavelengths it was running at.

Can you try this now:

from Py6S import *
s= SixS()
wavelengths, results = SixSHelpers.Wavelengths.run_landsat_etm(s, output_name="pixel_radiance", n=None, verbose=True)

and see if you get any errors. If you don't get any errors, then print(results) should give you some numerical results.

@torna4o
Copy link

torna4o commented Sep 3, 2020

Yeah, when I write print(results) I did get some numerical value. Now I am doing what you stated in the last comment.

>>> from Py6S import *
>>> s= SixS()
>>> wavelengths, results = SixSHelpers.Wavelengths.run_landsat_etm(s, output_name="pixel_radiance", n=None, verbose=True)
wavelengths pass:
[(-138, 0.435, 0.52), (-139, 0.5, 0.6225), (-140, 0.615, 0.7025), (-141, 0.74, 0.9125), (-142, 1.51, 1.7875), (-143, 2.015, 2.3775)]
<class 'list'>
Running for many wavelengths - this may take a long time
(-138, 0.435, 0.52)
(-139, 0.5, 0.6225)
(-141, 0.74, 0.9125)
(-140, 0.615, 0.7025)
(-142, 1.51, 1.7875)
(-143, 2.015, 2.3775)
>>> print(results)
[138.392 129.426 111.635  75.865  16.694   5.532]
>>>

Again, without errors it produced these.

@robintw
Copy link
Owner

robintw commented Sep 3, 2020

Hmm, it looks like everything is working now.

Can you go back to trying what you originally tried, and see what happens? Ignore the bit with the ntpath error - try the following (or whatever you actually want to try!):

from Py6S import *
s= SixS()
wavelengths, results = SixSHelpers.Wavelengths.run_vnir(s, output_name="pixel_radiance")
print(results)

@torna4o
Copy link

torna4o commented Sep 3, 2020

>>> from Py6S import *
>>> s = SixS()
>>> wavelengths, results = SixSHelpers.Wavelengths.run_vnir(s, output_name="pixel_radiance")
Running for many wavelengths - this may take a long time
>>> SixSHelpers.Wavelengths.plot_wavelengths(wavelengths, results, "Pixel Radiance")

I ignored the test with ntpath, and this time this procedure produced the image you were showing in https://py6s.readthedocs.io/en/latest/quickstart.html

Figure_1

And the rest of the QuickStart part seems smoothly flowing as well. Interesting, maybe a computer restart and all solved the issue silently.

I will comment again if there is a persisting problem without any solution, thanks a lot for helping!.

@robintw
Copy link
Owner

robintw commented Sep 3, 2020

Ok great, I'll close this for the moment - please do comment again if there are any further issues.

@robintw robintw closed this as completed Sep 3, 2020
@zxtnankai
Copy link

hello robintw ,i download the sixs_mac file and rename it to sixsV1.1 , Then i added the file to the local path on my mac, however, when i ran the test code , I still encountered the following problems:
`>>> from Py6S import *

SixS.test()
6S wrapper script by Robin Wilson
Using 6S located at /usr/local/bin/sixs
Running 6S using a set of test parameters
/bin/sh: /usr/local/bin/sixs: cannot execute binary file

Traceback (most recent call last):
File "", line 1, in
File "/Users/zxtplayer/opt/anaconda3/envs/py6s-env/lib/python3.9/site-packages/Py6S/sixs.py", line 369, in test
test.run()
File "/Users/zxtplayer/opt/anaconda3/envs/py6s-env/lib/python3.9/site-packages/Py6S/sixs.py", line 330, in run
self.outputs = Outputs(outputs[0], outputs[1])
File "/Users/zxtplayer/opt/anaconda3/envs/py6s-env/lib/python3.9/site-packages/Py6S/outputs.py", line 71, in init
raise OutputParsingError("6S returned an error (shown above) - check for invalid parameter inputs")
Py6S.sixs_exceptions.OutputParsingError: 6S returned an error (shown above) - check for invalid parameter inputs`

@robintw
Copy link
Owner

robintw commented Nov 27, 2020

It seems to be trying to execute a copy of 6S located at /usr/local/bin/sixs. Have you placed a copy there? It might be that the file isn't marked as executable: you could try running chmod a+x /usr/local/bin/sixs in the Terminal and then trying again.

When you say you added the file to your "local path", what exactly do you mean?

If it turns out to be difficult to get the 6S executable on the path, then you can pass the full path to the executable to the SixS constructor, like SixS(path="/path/to/sixs/executable/sixsV1.1").

@zxtnankai
Copy link

Thanks a lot for reply Robintw, and the "local path" here i mean the path blow:

"/usr/local/bin"

and it i tried to pass the full path in to the SixS constructor, it still not working, well I'm going to try and reinstall the environment.

Sorry to reply so late, the GITHUB hasn't informed me of any new features, so there's still a lot to explore. thanks agian!

@Kotchaporn-D
Copy link

OutputParsingError: 6S returned an error (shown above) - check for invalid parameter inputs

My errors always show like this, How can I fix it ? What I suppose to do ? Thanks!!!!

@AmirAghajani1203
Copy link

Hello, Robintw. I installed Py6S on my laptop as the instruction in https://py6s.readthedocs.io/en/latest/installation.html on anaconda. On the one hand, I am constantly getting this "'from' is not recognized as an internal or external command, operable program or batch file." when I am executing this: "from Py6S import *" in anaconda prompt (of course, before that I activated py6s environment).
On the other hand, when I executed "from Py6S import *" in the Spyder command window, everything seemed ok, but when I entered "SixS.test()" this happened "6S wrapper script by Robin Wilson
Error: cannot find the sixs executable in $PATH or current directory.".
I will be appreciated it if you help me.

Screenshot 2022-05-03 164149
Screenshot 2022-05-03 165325

@robintw
Copy link
Owner

robintw commented May 3, 2022

The first problem is caused by you trying to run Python code directly in the Anaconda Prompt. You'll need to run python in that prompt first, and then type your Python code into the Python interpreter.

The approach you're taking using Spyder is the correct one, and the error is showing that the underlying 6S model is not installed correctly. Did you follow all of the instructions in the installation guide? Try running conda install sixs to check that the sixs package is installed, and then try typing sixs and tell me what the output is.

@AmirAghajani1203
Copy link

First of all, thank you for the quick response.
Second, I have to say that I took all of the steps in "https://py6s.readthedocs.io/en/latest/installation.html?highlight=pypi#recommended-using-conda" except the last one, which is "conda create -n py6s-env -c conda-forge py6s ipython Jupyter". I added Spyder at the end of the line.
Third, I ran "conda install sixs" and then installed packages, and the output is the following image:
3

In the Spyder output is the same as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants