openalea-incubator/WheatFspm

Installation confusion

Closed this issue · 4 comments

Hi,
I'm attempted to follow the installation instructions in the readme, but am running into problems. I'm on Ubuntu Linux 20.04 x64.

The initial statement to create the conda environment is successful:

conda create -n WheatFspm python=3.7 openalea.mtg openalea.plantgl openalea.lpy alinea.caribu alinea.astk coverage nose sphinx statsmodels -c conda-forge -c fredboudon

Although I'm unclear whether python 3.7 or python 2.7 is correct, as the previous section of the readme states that python 2.7 should be used. However, the conda create statement fails if I try to use python 2.7 due to version conflicts.

After activating the conda environment, the next installation step in the readme is to install Adel-Wheat:

conda install https://github.com/rbarillot/adel/archive/isolate_rpy.zip

However, this command fails, with the error: PackagesNotFoundError: The following packages are not available from current channels: - //github.com/rbarillot/adel/archive/isolate_rpy.zip

I'm not familiar with conda, but it looks like it thinks I'm trying to install a package named //github.com/rbarillot/adel/archive/isolate_rpy.zip.

I tried downloading isolate_rpy.zip manually, and running python setup.py develop --user(this required openalea.deploy to be installed). However, this threw an error:

AttributeError: 'dict' object has no attribute 'iteritems'

Which is caused because this code is expecting to be run under python 2 - which isn't trivially possible, due to earlier conda conflicts when I tried to perform this installation under python 2.

I tried a few other things, but was not able to complete the installation.

Please can you let me know how to succeed in installing WheatFspm?

Many thanks :)
Chris

Hi Chris,

I apologise, the readme is not totally up to date because I am in a phase of transition from Python 2 to 3!

  • Yes you should install Python 3.7 or higher.
  • you are totally correct: the adel package should be installed from my personal github repo using the python setup.py develop command
  • however, you should use the branch named 'python3', which is compatible with Python3.

sorry for the troubles and don't hesitate to ask if you need more help with the code or more details about the model

Best

Romain

Thanks @rbarillot for your response :)

Having now used the python3 branch from your repo, I've been able to move forwards to try running the WheatFspm\fspm-wheat\example\Vegetative_stages example (the other three mentioned examples don't appear to exist...)

I have had a few small issues which I've fixed as follows (there may well be better fixes for any/all of these that I'm not aware of!):

  1. All python package-local imports had errors, as I think the import syntax has changed between python 2 and 3. Fixed by changing all of import x to from . import x for package-local imports. E.g. model.py line 7 in cn-wheat
  2. The inputs/adel0000.pckl file appears to be formatted with Windows line endings (/r/n), which I had to change to Linux line endings before I could use it.
  3. Also, was this inputs/adel0000.pckl file generated from python2? This meant the unpickling in python3 failed in adel.py as the encoding='bytes' causes unpickled objects to have the incorrect type of keys (bytes, rather than the required str). I fixed this by changing to encoding='latin1' as suggested here; although I'm now not 100% sure this is unpickling correctly - no errors reported during pickle.load(...) though.

When running .../example/Vegetative_stages/main.py I'm now seeing the following error:

KeyError: "None of [Index(['delta_teq', 'delta_teq_roots'], dtype='object')] are in the [index]"

Full output and stack-trace:

$ python main.py
 Already parsed : 100 % shapes.Traceback (most recent call last):
  File "main.py", line 1044, in <module>
    INPUTS_DIRPATH='inputs', METEO_FILENAME='meteo_Ljutovac2002.csv', OUTPUTS_DIRPATH='outputs', POSTPROCESSING_DIRPATH='postprocessing', GRAPHS_DIRPATH='graphs')
  File "main.py", line 358, in main
    update_parameters_growthwheat)
  File "/home/chris/Projects/ag/WheatFspm/WheatFspm/fspm-wheat/fspmwheat/growthwheat_facade.py", line 77, in __init__
    all_growthwheat_inputs_dict = converter.from_dataframes(model_hiddenzones_inputs_df, model_elements_inputs_df, model_roots_inputs_df, model_SAM_inputs_df)
  File "/home/chris/Projects/ag/WheatFspm/WheatFspm/growth-wheat/growthwheat/converter.py", line 74, in from_dataframes
    SAM_inputs_dict = SAM_inputs_series[SAM_inputs_columns].to_dict()
  File "/home/chris/miniconda3/envs/WheatFspm_py3/lib/python3.7/site-packages/pandas/core/series.py", line 848, in __getitem__
    return self._get_with(key)
  File "/home/chris/miniconda3/envs/WheatFspm_py3/lib/python3.7/site-packages/pandas/core/series.py", line 888, in _get_with
    return self.loc[key]
  File "/home/chris/miniconda3/envs/WheatFspm_py3/lib/python3.7/site-packages/pandas/core/indexing.py", line 894, in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)
  File "/home/chris/miniconda3/envs/WheatFspm_py3/lib/python3.7/site-packages/pandas/core/indexing.py", line 1112, in _getitem_axis
    return self._getitem_iterable(key, axis=axis)
  File "/home/chris/miniconda3/envs/WheatFspm_py3/lib/python3.7/site-packages/pandas/core/indexing.py", line 1052, in _getitem_iterable
    keyarr, indexer = self._get_listlike_indexer(key, axis, raise_missing=False)
  File "/home/chris/miniconda3/envs/WheatFspm_py3/lib/python3.7/site-packages/pandas/core/indexing.py", line 1265, in _get_listlike_indexer
    self._validate_read_indexer(keyarr, indexer, axis, raise_missing=raise_missing)
  File "/home/chris/miniconda3/envs/WheatFspm_py3/lib/python3.7/site-packages/pandas/core/indexing.py", line 1307, in _validate_read_indexer
    raise KeyError(f"None of [{key}] are in the [{axis_name}]")
KeyError: "None of [Index(['delta_teq', 'delta_teq_roots'], dtype='object')] are in the [index]"

Might you know what could be causing this? And if there's a way to fix it?

Many thanks :) Chris

Hi Chris,

As I told you the Wheatfspm package is under construction...but I now realise that it is not functional yet. I first need to merge the latest developments which were made on the repo of @mngauthier (planned for January)

So in the end, I think that the quickest solution for you is to install the 'cnwheat' packages from @mngauthier and adel from mine:

# Clone and install adel
git clone -b python3 https://github.com/rbarillot/adel.git

# Clone and install CN-Wheat
git clone -b develop_MG https://github.com/mngauthier/cn-wheat.git

# Clone and install Elong-Wheat
git clone -b develop_MG https://github.com/mngauthier/elong-wheat.git

# Clone and install Farquhar-Wheat
git clone -b develop_MG https://github.com/mngauthier/farquhar-wheat.git

# Clone and install Fspm-Wheat
git clone -b develop_MG https://github.com/mngauthier/fspm-wheat.git

# Clone and install Growth-Wheat
git clone -b develop_MG https://github.com/mngauthier/growth-wheat.git

# Clone and install Respi-Wheat
git clone -b develop_MG https://github.com/mngauthier/respi-wheat.git

# Clone and install Senesc-Wheat
git clone -b develop_MG https://github.com/mngauthier/senesc-wheat.git

Romain

Thank you - fantastic - that worked :) So I'll close this issue.

I came across just one very minor problem (fixed in mngauthier/fspm-wheat#5), but other than it it produced all outputs as expected.

Now to see about rendering some of this wheat...