MannLabs / SPARCSpy

9 stars 6 forks source link

Pip install fails on linux #1

Closed sophiamaedler closed 2 years ago

sophiamaedler commented 2 years ago

Pip install fails on linux due to this code snippet:

if platform.system() == "Linux":
    target_folder = "/usr/local/bin"
    commands = ["viper-stat", "viper-split", "viper-merge"]
    src_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)),"src","vipercmd")
    bin_directory = os.path.dirname(os.path.abspath(sys.executable))

    for cmd in commands:
        src_module = os.path.join(src_directory,cmd+".py")
        symlink_origin = os.path.join(bin_directory,cmd)
        print(src_module)
        print(symlink_origin)

        # make script executebale
        st = os.stat(src_module)
        os.chmod(src_module, st.st_mode | 0o111)

        if not os.path.isfile(symlink_origin):
            os.symlink(symlink_origin, src_module, overwrite = True)

Commenting out the last two lines allows the package to be installed, but does not create the symlinks. The error message that is raised is:

FileExistsError: [Errno 17] File exists: '.../miniconda3/envs/viper-core/bin/viper-stat' → '.../viper-core/src/vipercmd/viper-stat.py'

Install was performed in a clean conda environment (python=3.9) with a fresh clone of the GitHub repository. Issue is probably a result of using a conda environment.

GeorgWa commented 2 years ago

check was not performed for symlinks and symlink was created in the wrong direction. f53e3b1aae908725a07c98ef8f184a3b54b24ddb