virtualenv icon indicating copy to clipboard operation
virtualenv copied to clipboard

setuptools >50 failed with pbr in virtualenv

Open raczben opened this issue 5 years ago • 2 comments

Issue

Cannot install package with setuptools 50 or above with pbr in virtualenv. Venv is OK.

Environment

Provide at least:

  • OS: WSL-I Linux LAPTOP-9OMIOB2A 4.4.0-19041-Microsoft #488-Microsoft Mon Sep 01 13:43:00 PST 2020 x86_64 x86_64 x86_64 GNU/Linux
  • pip list of the host python where virtualenv is installed:
python3 -m pip list             
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
appdirs (1.4.4)
asn1crypto (0.24.0)
astroid (2.4.2)
cryptography (2.1.4)
distlib (0.3.1)
filelock (3.0.12)
grako (3.99.9)
idna (2.6)
isort (5.6.4)
keyring (10.6.0)
keyrings.alt (3.0)
lazy-object-proxy (1.4.3)
mccabe (0.6.1)
meld (3.18.0)
pip (9.0.1)
pycairo (1.16.2)
pycrypto (2.6.1)
pyDigitalWaveTools (0.7)
pygobject (3.26.1)
pylint (2.6.0)
pyxdg (0.25)
SecretStorage (2.3.1)
setuptools (39.0.1)
six (1.15.0)
toml (0.10.2)
virtualenv (20.1.0)
wheel (0.35.1)
wrapt (1.12.1)

Output of the virtual environment creation

Make sure to run the creation with -vvv --with-traceback:

