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

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

Open
limdauto opened this issue Jul 17, 2020 · 2 comments · May be fixed by #77
Open

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

limdauto opened this issue Jul 17, 2020 · 2 comments · May be fixed by #77

Comments

@limdauto
Copy link

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.

@timabbott
Copy link
Collaborator

@limdauto thanks for the report! If you can submit a PR that works for you, I'd be happy to merge something.

@ad-mcas
Copy link

ad-mcas commented Aug 4, 2023

Hi.

Same error.

Changing python to python.exe alone does not fix the problem.
The env={} is also a problem in windows. At least PATH must be indicate.

I will submit a PR soon, tested on my PC (Windows 11, CPython 3.11).

@ad-mcas ad-mcas linked a pull request Aug 4, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants