Case problem running virtualenv on windows 7

101 views
Skip to first unread message

j...@barrockproperties.com

unread,
Aug 11, 2017, 11:06:16 AM8/11/17
to virtualenv
I just installed virtualenv and am getting an error trying to create an environment.  Based on some print statements I added, sys.prefix seems to be getting lowercased somewhere within virtualenv.exe, before runpy.py starts.  And that leads to an error in change_prefix.

I can't figure out what's going on inside virtualenv.exe, so this was as far as I was able to debug it.  Any advice?


C:\Users\Jim>mkvirtualenv lob

mkvirtualenv
.bat about to call virtualenv.exe, sys.prefix = C:\Users\Jim\AppData\Local\Programs\Python\Python36
_run_module_as_main entered
, sys.prefix = c:\users\jim\appdata\local\programs\python\python36

Traceback (most recent call last):
 
File "C:\Users\Jim\AppData\Local\Programs\Python\Python36\Lib\runpy.py", line 194, in _run_module_as_main
   
"__main__", mod_spec)
 
File "C:\Users\Jim\AppData\Local\Programs\Python\Python36\Lib\runpy.py", line 85, in _run_code
   
exec(code, run_globals)
 
File "C:\Users\Jim\AppData\Local\Programs\Python\Python36\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
 
File "C:\Users\Jim\AppData\Local\Programs\Python\Python36\Lib\site-packages\virtualenv.py", line 714, in main
    symlink
=options.symlink)
 
File "C:\Users\Jim\AppData\Local\Programs\Python\Python36\Lib\site-packages\virtualenv.py", line 926, in create_environment
    site_packages
=site_packages, clear=clear, symlink=symlink))
 
File "C:\Users\Jim\AppData\Local\Programs\Python\Python36\Lib\site-packages\virtualenv.py", line 1138, in install_python
    copy_required_modules
(home_dir, symlink)
 
File "C:\Users\Jim\AppData\Local\Programs\Python\Python36\Lib\site-packages\virtualenv.py", line 1068, in copy_required_modules
    dst_filename
= change_prefix(filename, dst_prefix)
 
File "C:\Users\Jim\AppData\Local\Programs\Python\Python36\Lib\site-packages\virtualenv.py", line 1042, in change_prefix
   
(filename, prefixes)
AssertionError: Filename C:\Users\Jim\AppData\Local\Programs\Python\Python36\Lib\os.py does not start with any of these prefixes: ['C:\\users\\jim\\appdata\\local\\programs\\python\\python36', 'C:\\users\\jim\\appdata\\local\\programs\\python\\python36']


I'm running windows 7 64 bit, python 3.6.1, virtualenv 15.1.0.

Paul Moore

unread,
Aug 11, 2017, 3:00:10 PM8/11/17
to Virtualenv
On 11 August 2017 at 16:06, <j...@barrockproperties.com> wrote:
> I just installed virtualenv and am getting an error trying to create an
> environment. Based on some print statements I added, sys.prefix seems to be
> getting lowercased somewhere within virtualenv.exe, before runpy.py starts.
> And that leads to an error in change_prefix.
>
> I can't figure out what's going on inside virtualenv.exe, so this was as far
> as I was able to debug it. Any advice?
>
>
> C:\Users\Jim>mkvirtualenv lob
>
> mkvirtualenv.bat about to call virtualenv.exe, sys.prefix =
> C:\Users\Jim\AppData\Local\Programs\Python\Python36
> _run_module_as_main entered, sys.prefix =
> c:\users\jim\appdata\local\programs\python\python36

This isn't something I've encountered, but having said that I don't
use "mkvirtualenv.bat" - which is not something that comes with
virtualenv. Presumably you got it from some other package? It looks
like it might be from a Windows port of virtualenvwrapper. I suspect
the problem is in there, and you'd do better reporting the issue to
the author of that package.

Alternatively, if you can reproduce the problem just using virtualenv
itself ("virtualenv env_name") then post that output.

Paul

j...@barrockproperties.com

unread,
Aug 11, 2017, 3:58:22 PM8/11/17
to virtualenv
It's just a batch file that wraps virtualenv.exe.  I get the same output, less the first print statement, when I call virtualenv.exe directly.

Paul Moore

unread,
Aug 11, 2017, 4:07:39 PM8/11/17
to Virtualenv
Well, all I can say is that it doesn't do this for me:

>virtualenv.exe xxx
Using base prefix
'c:\\users\\gustav\\appdata\\local\\programs\\python\\python36'
New python executable in C:\Work\Scratch\xxx\Scripts\python.exe
Installing setuptools, pip, wheel...done.

Yes, the base prefix is lowercased, as you can see, but it doesn't
cause any issues.

It's difficult to know what might be going on here. I assume it's the
standard Windows build of Python from python.org, and that you're
using a standard NTFS filesystem (you don't have a case sensitive
filesystem for your home directory, do you?)

Sorry I can't offer more help...
Paul
> --
> You received this message because you are subscribed to the Google Groups
> "virtualenv" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python-virtual...@googlegroups.com.
> To post to this group, send email to python-v...@googlegroups.com.
> Visit this group at https://groups.google.com/group/python-virtualenv.
> For more options, visit https://groups.google.com/d/optout.

j...@barrockproperties.com

unread,
Aug 11, 2017, 5:08:01 PM8/11/17
to virtualenv
The error isn't coming from the OS, there's case-sensitive logic in virtualenv.pl.

Paul Moore

unread,
Aug 11, 2017, 5:42:28 PM8/11/17
to Virtualenv
Have you found a specific issue in the code? All I can say is that it
works on other systems (such as mine) so there's *something* about
your system that is triggering the issue, that isn't present on other
systems. We'll need to establish what that difference is to identify
the problem, unless you've already spotted it.

Paul
Reply all
Reply to author
Forward
0 new messages