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

Problem installing due to tests.various module missing #1

Closed
tkjmk opened this issue Oct 18, 2021 · 7 comments
Closed

Problem installing due to tests.various module missing #1

tkjmk opened this issue Oct 18, 2021 · 7 comments

Comments

@tkjmk
Copy link
Collaborator

tkjmk commented Oct 18, 2021

Hello!

Thanks for making larvaworld! I would love to try it to simulate larval movement (to compare movement to my own behavioural assays). I have followed all the installation steps. Only additional step was installing the 'siunits' module myself. This is all with python3.7.7.

I am trying to run some of the example lines from the README.txt (specifically the lines related to larvaworld_gui.py and batch_run.py)

When running any of the scripts I run into an error:

Traceback (most recent call last):
  File "larvaworld_gui.py", line 11, in <module>
    from lib.gui.tabs.gui import LarvaworldGui
  File "../lib/gui/tabs/gui.py", line 10, in <module>
    from lib.gui.tabs import intro_tab, model_tab, life_tab, sim_tab, batch_tab, essay_tab, import_tab, \
  File "../lib/gui/tabs/sim_tab.py", line 11, in <module>
    from run.exec_run import Exec
  File "../run/exec_run.py", line 10, in <module>
    from lib.sim.batch.functions import retrieve_results
  File "../lib/sim/batch/functions.py", line 15, in <module>
    from lib.sim.single.single_run import SingleRun
  File "../lib/sim/single/single_run.py", line 8, in <module>
    from lib.model.envs._larvaworld_sim import LarvaWorldSim
  File "../lib/model/envs/_larvaworld_sim.py", line 9, in <module>
    from lib.model.envs._larvaworld import LarvaWorld, generate_larvae, get_sample_bout_distros, sample_group
  File "../lib/model/envs/_larvaworld.py", line 30, in <module>
    import tests.various.gui.dtype_dicts as dtypes
ModuleNotFoundError: No module named 'tests.various'

I'm unsure whether this is meant to be part of a module called tests - which I did make sure I have. That made me think that it might be a missing directory/script that is meant to be downloaded with larvaworld. I've tried on both linux and mac (same error is raised).

Do you have any ideas on how I could get past this error?

Thanks again!
TK

@bagjohn
Copy link
Collaborator

bagjohn commented Oct 18, 2021 via email

@tkjmk
Copy link
Collaborator Author

tkjmk commented Oct 18, 2021

Thank you very much Panos! That worked for downloading. I now noticed that the examples do not work.

For example:

I ran
python batch_run.py odor_pref -N 25 -t 3.0 -rng -200.0 200.0 -Ngrd 5
I then got the error:

batch_run.py: error: argument batch: invalid choice: 'odor_pref' (choose from 'chemotaxis_approach', 'chemotaxis_local', 'PItest_off', 'PItrain_mini', 'PItrain', 'patchy_food', 'food_grid', 'growth', 'RvsS', 'imitation', 'tactile_detection')

so I changed it to patchy food:
i.e. python batch_run.py patchy_food -N 25 -t 3.0 -rng -200.0 200.0 -Ngrd 5

I then get

Traceback (most recent call last):
  File "batch_run.py", line 43, in <module>
    space_kwargs[k] = batch_conf['space_search'][k]
KeyError: 'pars'

This error happens for other keys I tried too like 'chemotaxis_approach'.


I also tried:
python exp_run.py dispersion -N 30 -t 3.0 -img -a

I got the error message: exp_run.py: error: unrecognized arguments: -N 30 -img

I then changed -img to -m image, and did not find an appropriate replacement for -N30.
Running: python exp_run.py dispersion -t 3.0 -m image -a gave me the follwoing error:

Traceback (most recent call last):
  File "exp_run.py", line 24, in <module>
    ds = SingleRun(**exp_conf, vis_kwargs=d['visualization']).run()
  File "../lib/sim/single/single_run.py", line 57, in __init__
    save_to=self.d.vis_dir, **kwargs)
  File "../lib/model/envs/_larvaworld_sim.py", line 24, in __init__
    self.create_larvae(larva_groups=self.larva_groups, parameter_dict=parameter_dict)
  File "../lib/model/envs/_larvaworld_sim.py", line 94, in create_larvae
    sample_dict = sample_group(sample, N, self.sample_ps)
  File "../lib/model/envs/_larvaworld.py", line 675, in sample_group
    d = LarvaDataset(sample['dir'], load_data=False)
  File "../lib/stor/larva_dataset.py", line 22, in __init__
    self.define_paths(dir)
  File "../lib/stor/larva_dataset.py", line 635, in define_paths
    os.makedirs(v, exist_ok=True)
  File "/usr/local/Caskroom/miniconda/base/lib/python3.7/os.py", line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/local/Caskroom/miniconda/base/lib/python3.7/os.py", line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/local/Caskroom/miniconda/base/lib/python3.7/os.py", line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  [Previous line repeated 4 more times]
  File "/usr/local/Caskroom/miniconda/base/lib/python3.7/os.py", line 223, in makedirs
    mkdir(name, mode)
OSError: [Errno 45] Operation not supported: '/home/panos'

I think there is a path hard coded.


I also could not find process.py, I guess it is now exec_run.py

Would you prefer if I opened these in another ticket?

These errors also occur from the lines in the tutorials.

The first goal I have is to be able to simulate x third instar larva on a 1000x1000px grid for 20 minutes (sampling their coordinates at either 1 or 10 fps).

Thanks again!
Tane

@bagjohn
Copy link
Collaborator

bagjohn commented Oct 18, 2021 via email

@tkjmk
Copy link
Collaborator Author

tkjmk commented Oct 19, 2021

