gsi-upm / soil

Apache License 2.0
28 stars 8 forks source link

Error when running Quickstart example #3

Closed arodmor closed 4 years ago

arodmor commented 4 years ago

Hi,

Successful installation of soil 0.14 on a fresh conda python environment (also fresh install of anaconda3 on a Ubuntu 18.04.3 LTS machine):

(base) arodmor@ganymede:~$ conda create -n testsim python=3.7
(base) arodmor@ganymede:~$ conda install -n testsim pip
(base) arodmor@ganymede:~$ conda activate testsim
(testsim) arodmor@ganymede:~$ which -a pip
/home/arodmor/anaconda3/envs/testsim/bin/pip

All OK.

(testsim) arodmor@ganymede:~$ pip install soil
Installing collected packages: decorator, networkx, pyyaml, simpy, six, python-dateutil, pytz, numpy, pandas, kiwisolver, cycler, pyparsing, matplotlib, scipy, SALib, MarkupSafe, Jinja2, nxsim, soil

Successfully installed Jinja2-2.11.1 MarkupSafe-1.1.1 SALib-1.3.8 cycler-0.10.0 decorator-4.4.2 kiwisolver-1.1.0 matplotlib-3.2.0 networkx-2.4 numpy-1.18.1 nxsim-0.1.2 pandas-1.0.1 pyparsing-2.4.6 python-dateutil-2.8.1 pytz-2019.3 pyyaml-5.3 scipy-1.2.1 simpy-3.0.11 six-1.14.0 soil-0.14.4

(testsim) arodmor@ganymede:~$ cd ~/testsoil

(testsim) arodmor@ganymede:~/testsoil$ soil --help

INFO:root:Running SOIL version: 0.14.4
[ ...]

So everything seems to be properly working. However, when I try to verify by running the Quickstart example:

(testsim) arodmor@ganymede:~/testsoil$ soil --graph --csv quickstart.yml

I get the following exception:

INFO:root:Running SOIL version: 0.14.4
INFO:root:Loading config file: quickstart.yml
INFO:soil:Using config(s): quickstart
INFO:soil:Using exporters: ['default', 'csv', 'gexf']
INFO:soil:Output directory: soil_output
INFO:soil:Starting simulation quickstart at 11:38:56.
INFO:soil:Dumping results to soil_output/quickstart
INFO:soil:Starting Simulation quickstart trial 0 at 11:38:56.
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/simulation.py", line 217, in run_trial_exceptions
    return self.run_trial(*args, **kwargs)
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/simulation.py", line 209, in run_trial
    env.run(until)
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/environment.py", line 154, in run
    self._save_state()
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/environment.py", line 162, in _save_state
    self._history.save_records(self.state_to_tuples(now=now))
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/history.py", line 86, in save_records
    for record in records:
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/environment.py", line 264, in state_to_tuples
    for agent in self.agents:
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/environment.py", line 68, in agents
    yield from self.network_agents
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/environment.py", line 90, in network_agents
    node = self.G.node[i]
AttributeError: 'Graph' object has no attribute 'node'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/simulation.py", line 220, in run_trial_exceptions
    c.message = ''.join(traceback.format_exception(type(c), c, c.__traceback__)[:])
AttributeError: 'NoneType' object has no attribute '__traceback__'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/arodmor/anaconda3/envs/testsim/bin/soil", line 8, in <module>
    sys.exit(main())
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/__init__.py", line 73, in main
    exporter_params=exp_params)
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/simulation.py", line 306, in run_from_config
    sim.run_simulation(**kwargs)
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/simulation.py", line 132, in run_simulation
    return self.run(*args, **kwargs)
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/simulation.py", line 136, in run
    return list(self._run_simulation_gen(*args, **kwargs))
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/simulation.py", line 170, in _run_simulation_gen
    **kwargs):
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/site-packages/soil/simulation.py", line 144, in _run_sync_or_async
    for i in p.imap_unordered(func, range(self.num_trials)):
  File "/home/arodmor/anaconda3/envs/testsim/lib/python3.7/multiprocessing/pool.py", line 748, in next
    raise value
AttributeError: 'NoneType' object has no attribute '__traceback__'

I am at lost here. Any suggestions as to what the problem is?

Thanks

balkian commented 4 years ago

Thanks for reporting!

Please, update to the latest release (0.14.6) and let me know if that fixes your problem.

If you want to know what caused the bug, check the changelog: https://github.com/gsi-upm/soil/blob/master/CHANGELOG.md#0146

arodmor commented 4 years ago

Hi,

thanks for the prompt fix!

I updated soil to 0.14.6 and quickstart.yml now runs with no issues, so I going to close this issue.

However, I run into another, I think separate, issue, when trying to run example.yml from the tutorial. I'll open a separate issue for this one.