~ » python3 -m  virtualenv -vvv myvenv      
117 setup logging to NOTSET [DEBUG report:43]
140 find interpreter for spec PythonSpec(path=/usr/bin/python3) [INFO builtin:51]
141 proposed PythonInfo(spec=CPython3.8.0.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.8.0 (default, Oct 28 2019, 16:14:01) \n[GCC 8.3.0]', encoding_fs_io=utf-8-utf-8) [INFO builtin:57]
141 accepted PythonInfo(spec=CPython3.8.0.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.8.0 (default, Oct 28 2019, 16:14:01) \n[GCC 8.3.0]', encoding_fs_io=utf-8-utf-8) [DEBUG builtin:59]
148 filesystem is case-sensitive [DEBUG info:28]
209 create virtual environment via CPython3Posix(dest=/home/beton/myvenv, clear=False, global=False) [INFO session:52]
210 create folder /home/beton/myvenv/bin [DEBUG _sync:25]
211 create folder /home/beton/myvenv/lib/python3.8/site-packages [DEBUG _sync:25]
212 write /home/beton/myvenv/pyvenv.cfg [DEBUG pyenv_cfg:34]
213     home = /usr [DEBUG pyenv_cfg:38]
214     implementation = CPython [DEBUG pyenv_cfg:38]
215     version_info = 3.8.0.final.0 [DEBUG pyenv_cfg:38]
216     virtualenv = 20.1.0 [DEBUG pyenv_cfg:38]
216     include-system-site-packages = false [DEBUG pyenv_cfg:38]
217     base-prefix = /usr [DEBUG pyenv_cfg:38]
218     base-exec-prefix = /usr [DEBUG pyenv_cfg:38]
218     base-executable = /usr/bin/python3 [DEBUG pyenv_cfg:38]
221 symlink /usr/bin/python3 to /home/beton/myvenv/bin/python [DEBUG _sync:44]
228 create virtualenv import hook file /home/beton/myvenv/lib/python3.8/site-packages/_virtualenv.pth [DEBUG api:95]
232 create /home/beton/myvenv/lib/python3.8/site-packages/_virtualenv.py [DEBUG api:98]
240 ============================== target debug ============================== [DEBUG session:54]
241 debug via /home/beton/myvenv/bin/python /home/beton/.local/lib/python3.8/site-packages/virtualenv/create/debug.py [DEBUG creator:213]
240 {
  "sys": {
    "executable": "/home/beton/myvenv/bin/python",
    "_base_executable": "/home/beton/myvenv/bin/python",
    "prefix": "/home/beton/myvenv",
    "base_prefix": "/usr",
    "real_prefix": null,
    "exec_prefix": "/home/beton/myvenv",
    "base_exec_prefix": "/usr",
    "path": [
      "/usr/lib/python38.zip",
      "/usr/lib/python3.8",
      "/usr/lib/python3.8/lib-dynload",
      "/home/beton/myvenv/lib/python3.8/site-packages"
    ],
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib_external.PathFinder'>"
    ],
    "fs_encoding": "utf-8",
    "io_encoding": "utf-8"
  },
  "version": "3.8.0 (default, Oct 28 2019, 16:14:01) \n[GCC 8.3.0]",
  "makefile_filename": "/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/Makefile",
  "os": "<module 'os' from '/usr/lib/python3.8/os.py'>",
  "site": "<module 'site' from '/usr/lib/python3.8/site.py'>",
  "datetime": "<module 'datetime' from '/usr/lib/python3.8/datetime.py'>",
  "math": "<module 'math' (built-in)>",
  "json": "<module 'json' from '/usr/lib/python3.8/json/__init__.py'>"
} [DEBUG session:55]
363 add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/beton/.local/share/virtualenv) [INFO session:59]
369 got embed update of distribution setuptools from /home/beton/.local/share/virtualenv/wheel/3.8/embed/1/setuptools.json [DEBUG via_disk_folder:133]
371 got embed update of distribution pip from /home/beton/.local/share/virtualenv/wheel/3.8/embed/1/pip.json [DEBUG via_disk_folder:133]
371 got embed update of distribution wheel from /home/beton/.local/share/virtualenv/wheel/3.8/embed/1/wheel.json [DEBUG via_disk_folder:133]
381 got embed update of distribution wheel from /home/beton/.local/share/virtualenv/wheel/3.8/embed/1/wheel.json [DEBUG via_disk_folder:133]
381 got embed update of distribution pip from /home/beton/.local/share/virtualenv/wheel/3.8/embed/1/pip.json [DEBUG via_disk_folder:133]
382 got embed update of distribution setuptools from /home/beton/.local/share/virtualenv/wheel/3.8/embed/1/setuptools.json [DEBUG via_disk_folder:133]
386 install wheel from wheel /home/beton/.local/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/wheel-0.35.1-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:51]
386 install pip from wheel /home/beton/.local/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-20.2.4-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:51]
387 install setuptools from wheel /home/beton/.local/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/setuptools-50.3.2-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:51]
387 Attempting to acquire lock 139656368949760 on /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any.lock [DEBUG filelock:270]
389 Attempting to acquire lock 139656368949808 on /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.4-py2.py3-none-any.lock [DEBUG filelock:270]
390 Attempting to acquire lock 139656368949376 on /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.2-py3-none-any.lock [DEBUG filelock:270]
401 Lock 139656368949760 acquired on /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any.lock [INFO filelock:274]
401 Lock 139656368949808 acquired on /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.4-py2.py3-none-any.lock [INFO filelock:274]
402 Lock 139656368949376 acquired on /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.2-py3-none-any.lock [INFO filelock:274]
405 Attempting to release lock 139656368949760 on /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any.lock [DEBUG filelock:315]
405 Attempting to release lock 139656368949808 on /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.4-py2.py3-none-any.lock [DEBUG filelock:315]
414 Lock 139656368949760 released on /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any.lock [INFO filelock:318]
414 Attempting to release lock 139656368949376 on /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.2-py3-none-any.lock [DEBUG filelock:315]
414 Lock 139656368949808 released on /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.4-py2.py3-none-any.lock [INFO filelock:318]
415 copy directory /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any/wheel to /home/beton/myvenv/lib/python3.8/site-packages/wheel [DEBUG _sync:52]
416 Lock 139656368949376 released on /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.2-py3-none-any.lock [INFO filelock:318]
417 copy directory /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.4-py2.py3-none-any/pip to /home/beton/myvenv/lib/python3.8/site-packages/pip [DEBUG _sync:52]
421 copy directory /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.2-py3-none-any/_distutils_hack to /home/beton/myvenv/lib/python3.8/site-packages/_distutils_hack [DEBUG _sync:52]
435 copy /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.2-py3-none-any/distutils-precedence.pth to /home/beton/myvenv/lib/python3.8/site-packages/distutils-precedence.pth [DEBUG _sync:52]
439 copy /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.2-py3-none-any/easy_install.py to /home/beton/myvenv/lib/python3.8/site-packages/easy_install.py [DEBUG _sync:52]
444 copy directory /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.2-py3-none-any/pkg_resources to /home/beton/myvenv/lib/python3.8/site-packages/pkg_resources [DEBUG _sync:52]
480 copy directory /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any/wheel-0.35.1.dist-info to /home/beton/myvenv/lib/python3.8/site-packages/wheel-0.35.1.dist-info [DEBUG _sync:52]
508 copy /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any/wheel-0.35.1.virtualenv to /home/beton/myvenv/lib/python3.8/site-packages/wheel-0.35.1.virtualenv [DEBUG _sync:52]
513 copy directory /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.2-py3-none-any/setuptools to /home/beton/myvenv/lib/python3.8/site-packages/setuptools [DEBUG _sync:52]
522 generated console scripts wheel-3.8 wheel wheel3.8 wheel3 [DEBUG base:48]
821 copy directory /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.2-py3-none-any/setuptools-50.3.2.dist-info to /home/beton/myvenv/lib/python3.8/site-packages/setuptools-50.3.2.dist-info [DEBUG _sync:52]
848 copy /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.2-py3-none-any/setuptools-50.3.2.virtualenv to /home/beton/myvenv/lib/python3.8/site-packages/setuptools-50.3.2.virtualenv [DEBUG _sync:52]
857 generated console scripts easy_install easy_install3 easy_install-3.8 easy_install3.8 [DEBUG base:48]
1271 copy directory /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.4-py2.py3-none-any/pip-20.2.4.dist-info to /home/beton/myvenv/lib/python3.8/site-packages/pip-20.2.4.dist-info [DEBUG _sync:52]
1287 copy /home/beton/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.4-py2.py3-none-any/pip-20.2.4.virtualenv to /home/beton/myvenv/lib/python3.8/site-packages/pip-20.2.4.virtualenv [DEBUG _sync:52]
1295 generated console scripts pip pip3.8 pip-3.8 pip3 [DEBUG base:48]
1296 add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [INFO session:64]
1319 write /home/beton/myvenv/pyvenv.cfg [DEBUG pyenv_cfg:34]
1320    home = /usr [DEBUG pyenv_cfg:38]
1320    implementation = CPython [DEBUG pyenv_cfg:38]
1321    version_info = 3.8.0.final.0 [DEBUG pyenv_cfg:38]
1322    virtualenv = 20.1.0 [DEBUG pyenv_cfg:38]
1322    include-system-site-packages = false [DEBUG pyenv_cfg:38]
1323    base-prefix = /usr [DEBUG pyenv_cfg:38]
1324    base-exec-prefix = /usr [DEBUG pyenv_cfg:38]
1324    base-executable = /usr/bin/python3 [DEBUG pyenv_cfg:38]
1326 created virtual environment CPython3.8.0.final.0-64 in 1211ms
  creator CPython3Posix(dest=/home/beton/myvenv, clear=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/beton/.local/share/virtualenv)
    added seed packages: pip==20.2.4, setuptools==50.3.2, wheel==0.35.1
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator [WARNING __main__:17]
#setup.py
from setuptools import setup

