1

I'm running into an odd issue. I'm trying to use venv from Python 3.4.4.

When I issue the command

python -m venv v_env

The v_env environment seems to get created. However, I can't activate it because the files activate.bat, activate.ps1, and deactivate.bat are missing from the Scripts directory in the v_env directory.

I looked at the venv module in the Python 3.4.4 distribution. I didn't see anything obvious, so I copied over the venv module to a local directory, renamed it lenv, and wrote the following throwaway script to test it:

#!/usr/bin/env python3

import lenv

lenv.main(['v_env'])

I still didn't see anything obvious, so I threw in print statements in the module. My resulting file can be found at https://gist.github.com/pauluap/7e45b867eda4b0f94bfb59e38ddff9bf

When running everything, I got an output of:

v_env
1
2
3
4
5
6
11
['D:\\venvs\\s7dev\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']

Strangely enough, that seems to suggest that the script just kills itself after executing the subprocess call to "ensurepip"

I then suspected that there was an exception being caught silently or something, so I wrapped the subprocess call in a try/catch (Exception as e) construct, but I didn't see any exceptions printed, so I'm at a loss.

For whatever it is worth, if I request pip not be installed with the command

python -m venv v_env --without-pip

then the scripts directory successfully get the activate/deactivate files.

If I then go ahead and issue the 'problematic' command:

v_env\Scripts\python.exe -Im ensurepip --upgrade --default-pip

I get an output of:

Ignoring indexes: https://pypi.python.org/simple
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-7.1.2 setuptools-18.2

So things seem to be working there. I'm at a loss. I've tried doing this in PowerShell, PyCmd, and normal cmd.exe.

Hmm, well. I'm having this problem on a Windows 7 machine. I just tried creating a venv on another machine which is Windows 10. Though, I think it has something more to do with the specific history of my Windows 7 machine rather than the 7/10 thing.

paulluap
  • 313
  • 4
  • 14
  • Looks like the problem is not limited to windows - I have come across exactly the same issue while working with a linux machine (linux mint 18 mate install). When I create a virtual environment using the --without-pip parameter the activation scripts are created; without the argument the scripts are absent. – Dominic Barraclough Dec 27 '16 at 21:36

0 Answers0