Skip to content

virtualenv-clone doesn't work correctly on windows #62

@limdauto

Description

@limdauto

When I call clonevirtualenv.clone_virtualenv on Windows, I got this error:

In [8]: clonevirtualenv.clone_virtualenv("D:\\anaconda3\\envs\\kedro-environment\\", str(tmpdir / "ked-install" ))
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-8-fb15ea24257a> in <module>
----> 1 clonevirtualenv.clone_virtualenv("D:\\anaconda3\\envs\\kedro-environment\\", str(tmpdir / "ked-install" ))

d:\anaconda3\envs\kedro-environment\lib\site-packages\clonevirtualenv.py in clone_virtualenv(src_dir, dst_dir)
     75     shutil.copytree(src_dir, dst_dir, symlinks=True,
     76             ignore=shutil.ignore_patterns('*.pyc'))
---> 77     version, sys_path = _virtualenv_sys(dst_dir)
     78     logger.info('fixing scripts in bin...')
     79     fixup_scripts(src_dir, dst_dir, version)

d:\anaconda3\envs\kedro-environment\lib\site-packages\clonevirtualenv.py in _virtualenv_sys(venv_path)
     58               'print ("\\n".join(sys.path));'],
     59         env={},
---> 60         stdout=subprocess.PIPE)
     61     stdout, err = p.communicate()
     62     assert not p.returncode and stdout

d:\anaconda3\envs\kedro-environment\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    798                                 c2pread, c2pwrite,
    799                                 errread, errwrite,
--> 800                                 restore_signals, start_new_session)
    801         except:
    802             # Cleanup if the child failed starting.

d:\anaconda3\envs\kedro-environment\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1205                                          env,
   1206                                          os.fspath(cwd) if cwd is not None else None,
-> 1207                                          startupinfo)
   1208             finally:
   1209                 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] The system cannot find the file specified

I have narrowed down one bug to be this line: https://github.com/edwardgeorge/virtualenv-clone/blob/master/clonevirtualenv.py#L52. There might be more. I'm still trying to confirm.

On Windows, at least on my Windows (Windows 10, python 3.7), there is no python executable in Scripts. There is python.exe in its parent directory though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions