xmlsec / python-xmlsec

Python bindings for the XML Security Library.
MIT License
94 stars 97 forks source link

Error in sitecustomize; set PYTHONVERBOSE for traceback: AssertionError: assert not path in sys.path #236

Open markp2 opened 2 years ago

markp2 commented 2 years ago

Unfortunately I have this issue after upgrading pip and setup tools in my non venv environment (brew). Using the -v flag I can see there is an Error in sitecustomize; If I set PYTHONVERBOSE for traceback I see the 2 python Tracebacks in addition to the pip ERROR: No matching distribution found for xmlsec==1.3.12

  Traceback (most recent call last):
    File "/usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site.py", line 549, in execsitecustomize
      import sitecustomize
    File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 883, in exec_module
    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    File "/private/var/folders/3d/5td6p6fj7p3gk7nvkgltv29c0000gp/T/pip-build-env-5d5gilh6/site/sitecustomize.py", line 22, in <module>
      assert not path in sys.path
  AssertionError

  Traceback (most recent call last):
    File "/usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site.py", line 549, in execsitecustomize
      import sitecustomize
    File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 883, in exec_module
    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    File "/private/var/folders/3d/5td6p6fj7p3gk7nvkgltv29c0000gp/T/pip-build-env-5d5gilh6/site/sitecustomize.py", line 22, in <module>
      assert not path in sys.path
  AssertionError
Markss-MBP-9:source mark$ pip install --upgrade pip setuptools
Requirement already satisfied: pip in /usr/local/lib/python3.10/site-packages (22.2.2)
Requirement already satisfied: setuptools in /usr/local/lib/python3.10/site-packages (65.4.0)
Markss-MBP-9:source mark$ 
Markss-MBP-9:source mark$ pip -V
pip 22.2.2 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)
Markss-MBP-9:source mark$ pip3 -V
pip 22.2.2 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)

