vext-python / vext

Use system python packages in virtualenv.
MIT License
72 stars 7 forks source link

vext can no longer be installed in virtual environments without wheel, and also causes a warning at every pip command #84

Open nathanael-naeri opened 2 years ago

nathanael-naeri commented 2 years ago

It used to be that vext could be installed in a fresh virtual environment containing only the default pip, setuptools and pkg_resources packages. From setuptools 60.8.0 (5 Feb 2022) that is no longer possible. Workaround: install wheel in the virtual environment before installing vext. Maybe this could be documented in the README file, or wheel could be made a dependency of vext?

Besides, irrespective of whether wheel is available in the virtual environment, vext now causes an (apparently related) warning to be printed out at every pip command.

Steps to reproduce (using Python 3.8.10 on Ubuntu 20.04 LTS):

  1. Create a fresh virtual environment and upgrade pip to current version (22.0.3) and setuptools to last working version (60.7.1):

    $ python3 -m venv .test
    $ source .test/bin/activate
    $ pip3 install --upgrade pip==22.0.3 setuptools==60.7.1
    $ pip3 list
    Package       Version
    ------------- -------
    pip           22.0.3
    pkg_resources 0.0.0
    setuptools    60.7.1
  2. Install vext (or, supposedly, vext.<something>). All subsequent pip commands will show a warning about setuptools replacing distutils:

    $ pip3 install vext
    $ pip3 list
    /home/me/.test/lib/python3.8/site-packages/_distutils_hack/__init__.py:30: UserWarning: Setuptools is replacing distutils.
     warnings.warn("Setuptools is replacing distutils.")
    Package          Version
    ---------------- -------
    pip              22.0.3
    pkg_resources    0.0.0
    ruamel.yaml      0.17.21
    ruamel.yaml.clib 0.2.6
    setuptools       60.7.1
    vext             0.7.6
  3. Uninstall vext and upgrade to following version of setuptools (60.8.0) or current version (60.9.3):

    $ pip3 uninstall vext
    $ pip3 install --upgrade setuptools[==60.8.0]
    $ pip3 list
    Package          Version
    ---------------- -------
    pip              22.0.3
    pkg_resources    0.0.0
    ruamel.yaml      0.17.21
    ruamel.yaml.clib 0.2.6
    setuptools       60.8.0
  4. Trying to install vext now fails:

    $ pip3 install vext
    Collecting vext
     Using cached vext-0.7.6.tar.gz (17 kB)
     Preparing metadata (setup.py) ... done
    Requirement already satisfied: ruamel.yaml>=0.11.10 in ./.test/lib/python3.8/site-packages (from vext) (0.17.21)
    Requirement already satisfied: ruamel.yaml.clib>=0.2.6 in ./.test/lib/python3.8/site-packages (from ruamel.yaml>=0.11.10->vext) (0.2.6)
    Using legacy 'setup.py install' for vext, since package 'wheel' is not installed.
    Installing collected packages: vext
     Running setup.py install for vext ... error
     error: subprocess-exited-with-error
    
     × Running setup.py install for vext did not run successfully.
     │ exit code: 1
     ╰─> [21 lines of output]
         /tmp/pip-install-bj785xy9/vext_c071c2f82fdf44bdbad01a8f444a7069/setup.py:45: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
           if StrictVersion(r.version) >= StrictVersion(MIN_SETUPTOOLS):
         setuptools version: 60.8.0
         /home/me/.test/lib/python3.8/site-packages/setuptools/dist.py:732: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
           warnings.warn(
         Traceback (most recent call last):
           File "<string>", line 2, in <module>
           File "<pip-setuptools-caller>", line 34, in <module>
           File "/tmp/pip-install-bj785xy9/vext_c071c2f82fdf44bdbad01a8f444a7069/setup.py", line 280, in <module>
             setup(
           File "/home/me/.test/lib/python3.8/site-packages/setuptools/__init__.py", line 154, in setup
             _install_setup_requires(attrs)
           File "/home/me/.test/lib/python3.8/site-packages/setuptools/__init__.py", line 148, in _install_setup_requires
             dist.fetch_build_eggs(dist.setup_requires)
           File "/home/me/.test/lib/python3.8/site-packages/setuptools/dist.py", line 821, in fetch_build_eggs
             resolved_dists = pkg_resources.working_set.resolve(
           File "/home/me/.test/lib/python3.8/site-packages/pkg_resources/__init__.py", line 739, in resolve
             requirements = list(requirements)[::-1]
           File "/home/me/.test/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3089, in __init__
             super(Requirement, self).__init__(requirement_string)
         TypeError: super(type, obj): obj must be an instance or subtype of type
         [end of output]
    
     note: This error originates from a subprocess, and is likely not a problem with pip.
    error: legacy-install-failure
    
    × Encountered error while trying to install package.
    ╰─> vext
    
    note: This is an issue with the package mentioned above, not pip.
    hint: See above for output from the failure.
  5. Installing wheel makes it possible to install vext, but warnings are back:

    $ pip3 install wheel
    $ pip3 install vext
    Collecting vext
     Using cached vext-0.7.6.tar.gz (17 kB)
     Preparing metadata (setup.py) ... done
    Requirement already satisfied: ruamel.yaml>=0.11.10 in ./.test/lib/python3.8/site-packages (from vext) (0.17.21)
    Requirement already satisfied: ruamel.yaml.clib>=0.2.6 in ./.test/lib/python3.8/site-packages (from ruamel.yaml>=0.11.10->vext) (0.2.6)
    Building wheels for collected packages: vext
     Building wheel for vext (setup.py) ... done
     Created wheel for vext: filename=vext-0.7.6-py3-none-any.whl size=13952 sha256=ec89138acb12b6638d335a6910ab1bcd335fe561184472e4327bee8cf37661a4
     Stored in directory: /home/me/.cache/pip/wheels/f3/e9/3d/b5293c1d36a96863ef7e7a87da81c68601328a5fd6544c85a5
    Successfully built vext
    Installing collected packages: vext
    Successfully installed vext-0.7.6
    $ pip3 list
    /home/me/.test/lib/python3.8/site-packages/_distutils_hack/__init__.py:30: UserWarning: Setuptools is replacing distutils.
     warnings.warn("Setuptools is replacing distutils.")
    Package          Version
    ---------------- -------
    pip              22.0.3
    pkg_resources    0.0.0
    ruamel.yaml      0.17.21
    ruamel.yaml.clib 0.2.6
    setuptools       60.8.0
    vext             0.7.6
    wheel            0.37.1
nathanael-naeri commented 2 years ago

PS to item 5. above:

Additionally, installing vext.gi after wheel, instead of installing vext after wheel, succeeds with confusing error message (and of course, warnings are back). In virtual environment with pip 22.0.4 and setuptools 60.9.3:

$ pip3 install wheel
$ pip3 install vext.gi
Collecting vext.gi
  Using cached vext.gi-0.7.4.tar.gz (2.9 kB)
  Preparing metadata (setup.py) ... done
Collecting vext>=0.7.4
  Using cached vext-0.7.6-py3-none-any.whl
Collecting ruamel.yaml>=0.11.10
  Using cached ruamel.yaml-0.17.21-py3-none-any.whl (109 kB)
Collecting ruamel.yaml.clib>=0.2.6
  Using cached ruamel.yaml.clib-0.2.6-cp38-cp38-manylinux1_x86_64.whl (570 kB)
Building wheels for collected packages: vext.gi
  Building wheel for vext.gi (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      running bdist_wheel
      running build
      /home/me/.vextgi-venv/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      installing to build/bdist.linux-x86_64/wheel
      running install
      vext.gi Install
      running install_data
      creating build
      creating build/bdist.linux-x86_64
      creating build/bdist.linux-x86_64/wheel
      creating build/bdist.linux-x86_64/wheel/vext.gi-0.7.4.data
      creating build/bdist.linux-x86_64/wheel/vext.gi-0.7.4.data/data
      creating build/bdist.linux-x86_64/wheel/vext.gi-0.7.4.data/data/share
      creating build/bdist.linux-x86_64/wheel/vext.gi-0.7.4.data/data/share/vext
      creating build/bdist.linux-x86_64/wheel/vext.gi-0.7.4.data/data/share/vext/specs
      copying gi.vext -> build/bdist.linux-x86_64/wheel/vext.gi-0.7.4.data/data/share/vext/specs
      running install_egg_info
      running egg_info
      writing vext.gi.egg-info/PKG-INFO
      writing dependency_links to vext.gi.egg-info/dependency_links.txt
      writing requirements to vext.gi.egg-info/requires.txt
      writing top-level names to vext.gi.egg-info/top_level.txt
      reading manifest file 'vext.gi.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching '*.txt'
      writing manifest file 'vext.gi.egg-info/SOURCES.txt'
      Copying vext.gi.egg-info to build/bdist.linux-x86_64/wheel/vext.gi-0.7.4-py3.8.egg-info
      running install_scripts
      Install vext files:
      error: [Errno 2] No such file or directory: 'vext'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for vext.gi
  Running setup.py clean for vext.gi
Failed to build vext.gi
Installing collected packages: ruamel.yaml.clib, ruamel.yaml, vext, vext.gi
  Running setup.py install for vext.gi ... done
  DEPRECATION: vext.gi was installed using the legacy 'setup.py install' method, because a wheel could not be built for it. A possible replacement is to fix the wheel build issue reported above. Discussion can be found at https://github.com/pypa/pip/issues/8368
Successfully installed ruamel.yaml-0.17.21 ruamel.yaml.clib-0.2.6 vext-0.7.6 vext.gi-0.7.4
$ pip3 list
/home/me/.vextgi-venv/lib/python3.8/site-packages/_distutils_hack/__init__.py:30: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
Package          Version
---------------- -------
pip              22.0.4
pkg_resources    0.0.0
ruamel.yaml      0.17.21
ruamel.yaml.clib 0.2.6
setuptools       60.9.3
vext             0.7.6
vext.gi          0.7.4
wheel            0.37.1

Installation works better when installing vext.gi after vext after wheel: no confusing error (warnings are back the same):

$ pip3 install wheel
$ pip3 install vext
Collecting vext
  Using cached vext-0.7.6-py3-none-any.whl
Collecting ruamel.yaml>=0.11.10
  Using cached ruamel.yaml-0.17.21-py3-none-any.whl (109 kB)
Collecting ruamel.yaml.clib>=0.2.6
  Using cached ruamel.yaml.clib-0.2.6-cp38-cp38-manylinux1_x86_64.whl (570 kB)
Installing collected packages: ruamel.yaml.clib, ruamel.yaml, vext
Successfully installed ruamel.yaml-0.17.21 ruamel.yaml.clib-0.2.6 vext-0.7.6
$ pip3 list
Package          Version
---------------- -------
pip              22.0.4
pkg_resources    0.0.0
ruamel.yaml      0.17.21
ruamel.yaml.clib 0.2.6
setuptools       60.9.3
vext             0.7.6
wheel            0.37.1
$ pip3 install vext.gi
Collecting vext.gi
  Using cached vext.gi-0.7.4.tar.gz (2.9 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: vext>=0.7.4 in ./.vext-venv/lib/python3.8/site-packages (from vext.gi) (0.7.6)
Requirement already satisfied: ruamel.yaml>=0.11.10 in ./.vext-venv/lib/python3.8/site-packages (from vext>=0.7.4->vext.gi) (0.17.21)
Requirement already satisfied: ruamel.yaml.clib>=0.2.6 in ./.vext-venv/lib/python3.8/site-packages (from ruamel.yaml>=0.11.10->vext>=0.7.4->vext.gi) (0.2.6)
Building wheels for collected packages: vext.gi
  Building wheel for vext.gi (setup.py) ... done
  Created wheel for vext.gi: filename=vext.gi-0.7.4-py3-none-any.whl size=2031 sha256=8b2c6befa0143ffab96180d8b3e8a9c99733ace8216123319747871b71e588b7
  Stored in directory: /home/me/.cache/pip/wheels/4a/d7/2b/c644d93e04f5f36ae22e28d9527212f96d3ead8216ab3c0477
Successfully built vext.gi
Installing collected packages: vext.gi
Successfully installed vext.gi-0.7.4
$ pip3 list
/home/me/.vext-venv/lib/python3.8/site-packages/_distutils_hack/__init__.py:30: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
Package          Version
---------------- -------
pip              22.0.4
pkg_resources    0.0.0
ruamel.yaml      0.17.21
ruamel.yaml.clib 0.2.6
setuptools       60.9.3
vext             0.7.6
vext.gi          0.7.4
wheel            0.37.1
FriedrichFroebel commented 4 months ago

I cannot really reproduce this. Running pip install vext on Python 3.10 works correctly with the following virtual environment:

Package          Version
---------------- -------
pip              24.1.1
ruamel.yaml      0.18.6
ruamel.yaml.clib 0.2.8
setuptools       70.1.1

The distutils warnings have been fixed on the master branch.