Py6S icon indicating copy to clipboard operation
Py6S copied to clipboard

several problem with installation and run of Py6S

Open Fscipioni opened this issue 2 years ago • 4 comments

Hello, I'm having several problems installing and running Py6S:

  • First, I installed it with the command conda create -n py6s-env -c conda-forge py6s, and activated it. I run the test, and everything was fine. Then, I tried the quickstart command with IPYthon, Jupiter and PiCharm, but I got the error message:

Traceback (most recent call last): File "/Users/ehzjl/PycharmProjects/Py6S_test/main.py", line 2, in from Py6S import * ModuleNotFoundError: No module named 'Py6S'

  • Then, I run pip install py6s, which solved the module errore for Ipython and Jupiter, but not for PyCharm.

  • I then tried to continue with the Quick Start commands, but it returns this error:

Running for many wavelengths - this may take a long time

ExecutionError Traceback (most recent call last) in ----> 1 wavelengths, results = SixSHelpers.Wavelengths.run_vnir(s, output_name="pixel_radiance")

/opt/anaconda3/lib/python3.8/site-packages/Py6S/SixSHelpers/all_wavelengths.py in run_vnir(cls, s, spacing, **kwargs) 129 130 wv = np.arange(0.400, 1.400, spacing) --> 131 return cls.run_wavelengths(s, wv, **kwargs) 132 133 @classmethod

/opt/anaconda3/lib/python3.8/site-packages/Py6S/SixSHelpers/all_wavelengths.py in run_wavelengths(cls, s, wavelengths, output_name, n, verbose) 88 89 print("Running for many wavelengths - this may take a long time") ---> 90 results = pool.map(f, wavelengths) 91 92 pool.close()

/opt/anaconda3/lib/python3.8/multiprocessing/pool.py in map(self, func, iterable, chunksize) 362 in a list that is returned. 363 ''' --> 364 return self._map_async(func, iterable, mapstar, chunksize).get() 365 366 def starmap(self, func, iterable, chunksize=None):

/opt/anaconda3/lib/python3.8/multiprocessing/pool.py in get(self, timeout) 769 return self._value 770 else: --> 771 raise self._value 772 773 def _set(self, i, obj):

/opt/anaconda3/lib/python3.8/multiprocessing/pool.py in worker(inqueue, outqueue, initializer, initargs, maxtasks, wrap_exception) 123 job, i, func, args, kwds = task 124 try: --> 125 result = (True, func(*args, **kwds)) 126 except Exception as e: 127 if wrap_exception and func is not _helper_reraises_exception:

/opt/anaconda3/lib/python3.8/multiprocessing/pool.py in mapstar(args) 46 47 def mapstar(args): ---> 48 return list(map(*args)) 49 50 def starmapstar(args):

/opt/anaconda3/lib/python3.8/site-packages/Py6S/SixSHelpers/all_wavelengths.py in f(wv) 68 if verbose: 69 print(wv) ---> 70 a.run() 71 if output_name is None: 72 return a.outputs

/opt/anaconda3/lib/python3.8/site-packages/Py6S/sixs.py in run(self) 342 343 if self.sixs_path is None: --> 344 raise ExecutionError("6S executable not found.") 345 346 # Create the input file as a temporary file

ExecutionError: 6S executable not found.

Fscipioni avatar Nov 22 '21 20:11 Fscipioni

The problem seems to be that the Py6S module and the sixs executable can't be found.

How are you running IPython and Jupyter? You'll need to activate the conda environment first (using conda activate py6s-env) and then run them from within that command-line - for example, running the following commands in order:

conda activate py6s-env
ipython

and then once IPython has opened, you can run:

from Py6S import *
SixS.test()

and it should work.

As for PyCharm: I don't use PyCharm myself, so I don't know the details about its configuration - but you'll need to configure it to use the conda environment that you just created.

robintw avatar Nov 22 '21 20:11 robintw

I tried, but after I activate the env, ipython can't be found, even though I have it installed.

zsh: command not found: ipython

If I type

ipython

outside the environment, I have no problems

Fscipioni avatar Nov 22 '21 20:11 Fscipioni

Ok, that's because you'll need to install ipython into the environment. The conda environment is completely separate from every other installation of Python you have on your system: so any other libraries that you want must be installed into that environment - and that includes ipython and jupyter.

So, activate the environment and then run conda install ipython jupyter and then try running ipython from within the environment.

robintw avatar Nov 22 '21 20:11 robintw

That worked! Thanks so much!!

If I can make a suggestion, the fact that IPython and other libraries should be installed is not obvious for people with no or low experience with python, or coding in general. Adding a few more lines in the installation instructions can avoid many headaches :D

Fscipioni avatar Nov 22 '21 20:11 Fscipioni