Markss-MBP-9:source mark$ pip3 install --no-cache-dir --force-reinstall -v  xmlsec==1.3.12
Using pip 22.2.2 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)
Collecting xmlsec==1.3.12
  Downloading xmlsec-1.3.12.tar.gz (64 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.2/64.2 kB 81.4 MB/s eta 0:00:00
  Running command pip subprocess to install build dependencies
  Collecting setuptools>=42
    Using cached setuptools-65.4.0-py3-none-any.whl (1.2 MB)
  Collecting wheel
    Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
  Collecting setuptools_scm[toml]>=3.4
    Using cached setuptools_scm-7.0.5-py3-none-any.whl (42 kB)
  Collecting tomli>=1.0.0
    Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
  Collecting typing-extensions
    Using cached typing_extensions-4.3.0-py3-none-any.whl (25 kB)
  Collecting packaging>=20.0
    Using cached packaging-21.3-py3-none-any.whl (40 kB)
  Collecting pyparsing!=3.0.5,>=2.0.2
    Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
  Installing collected packages: wheel, typing-extensions, tomli, setuptools, pyparsing, packaging, setuptools_scm
  Successfully installed packaging-21.3 pyparsing-3.0.9 setuptools-65.4.0 setuptools_scm-7.0.5 tomli-2.0.1 typing-extensions-4.3.0 wheel-0.37.1
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Error in sitecustomize; set PYTHONVERBOSE for traceback:
  AssertionError:
  Getting requirements to build wheel ... done
  Running command pip subprocess to install backend dependencies
  Collecting setuptools_scm[toml]>=3.4
    Using cached setuptools_scm-7.0.5-py3-none-any.whl (42 kB)
  Collecting setuptools
    Using cached setuptools-65.4.0-py3-none-any.whl (1.2 MB)
  Collecting tomli>=1.0.0
    Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
  Collecting packaging>=20.0
    Using cached packaging-21.3-py3-none-any.whl (40 kB)
  Collecting typing-extensions
    Using cached typing_extensions-4.3.0-py3-none-any.whl (25 kB)
  Collecting pyparsing!=3.0.5,>=2.0.2
    Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
  Installing collected packages: typing-extensions, tomli, setuptools, pyparsing, packaging, setuptools_scm
  Successfully installed packaging-21.3 pyparsing-3.0.9 setuptools-65.4.0 setuptools_scm-7.0.5 tomli-2.0.1 typing-extensions-4.3.0
  Installing backend dependencies ... done
  Running command Preparing metadata (pyproject.toml)
  Error in sitecustomize; set PYTHONVERBOSE for traceback:
  AssertionError:
  /usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py:264: UserWarning: Unknown distribution option: 'use_scm_version'
    warnings.warn(msg)
  running dist_info
  creating /private/var/folders/3d/5td6p6fj7p3gk7nvkgltv29c0000gp/T/pip-modern-metadata-s4eclfej/xmlsec.egg-info
  writing /private/var/folders/3d/5td6p6fj7p3gk7nvkgltv29c0000gp/T/pip-modern-metadata-s4eclfej/xmlsec.egg-info/PKG-INFO
  writing dependency_links to /private/var/folders/3d/5td6p6fj7p3gk7nvkgltv29c0000gp/T/pip-modern-metadata-s4eclfej/xmlsec.egg-info/dependency_links.txt
  writing requirements to /private/var/folders/3d/5td6p6fj7p3gk7nvkgltv29c0000gp/T/pip-modern-metadata-s4eclfej/xmlsec.egg-info/requires.txt
  writing top-level names to /private/var/folders/3d/5td6p6fj7p3gk7nvkgltv29c0000gp/T/pip-modern-metadata-s4eclfej/xmlsec.egg-info/top_level.txt
  writing manifest file '/private/var/folders/3d/5td6p6fj7p3gk7nvkgltv29c0000gp/T/pip-modern-metadata-s4eclfej/xmlsec.egg-info/SOURCES.txt'
  reading manifest file '/private/var/folders/3d/5td6p6fj7p3gk7nvkgltv29c0000gp/T/pip-modern-metadata-s4eclfej/xmlsec.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  no previously-included directories found matching '*/__pycache__'
  no previously-included directories found matching '.github'
  no previously-included directories found matching 'doc'
  warning: no previously-included files found matching '.appveyor.yml'
  warning: no previously-included files found matching '.editorconfig'
  warning: no previously-included files found matching '.travis.yml'
  warning: no previously-included files found matching '.gitattributes'
  warning: no previously-included files found matching '.gitignore'
  warning: no previously-included files found matching 'requirements-test.txt'
  warning: no previously-included files found matching 'requirements.txt'
  warning: no previously-included files found matching 'xmlsec_extra.py'
  warning: no previously-included files found matching 'xmlsec_setupinfo.py'
  adding license file 'LICENSE'
  writing manifest file '/private/var/folders/3d/5td6p6fj7p3gk7nvkgltv29c0000gp/T/pip-modern-metadata-s4eclfej/xmlsec.egg-info/SOURCES.txt'
  creating '/private/var/folders/3d/5td6p6fj7p3gk7nvkgltv29c0000gp/T/pip-modern-metadata-s4eclfej/xmlsec-0.0.0.dist-info'
  adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
  Preparing metadata (pyproject.toml) ... done
  WARNING: Requested xmlsec==1.3.12 from https://files.pythonhosted.org/packages/70/d7/83ac0d43bb92333c8ba3d9be97b85d1b2856ff9f32cebfc87b0e733339cc/xmlsec-1.3.12.tar.gz, but installing version 0.0.0
Discarding https://files.pythonhosted.org/packages/70/d7/83ac0d43bb92333c8ba3d9be97b85d1b2856ff9f32cebfc87b0e733339cc/xmlsec-1.3.12.tar.gz (from https://pypi.org/simple/xmlsec/) (requires-python:>=3.5): Requested xmlsec==1.3.12 from https://files.pythonhosted.org/packages/70/d7/83ac0d43bb92333c8ba3d9be97b85d1b2856ff9f32cebfc87b0e733339cc/xmlsec-1.3.12.tar.gz has inconsistent version: filename has '1.3.12', but metadata has '0.0.0'
ERROR: Could not find a version that satisfies the requirement xmlsec==1.3.12 (from versions: 0.1.0, 0.1.1, 0.1.2, 0.2.0, 0.3.0, 0.3.1, 0.3.3, 0.4.0, 0.5.0, 0.6.0, 0.6.1, 1.0.1, 1.0.2.dev0, 1.0.3.dev0, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.1.0, 1.2.0, 1.3.1, 1.3.2, 1.3.3, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11, 1.3.12, 1.3.13)
ERROR: No matching distribution found for xmlsec==1.3.12
Markss-MBP-9:source mark$ 

Is there a way for me [or you] to modify the assert line to show the paths:

assert not path in sys.path, (path, sys.path)

markp2 commented 2 years ago

Found the assert line - it originates in file python3.10/site-packages/pip/_internal/build_env.py

I then modified this file to show the assertion:

assert not path in sys.path, (path, sys.path).

Running now shows this error:

AssertionError: ('/usr/local/lib/python3.10/site-packages', ['/private/var/folders/3d/5td6p6fj7p3gk7nvkgltv29c0000gp/T/pip-build-env-muoavmtc/site', '/usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python310.zip', '/usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10', '/usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload', '/usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages', '/usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/multicorn-2.3-py3.10-macosx-10.15-x86_64.egg', '/usr/local/lib/python3.10/site-packages', '/usr/local/lib/python3.10/site-packages/multicorn-2.3-py3.10-macosx-10.15-x86_64.egg'] )

Is this a pip or xmlsec install issue - asserting that '/usr/local/lib/python3.10/site-packages' should not be in sys.path? For example does xmlsec override PYTHONPATH?

hoefling commented 2 years ago

The assertion error is negligible since it doesn't abort the installation. For now it looks like an issue with setuptools-scm to me. What is the output of pip install 'setuptools-scm<7' && pip install xmlsec --no-build-isolation?