Hey,

I did manage to run the GUI. Although, I could not view any of the tutorial videos.

On the video tab I can click the images and watch the videos, however whenever I go to the tutorial tab it does not work (nor on the opening page of the GUI).

The only mp4 files I have in the larvaworld directory is cockatoo.mp4 and realshort.mp4.

The only difference I directly see that might be causing that is that lib/gui/tabs/video_tab.py has a line in the build function that says:

link0 = "http://computational-systems-neuroscience.de/wp-content/uploads/2021/04/"

whereas lib/gui/tabs/tutorial_tab.py does not have that line.

I did try playing around with the different tabs on the GUI, but I haven't managed to get any simulations yet. I will try some more and hopefully be able to run it after the tutorial videos. In the end it would be easier for me to run it through command line as I want to run the simulations as part of a pipeline (I would run 100s (to 1000s) of simulations in the end).

@bagjohn
Copy link
Collaborator

bagjohn commented Oct 19, 2021

Hey!
Indeed the tutorial videos are not working. This is in the todo list.
You should be able to run simulations via the tabs 'simulation', 'batch_run', 'essay'.
If you want to alos see them go to settings tab and set mode to video.
The command line currently works for single simulations (exp_run.py). The batch_run.py will also work but with less available flags than mentioned in the tutorial notebook.

Let me know how it goes!

Panos

@tkjmk
Copy link
Collaborator Author

tkjmk commented Oct 20, 2021

Hey,

I am still unable to run simulations even through the gui.
To use mode: video, I had to install imageio-ffmpeg, python -m pip install imageio_ffmpeg

I tried each of the tabs ('simulation', 'batch_run', and 'essay'), each of them gave different errors. I was not able to successfully run the simulation on any of them (errors raised on each).

For example, when I run the 'batch_run' tab. I leave everything default. I just change the first drop down to 'PItest_off' (the simulation drop down also changes to 'PItest_off' automatically)

Hello from the pygame community. https://www.pygame.org/contribute.html
* Error performing wm_overrideredirect *
MainProcess pypet.storageservice.HDF5StorageService INFO     I will use the hdf5 file `larvaworld/data/SimGroup/batch_runs/PItest_off/PItest_off.hdf5`.
MainProcess pypet.environment.Environment INFO     Environment initialized.
Created novel environment
MainProcess pypet.naturalnaming.NaturalNamingInterface ERROR    Failed adding `ranges` under ``.
Traceback (most recent call last):
  File "larvaworld/run/exec_run.py", line 90, in <module>
    k.exec_run()
  File "larvaworld/run/exec_run.py", line 78, in exec_run
    res = batch_run(**batch_kwargs)
  File "../lib/sim/batch/batch.py", line 48, in batch_run
    return _batch_run(**kwargs)
  File "../lib/sim/batch/batch.py", line 154, in _batch_run
    env =test_batch()
  File "../lib/sim/batch/batch.py", line 147, in test_batch
    space=space, **env_kws)
  File "../lib/sim/batch/batch.py", line 59, in get_batch_env
    traj = config_traj(traj, optimization, batch_methods)
  File "../lib/sim/batch/aux.py", line 23, in config_traj
    traj.f_aconf(k, v)
  File "larvaworld/larvaworld_venv/lib/python3.7/site-packages/pypet/naturalnaming.py", line 3624, in f_add_config
    args=args, kwargs=kwargs)
  File "larvaworld/larvaworld_venv/lib/python3.7/site-packages/pypet/naturalnaming.py", line 1230, in _add_generic
    constructor, args, kwargs)
  File "larvaworld/larvaworld_venv/lib/python3.7/site-packages/pypet/naturalnaming.py", line 1331, in _add_to_tree
    args, kwargs)
  File "larvaworld/larvaworld_venv/lib/python3.7/site-packages/pypet/naturalnaming.py", line 1612, in _create_any_param_or_result
    instance = root._construct_instance(constructor, full_name, *args, **kwargs)
  File "larvaworld/larvaworld_venv/lib/python3.7/site-packages/pypet/trajectory.py", line 3223, in _construct_instance
    return constructor(full_name, *args, **kwargs)
  File "larvaworld/larvaworld_venv/lib/python3.7/site-packages/pypet/parameter.py", line 733, in __init__
    self.f_set(data)
  File "larvaworld/larvaworld_venv/lib/python3.7/site-packages/pypet/parameter.py", line 951, in f_set
    'tuple or list.' % (str(data), str(type(data))))
TypeError: Unsupported data `[]` of type `<class 'numpy.ndarray'>`. If you passed a tuple or list, this error might also be caused by heterogeneous data within the tuple or list.

Also when I try other settings such as patchy_food the problem is: larvaworld/data/SimGroup/batch_runs directory is missing so the hdf5 files (e.g. patchy_food.hdf5 is not found).

When I try to run batch_runs.py on the command line, the error I get is always - no matter the line:

Traceback (most recent call last):
  File "batch_run.py", line 43, in <module>
    space_kwargs[k] = batch_conf['space_search'][k]
KeyError: 'pars'

If you have any solutions to how I could get that running, please let me know. it would be helpful to be able to run the batch_runs.py to simulate the movement of larvae without any attractors.

Best,
TK

@bagjohn
Copy link
Collaborator

bagjohn commented Nov 20, 2024

Hello tkjmk

There has now been a new release of the package.
The GUI is currently deprecated and the batch run is buggy.
Other than that it should work.
Also the pkg is tested for python versions 3.8-3.11.

This will now be closed.
Please feel free to try the new version and report any issues (a more functional issue publication property is supported)

@bagjohn bagjohn closed this as completed Nov 20, 2024
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

2 participants