Search code examples
pythonbashredisconfigredis-server

Cannot locate redis-server


  • I am working on Windows Subsystem for Linux (WSL).
  • I am trying to run a python file which has dependencies on redis package. When I run the python file it throws the error as follows:
Traceback (most recent call last):
  File "/home/sachinbm/RELEXI/env_relexi/lib/python3.10/site-packages/smartsim/config.py", line 146, in redis_exe
    exe = expand_exe_path(redis_cli)
  File "/home/sachinbm/RELEXI/env_relexi/lib/python3.10/site-packages/smartsim/config.py", line 52, in expand_exe_path
    raise SSConfigError(f"Could not locate executable {exe}")
smartsim.error.errors.SSConfigError: Could not locate executable /home/sachinbm/RELEXI/env_relexi/lib/python3.10/site-packages/smartsim/bin/redis-server

whereas redis-server binary is present at

/usr/bin/redis-server

All the files redis-server, redis-cli, redis-benchmark, redis-check-aof, redis-check-rdb are present at

/usr/bin

The code that tries to access the redis-server binary is:

def redis_exe(self):
    try:
        redis_bin = self.conf["redis"]["bin"]
        redis_cli = osp.join(redis_bin, "redis-server")
        exe = expand_exe_path(redis_cli)
        return exe
    except KeyError:
        raise SSConfigError("Could not find redis.bin in SmartSim config")
    except SSConfigError as e:
        raise SSConfigError(
            "redis-server exe in SmartSim Config could not be used"
        ) from e

Please let me know how to get rid of this error. Should I edit bashrc or config file?


Solution

  • In the installation process of Relexi you are asked to execute the command smart --clobber. This command removes the redis-server binary from the folder where smartsim expects it. Later the redis-server binary is installed in a different location. The problem is the changed folder structure between smartsim==0.3.2 and later versions. It seems the ENV variables are not correctly assigned.

    So, do:

    pip install smartsim==0.3.2
    smart --clobber # maybe avoid this line
    smart --clean
    smart --no_tf --no_pt -v
    SMARTSIM_DIR=$(smart --site)
    export PATH=$PATH:$SMARTSIM_DIR/bin # note that '_core/' was removed
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${SMARTSIM_DIR}/lib # note that '_core/' was removed
    

    And continue with the installation.

    However, the question is strongly related to Relexi, and you should open an issue on the GitHub page. It is hard to track down the problem without knowing that you are trying to install Relexi.