run-ai / genv

GPU environment and cluster management with LLM support
https://www.genv.dev
GNU Affero General Public License v3.0
445 stars 19 forks source link

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) #52

Closed eyildiz-ugoe closed 11 months ago

eyildiz-ugoe commented 11 months ago

Upon executing genv activate I get:

Traceback (most recent call last):
  File "/mnt/mass_disk1/e.abc/miniconda3/bin/genv", line 10, in <module>
    sys.exit(main())
  File "/mnt/mass_disk1/e.abc/miniconda3/lib/python3.9/site-packages/genv/cli/__main__.py", line 116, in main
    activate.run(args.shell, args)
  File "/mnt/mass_disk1/e.abc/miniconda3/lib/python3.9/site-packages/genv/cli/activate.py", line 67, in run
    genv.core.envs.activate(
  File "/mnt/mass_disk1/e.abc/miniconda3/lib/python3.9/site-packages/genv/core/envs.py", line 88, in activate
    with State() as envs:
  File "/mnt/mass_disk1/e.abc/miniconda3/lib/python3.9/site-packages/genv/core/utils.py", line 56, in __enter__
    return self.load()
  File "/mnt/mass_disk1/e.abc/miniconda3/lib/python3.9/site-packages/genv/core/utils.py", line 35, in load
    self._state = genv.utils.load_state(
  File "/mnt/mass_disk1/e.abc/miniconda3/lib/python3.9/site-packages/genv/utils/utils.py", line 45, in load_state
    o = json.load(f, cls=json_decoder)
  File "/mnt/mass_disk1/e.abc/miniconda3/lib/python3.9/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/mnt/mass_disk1/e.abc/miniconda3/lib/python3.9/json/__init__.py", line 359, in loads
    return cls(**kw).decode(s)
  File "/mnt/mass_disk1/e.abc/miniconda3/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/mnt/mass_disk1/e.abc/miniconda3/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

No idea where it stems from, but it looks like it's some genv and/or environment issue, hence the issue here. I have genv installed via conda command and it's version is 1.2.0.

razrotenberg commented 11 months ago

hey @eyildiz-ugoe and thanks for reaching out! it seems like the issue is with decoding the state files (more info here).

did you have Genv installed in a previous version anytime? if so, it might be related.

can you pls paste here the output of the command:

ls -la ${GENV_TMPDIR:-/var/tmp/genv}

and if you are ok with resetting the state of Genv, this might solve the issue. if you don't have any environment running at the moment then you should not be afraid. you can manually delete the directory /var/tmp/genv or use the following commands:

genv envs --reset
genv devices --reset

pls lmk if it helped!

eyildiz-ugoe commented 11 months ago

This: ls -la ${GENV_TMPDIR:-/var/tmp/genv}

returns:

drwxrwxrwt 13 root       root             4096 Jul 12 10:41 ..
-rw-rw-rw-  1 root       root                0 Jul 12 02:06 devices.json
-rw-rw-rw-  1      71115 domänen-benutzer    0 Mai 17 14:04 devices.json.lock
-rw-rw-rw-  1 localadmin localadmin          0 Jul 12 10:24 envs.json
-rw-rw-rw-  1      71115 domänen-benutzer    0 Mai 17 14:04 envs.json.lock
-rw-rw-rw-  1 root       root                0 Jul 12 11:42 genv.lock
drwxr-xr-x  4      71114 domänen-benutzer 4096 Jun  7 19:51 metrics

Manually deleting /var/tmp/genv directory (requires sudo rights) worked for me. Thanks for the rapid response!