** Description changed:

+ [Impact]
+ 
+  * Virtualenvs created on Ubuntu 20.04 are not as empty as they are
+    expected to be. They are expected to contain pip and setuptools.
+    But the way pip's vendored dependencies were de-vendored resulted
+    in the libraries being exposed in the new virtualenv.
+    This was a side-effect of packaging the (rewritten) virtualenv 20.
+    It should have been resolved pre-release, but wasn't.
+ 
+  * The behaviour is radically different to upstream virtualenv and
+    not what was expected by Python developers.
+ 
+ [Test Case]
+ 
+ # apt install python3 virtualenv
+ $ virtualenv -p python3 foo
+ $ foo/bin/python -m pip freeze
+ Should output nothing. In Ubuntu 20.04, it lists 24 packages.
+ 
+ [Where problems could occur]
+ 
+  * Anyone who has discovered this change and now expects it will be in
+    for a surprise. I'd expect this to be rare, as there are workarounds
+    instead (e.g. venv or upstream virtualenv).
+  * The patch could have issues too. It is close to what is currently in
+    Debian unstable & later Ubuntu releases, and seems to be working
+    correctly.
+ 
+ [Other Info]
+  
+  * See also LP: #1880749 which is fixed in the same patch.
+ 
+ [Original Report]
+ 
  Since updating to ubuntu 20.04, whenever I create a virtual environment
  with `virtualenv` it contains many unwanted libraries. Unsetting
  PYTHONPATH, setting the `--python` flag to a different version, etc does
  not fix the issue. I could run it with `--no-seed` but then the new venv
  doesn't even have pip.
  
  I found another user who has the exact same issue posting about it on 
stackoverflow and the list of packages which were installed by default is the 
same, this leads me to believe that something is wrong with the package itself 
and not a local config issue.
  `https://stackoverflow.com/q/62991007/5953826`
  
- 
  This is the output from creating a virtualenv:
  ```
  ➜  virtualenv --python=/usr/bin/python3.8 ~/projects/environments/test
  created virtual environment CPython3.8.5.final.0-64 in 156ms
-   creator CPython3Posix(dest=/home/redacted/projects/environments/test, 
clear=False, global=False)
-   seeder FromAppData(download=False, urllib3=latest, contextlib2=latest, 
idna=latest, ipaddr=latest, colorama=latest, pkg_resources=latest, 
webencodings=latest, pip=latest, progress=latest, setuptools=latest, 
retrying=latest, certifi=latest, chardet=latest, appdirs=latest, 
msgpack=latest, html5lib=latest, pytoml=latest, pyparsing=latest, 
distro=latest, CacheControl=latest, distlib=latest, pep517=latest, 
lockfile=latest, requests=latest, packaging=latest, six=latest, wheel=latest, 
via=copy, 
app_data_dir=/home/redacted/.local/share/virtualenv/seed-app-data/v1.0.1.debian)
-   activators 
BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
+   creator CPython3Posix(dest=/home/redacted/projects/environments/test, 
clear=False, global=False)
+   seeder FromAppData(download=False, urllib3=latest, contextlib2=latest, 
idna=latest, ipaddr=latest, colorama=latest, pkg_resources=latest, 
webencodings=latest, pip=latest, progress=latest, setuptools=latest, 
retrying=latest, certifi=latest, chardet=latest, appdirs=latest, 
msgpack=latest, html5lib=latest, pytoml=latest, pyparsing=latest, 
distro=latest, CacheControl=latest, distlib=latest, pep517=latest, 
lockfile=latest, requests=latest, packaging=latest, six=latest, wheel=latest, 
via=copy, 
app_data_dir=/home/redacted/.local/share/virtualenv/seed-app-data/v1.0.1.debian)
+   activators 
BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
  ```
  
  And these exact package versions are what get installed by default.
  ```
  appdirs==1.4.3
  CacheControl==0.12.6
  certifi==2019.11.28
  chardet==3.0.4
  colorama==0.4.3
  contextlib2==0.6.0
  distlib==0.3.0
  distro==1.4.0
  html5lib==1.0.1
  idna==2.8
  ipaddr==2.2.0
  lockfile==0.12.2
  msgpack==0.6.2
  packaging==20.3
  pep517==0.8.2
  progress==1.5
  pyparsing==2.4.6
  pytoml==0.1.21
  requests==2.22.0
  retrying==1.3.3
  six==1.14.0
  urllib3==1.25.8
  webencodings==0.5.1
  ```
  
  All of the packages above are in the folder `~/.local/share/virtualenv
  /seed-app-data/v1.0.1.debian/3.8/wheels`, but removing
  ~/.local/share/virtualenv/seed-app-data does not fix the issue. It is
  recreated with the same packages.
  
  Creating a venv with `python3 -m venv path/to/venv` gives me a clean
  environment with no extra packages which is my current workaround.
  
  System Info:
  
  lsb_release -rd
  Description:  Ubuntu 20.04.1 LTS
  Release:      20.04
  
- apt-cache policy python3-virtualenv        
+ apt-cache policy python3-virtualenv
  python3-virtualenv:
-   Installed: 20.0.17-1
-   Candidate: 20.0.17-1
-   Version table:
-  *** 20.0.17-1 500
-         500 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
-         500 http://us.archive.ubuntu.com/ubuntu focal/universe i386 Packages
-         100 /var/lib/dpkg/status
+   Installed: 20.0.17-1
+   Candidate: 20.0.17-1
+   Version table:
+  *** 20.0.17-1 500
+         500 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
+         500 http://us.archive.ubuntu.com/ubuntu focal/universe i386 Packages
+         100 /var/lib/dpkg/status
  
  ProblemType: Bug
  DistroRelease: Ubuntu 20.04
  Package: python3-virtualenv 20.0.17-1
  ProcVersionSignature: Ubuntu 5.4.0-53.59-generic 5.4.65
  Uname: Linux 5.4.0-53-generic x86_64
  NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair nvidia_modeset 
nvidia
  ApportVersion: 2.20.11-0ubuntu27.12
  Architecture: amd64
  CasperMD5CheckResult: skip
  CurrentDesktop: ubuntu:GNOME
  Date: Thu Nov 19 18:54:36 2020
  InstallationDate: Installed on 2020-05-11 (192 days ago)
  InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
  PackageArchitecture: all
  ProcEnviron:
-  TERM=xterm-256color
-  PATH=(custom, no user)
-  XDG_RUNTIME_DIR=<set>
-  LANG=en_US.UTF-8
-  SHELL=/usr/bin/zsh
+  TERM=xterm-256color
+  PATH=(custom, no user)
+  XDG_RUNTIME_DIR=<set>
+  LANG=en_US.UTF-8
+  SHELL=/usr/bin/zsh
  SourcePackage: python-virtualenv
  UpgradeStatus: No upgrade log present (probably fresh install)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1904945

Title:
  New virtualenvs contain unwanted libraries

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1904945/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to