René's URL Explorer Experiment


Title: add2virtualenv logic breaks builds of packages with modern build backend · Issue #98 · python-virtualenvwrapper/virtualenvwrapper · GitHub

Open Graph Title: add2virtualenv logic breaks builds of packages with modern build backend · Issue #98 · python-virtualenvwrapper/virtualenvwrapper

X Title: add2virtualenv logic breaks builds of packages with modern build backend · Issue #98 · python-virtualenvwrapper/virtualenvwrapper

Description: The logic in add2virtualenv of adding paths to the front of sys.path breaks installing packages in the virtualenv that use a PEP517 build. In preparing the build environment pip tries to determine the necessary sys.path using a "sitecust...

Open Graph Description: The logic in add2virtualenv of adding paths to the front of sys.path breaks installing packages in the virtualenv that use a PEP517 build. In preparing the build environment pip tries to determine ...

X Description: The logic in add2virtualenv of adding paths to the front of sys.path breaks installing packages in the virtualenv that use a PEP517 build. In preparing the build environment pip tries to determine ...

Opengraph URL: https://github.com/python-virtualenvwrapper/virtualenvwrapper/issues/98

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"add2virtualenv logic breaks builds of packages with modern build backend","articleBody":"The logic in add2virtualenv of adding paths to the front of sys.path breaks installing packages in the virtualenv that use a PEP517 build. In preparing the build environment pip tries to determine the necessary sys.path using a \"sitecustomize.py\" written in pip's `_internal/build_env.py`, which gets confused with paths not being added to the end of sys.path. The result is that the lib-dynload path of the Python environment gets removed from sys.path and pip install fails with a traceback like this\r\n\r\n```python\r\n# pip install .\r\nProcessing /Devel/foo\r\n  Installing build dependencies ... done\r\n  Getting requirements to build wheel ... done\r\nERROR: Exception:\r\nTraceback (most recent call last):\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/cli/base_command.py\", line 180, in exc_logging_wrapper\r\n    status = run_func(*args)\r\n             ^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/cli/req_command.py\", line 245, in wrapper\r\n    return func(self, options, args)\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/commands/install.py\", line 377, in run\r\n    requirement_set = resolver.resolve(\r\n                      ^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/resolver.py\", line 76, in resolve\r\n    collected = self.factory.collect_root_requirements(root_reqs)\r\n                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/factory.py\", line 534, in collect_root_requirements\r\n    reqs = list(\r\n           ^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/factory.py\", line 490, in _make_requirements_from_install_req\r\n    cand = self._make_base_candidate_from_link(\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/factory.py\", line 228, in _make_base_candidate_from_link\r\n    self._link_candidate_cache[link] = LinkCandidate(\r\n                                       ^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py\", line 290, in __init__\r\n    super().__init__(\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py\", line 156, in __init__\r\n    self.dist = self._prepare()\r\n                ^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py\", line 222, in _prepare\r\n    dist = self._prepare_distribution()\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py\", line 301, in _prepare_distribution\r\n    return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/operations/prepare.py\", line 525, in prepare_linked_requirement\r\n    return self._prepare_linked_requirement(req, parallel_builds)\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/operations/prepare.py\", line 640, in _prepare_linked_requirement\r\n    dist = _get_prepared_distribution(\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/operations/prepare.py\", line 71, in _get_prepared_distribution\r\n    abstract_dist.prepare_distribution_metadata(\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/distributions/sdist.py\", line 54, in prepare_distribution_metadata\r\n    self._install_build_reqs(finder)\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/distributions/sdist.py\", line 124, in _install_build_reqs\r\n    build_reqs = self._get_build_requires_wheel()\r\n                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/distributions/sdist.py\", line 101, in _get_build_requires_wheel\r\n    return backend.get_requires_for_build_wheel()\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_internal/utils/misc.py\", line 745, in get_requires_for_build_wheel\r\n    return super().get_requires_for_build_wheel(config_settings=cs)\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_impl.py\", line 166, in get_requires_for_build_wheel\r\n    return self._call_hook('get_requires_for_build_wheel', {\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_impl.py\", line 321, in _call_hook\r\n    raise BackendUnavailable(data.get('traceback', ''))\r\npip._vendor.pyproject_hooks._impl.BackendUnavailable: Traceback (most recent call last):\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py\", line 77, in _build_backend\r\n    obj = import_module(mod_path)\r\n          ^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/usr/lib64/python3.11/importlib/__init__.py\", line 126, in import_module\r\n    return _bootstrap._gcd_import(name[level:], package, level)\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1204, in _gcd_import\r\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1176, in _find_and_load\r\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1126, in _find_and_load_unlocked\r\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 241, in _call_with_frames_removed\r\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1204, in _gcd_import\r\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1176, in _find_and_load\r\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1147, in _find_and_load_unlocked\r\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 690, in _load_unlocked\r\n  File \"\u003cfrozen importlib._bootstrap_external\u003e\", line 940, in exec_module\r\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 241, in _call_with_frames_removed\r\n  File \"/tmp/pip-build-env-pitma8s7/overlay/lib/python3.11/site-packages/setuptools/__init__.py\", line 8, in \u003cmodule\u003e\r\n    import _distutils_hack.override  # noqa: F401\r\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/_distutils_hack/override.py\", line 1, in \u003cmodule\u003e\r\n    __import__('_distutils_hack').do_override()\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/_distutils_hack/__init__.py\", line 70, in do_override\r\n    ensure_local_distutils()\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/_distutils_hack/__init__.py\", line 53, in ensure_local_distutils\r\n    importlib.import_module('distutils')\r\n  File \"/usr/lib64/python3.11/importlib/__init__.py\", line 126, in import_module\r\n    return _bootstrap._gcd_import(name[level:], package, level)\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/_distutils_hack/__init__.py\", line 90, in find_spec\r\n    return method()\r\n           ^^^^^^^^\r\n  File \"/root/.virtualenvs/foo/lib/python3.11/site-packages/_distutils_hack/__init__.py\", line 97, in spec_for_distutils\r\n    import importlib.abc\r\n  File \"/usr/lib64/python3.11/importlib/abc.py\", line 19, in \u003cmodule\u003e\r\n    from .resources.abc import ResourceReader, Traversable, TraversableResources\r\n  File \"/usr/lib64/python3.11/importlib/resources/__init__.py\", line 3, in \u003cmodule\u003e\r\n    from ._common import (\r\n  File \"/usr/lib64/python3.11/importlib/resources/_common.py\", line 3, in \u003cmodule\u003e\r\n    import tempfile\r\n  File \"/usr/lib64/python3.11/tempfile.py\", line 45, in \u003cmodule\u003e\r\n    from random import Random as _Random\r\n  File \"/usr/lib64/python3.11/random.py\", line 49, in \u003cmodule\u003e\r\n    from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil\r\nModuleNotFoundError: No module named 'math'\r\n```\r\n\r\nThis can be reproduced with a fresh virtualenv that contains a couple - in this setup it was three, but in other environments two were enough - paths added via add2virtualenv\r\n\r\n```bash\r\nmkvirtualenv foo\r\nmkdir dummy1 dummy2 dummy3\r\nadd2virtualenv dummy1 dummy2 dummy3\r\n```\r\n\r\nand then installing a basically empty package with a minimal pyproject.toml\r\n\r\n```bash\r\necho \"[project]\r\nname = 'bar'\r\nversion = '1.0.0'\r\n\r\n[build-system]\r\nrequires = ['setuptools']\r\nbuild-backend = 'setuptools.build_meta'\" \u003e pyproject.toml\r\npip install .\r\n```","author":{"url":"https://github.com/dfn-certling","@type":"Person","name":"dfn-certling"},"datePublished":"2024-04-17T16:02:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/98/virtualenvwrapper/issues/98"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:5148f328-02df-4efd-8b6b-dfbcf0172c09
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id96CE:247E0C:219FF96:2DEE251:696AC98E
html-safe-noncedeace29281209391170e10a5ea78967b6c2940732bf4507c8d3bc4fb2cf5495f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NkNFOjI0N0UwQzoyMTlGRjk2OjJERUUyNTE6Njk2QUM5OEUiLCJ2aXNpdG9yX2lkIjoiODA3MjgxMjYyNDI5NTQxNDE1OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace1dd47fa86c8895a026579c25d061d80d45db8b0a63131b9245b283054efa28e
hovercard-subject-tagissue:2248663828
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-virtualenvwrapper/virtualenvwrapper/98/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4f98ce7a9e0f46a02973d0cc1646d0e9fb502554e4d88ae718e350248c5d061f/python-virtualenvwrapper/virtualenvwrapper/issues/98
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4f98ce7a9e0f46a02973d0cc1646d0e9fb502554e4d88ae718e350248c5d061f/python-virtualenvwrapper/virtualenvwrapper/issues/98
og:image:altThe logic in add2virtualenv of adding paths to the front of sys.path breaks installing packages in the virtualenv that use a PEP517 build. In preparing the build environment pip tries to determine ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedfn-certling
hostnamegithub.com
expected-hostnamegithub.com
Nonec785f4ce187e9e7331257791b36ddee01625bb8e292a9b4fe2c16d4c006abf5d
turbo-cache-controlno-preview
go-importgithub.com/python-virtualenvwrapper/virtualenvwrapper git https://github.com/python-virtualenvwrapper/virtualenvwrapper.git
octolytics-dimension-user_id122572748
octolytics-dimension-user_loginpython-virtualenvwrapper
octolytics-dimension-repository_id589228542
octolytics-dimension-repository_nwopython-virtualenvwrapper/virtualenvwrapper
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id589228542
octolytics-dimension-repository_network_root_nwopython-virtualenvwrapper/virtualenvwrapper
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec718a376fcf780eb22089171adb84a543f660bf7
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python-virtualenvwrapper/virtualenvwrapper/issues/98#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-virtualenvwrapper%2Fvirtualenvwrapper%2Fissues%2F98
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-virtualenvwrapper%2Fvirtualenvwrapper%2Fissues%2F98
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python-virtualenvwrapper%2Fvirtualenvwrapper
Reloadhttps://github.com/python-virtualenvwrapper/virtualenvwrapper/issues/98
Reloadhttps://github.com/python-virtualenvwrapper/virtualenvwrapper/issues/98
Reloadhttps://github.com/python-virtualenvwrapper/virtualenvwrapper/issues/98
python-virtualenvwrapper https://github.com/python-virtualenvwrapper
virtualenvwrapperhttps://github.com/python-virtualenvwrapper/virtualenvwrapper
Notifications https://github.com/login?return_to=%2Fpython-virtualenvwrapper%2Fvirtualenvwrapper
Fork 24 https://github.com/login?return_to=%2Fpython-virtualenvwrapper%2Fvirtualenvwrapper
Star 163 https://github.com/login?return_to=%2Fpython-virtualenvwrapper%2Fvirtualenvwrapper
Code https://github.com/python-virtualenvwrapper/virtualenvwrapper
Issues 10 https://github.com/python-virtualenvwrapper/virtualenvwrapper/issues
Pull requests 1 https://github.com/python-virtualenvwrapper/virtualenvwrapper/pulls
Discussions https://github.com/python-virtualenvwrapper/virtualenvwrapper/discussions
Actions https://github.com/python-virtualenvwrapper/virtualenvwrapper/actions
Projects 0 https://github.com/python-virtualenvwrapper/virtualenvwrapper/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python-virtualenvwrapper/virtualenvwrapper/security
Please reload this pagehttps://github.com/python-virtualenvwrapper/virtualenvwrapper/issues/98
Insights https://github.com/python-virtualenvwrapper/virtualenvwrapper/pulse
Code https://github.com/python-virtualenvwrapper/virtualenvwrapper
Issues https://github.com/python-virtualenvwrapper/virtualenvwrapper/issues
Pull requests https://github.com/python-virtualenvwrapper/virtualenvwrapper/pulls
Discussions https://github.com/python-virtualenvwrapper/virtualenvwrapper/discussions
Actions https://github.com/python-virtualenvwrapper/virtualenvwrapper/actions
Projects https://github.com/python-virtualenvwrapper/virtualenvwrapper/projects
Security https://github.com/python-virtualenvwrapper/virtualenvwrapper/security
Insights https://github.com/python-virtualenvwrapper/virtualenvwrapper/pulse
New issuehttps://github.com/login?return_to=https://github.com/python-virtualenvwrapper/virtualenvwrapper/issues/98
New issuehttps://github.com/login?return_to=https://github.com/python-virtualenvwrapper/virtualenvwrapper/issues/98
add2virtualenv logic breaks builds of packages with modern build backendhttps://github.com/python-virtualenvwrapper/virtualenvwrapper/issues/98#top
bugSomething isn't workinghttps://github.com/python-virtualenvwrapper/virtualenvwrapper/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/dfn-certling
https://github.com/dfn-certling
dfn-certlinghttps://github.com/dfn-certling
on Apr 17, 2024https://github.com/python-virtualenvwrapper/virtualenvwrapper/issues/98#issue-2248663828
bugSomething isn't workinghttps://github.com/python-virtualenvwrapper/virtualenvwrapper/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.