Search code examples
pythonsetuptoolspython-wheel

Python build always reinstall setuptools


I am using Python 3.8 in conda, and using build to create packages. Although in my Conda env I already have setuptools 51.0 and wheel 0.36, everytime I run python -m build --wheel I see the following messages:

Found existing installation: setuptools 49.2.1
Uninstalling setuptools-49.2.1:
  Successfully uninstalled setuptools-49.2.1
Collecting wheel
  Using cached wheel-0.37.0-py2.py3-none-any.whl (35 kB)
Collecting setuptools>=51
  Using cached setuptools-58.3.0-py3-none-any.whl (946 kB)
Installing collected packages: wheel, setuptools
Successfully installed setuptools-58.3.0 wheel-0.37.0

Here the existing packages don't even match what I have in Conda, and I don't think I need the newest packages either. Could anyone explain why this is happening?


Solution

  • refer to this topic https://pypa-build.readthedocs.io/en/latest/#python--m-build-optional-arguments

    By default build will build the package in an isolated environment, but this behavior can be disabled with --no-isolation.

    so you may need to add --no-isolation flag to force using your project's virtual environment like so:

    python -m build --wheel --no-isolation