[Tutor] Virtual environment question

Cameron Simpson cs at cskk.id.au
Sun Mar 11 18:54:59 EDT 2018


On 11Mar2018 15:52, jim <jf_byrnes at comcast.net> wrote:
>It was my understanding that using a virtual environment kept 
>everything isolated in that environment. So I was surprised when I got 
>the following error message.
>
>(env) jfb at jims-mint18 ~ $
>
><snip>
>File "/home/jfb/EVs/env/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", 
>line 528, in _request
>    resp = opener.open(request, timeout=self._timeout)
>
>  File "/usr/lib/python3.5/urllib/request.py", line 466, in open
>    response = self._open(req, data)
><snip>
>
>I snipped most of the error msg because for the purpose of this 
>question I am not interested in them. I tried  something that I did 
>not think would work and it did not.
>
>I am wondering why the path for the first line and every line above it 
>is /home/jfb/EVs/env and the second line and everything after is is
>/usr/lib/.
>
>I didn't think anything from my system python would be involved if I started 
>from a virtual environment.

It is possible to make a virtualenv which references the osurce python's 
library. These days the default is isolation, but older virtualenvs used to 
hook to the original python by default. This is controlled by virtualenv's 
--system-site-packages and --no-site-packages. Maybe you should build the env 
again using --no-site-packages explicitly and see if the behaviour changes.

If you're not using the "virtualenv" command to make the environment, please 
tell use exactly how it was made (there are other tools for the same purpose).

In fact, tell us regardless. It aids debugging.

Cheers,
Cameron Simpson <cs at cskk.id.au> (formerly cs at zip.com.au)


More information about the Tutor mailing list