setup(
    setup_requires=['pbr'],
    pbr=True
)
#setup.cfg
[metadata]
name            = mypkg
)

Activate:

. ./myvenv/bin/activate

Error:

~/mypkg(master*) » python setup.py develop   
Traceback (most recent call last):
  File "setup.py", line 3, in <module>
    setup(
  File "/home/beton/myvenv/lib/python3.8/site-packages/setuptools/__init__.py", line 152, in setup
    _install_setup_requires(attrs)
  File "/home/beton/myvenv/lib/python3.8/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/home/beton/myvenv/lib/python3.8/site-packages/setuptools/dist.py", line 673, in fetch_build_eggs
    resolved_dists = pkg_resources.working_set.resolve(
  File "/home/beton/myvenv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 764, in resolve
    dist = best[req.key] = env.best_match(
  File "/home/beton/myvenv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1049, in best_match
    return self.obtain(req, installer)
  File "/home/beton/myvenv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1061, in obtain
    return installer(requirement)
  File "/home/beton/myvenv/lib/python3.8/site-packages/setuptools/dist.py", line 732, in fetch_build_egg
    return fetch_build_egg(self, req)
  File "/home/beton/myvenv/lib/python3.8/site-packages/setuptools/installer.py", line 131, in fetch_build_egg
    wheel.install_as_egg(dist_location)
  File "/home/beton/myvenv/lib/python3.8/site-packages/setuptools/wheel.py", line 95, in install_as_egg
    self._install_as_egg(destination_eggdir, zf)
  File "/home/beton/myvenv/lib/python3.8/site-packages/setuptools/wheel.py", line 103, in _install_as_egg
    self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
  File "/home/beton/myvenv/lib/python3.8/site-packages/setuptools/wheel.py", line 124, in _convert_metadata
    os.mkdir(destination_eggdir)
FileExistsError: [Errno 17] File exists: '/home/beton/mypkg/.eggs/pbr-5.5.1-py3.8.egg'
(myvenv) ---------------------------------------------------------------------------------------------------------

raczben avatar Nov 16 '20 16:11 raczben

For start setup requires is deprecated. Then the error seems setuptools related rather than virtualenv. Can you create a reproducible of the issue (ideally on docker image)?

gaborbernat avatar Nov 16 '20 16:11 gaborbernat

I have no experience with docker...

I have created a sample project to reproduce the issue: https://github.com/raczben/setuptools_i2010

I cannot reproduce under Windows and native Linux. I can reproduce only under WSL (I have tested both Python3.8, and Python3.6)

raczben avatar Nov 17 '20 16:11 raczben

As this is 3 years old without updates closing it.

gaborbernat avatar Jun 27 '23 03:06 gaborbernat