question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Install does not respect `PIP_NO_BUILD_ISOLATION`

See original GitHub issue

Description

In a new venv, I can install friendly from trunk by using --no-build-isolation. This doesn’t hold if I export PIP_NO_BUILD_ISOLATION=1; looks like pip ignores the setting passed via env var.

Expected behavior

The behaviour of PIP_NO_BUILD_ISOLATION=1 pip install git+https://<url> should be the same as of pip install --no-build-isolation git+https://<url>, if I read Environment Variables correctly.

pip version

21.1.1

Python version

3.9.4

OS

Fedora 34

How to Reproduce

$ python -m venv tst
$ source tst/bin/activate
$ pip install --upgrade pip
$ pip install pygments rich pure_eval wheel  # install deps first
$ export PIP_NO_BUILD_ISOLATION=1
$ pip install git+https://github.com/aroberge/friendly@master

Output

Collecting git+https://github.com/aroberge/friendly@master
  Cloning https://github.com/aroberge/friendly (to revision master) to ./pip-req-build-4j8mp19r
  Running command git clone -q https://github.com/aroberge/friendly /tmp/pip-req-build-4j8mp19r
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /tmp/tst/bin/python /tmp/tst/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpqe9axa75
       cwd: /tmp/pip-req-build-4j8mp19r
  Complete output (70 lines):
  Traceback (most recent call last):
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/config.py", line 33, in __getattr__
      return next(
  StopIteration
  
  The above exception was the direct cause of the following exception:
  
  Traceback (most recent call last):
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/config.py", line 387, in _parse_attr
      return getattr(StaticModule(module_name), attr_name)
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/config.py", line 41, in __getattr__
      raise AttributeError(
  AttributeError: friendly has no attribute __version__
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/tmp/tst/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
      main()
    File "/tmp/tst/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/tmp/tst/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 154, in get_requires_for_build_wheel
      return self._get_build_requires(
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 135, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 150, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 3, in <module>
      setup()
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib64/python3.9/distutils/core.py", line 121, in setup
      dist.parse_config_files()
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 742, in parse_config_files
      parse_configuration(self, self.command_options,
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/config.py", line 157, in parse_configuration
      meta.parse()
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/config.py", line 463, in parse
      section_parser_method(section_options)
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/config.py", line 436, in parse_section
      self[name] = value
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/config.py", line 220, in __setitem__
      value = parser(value)
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/config.py", line 552, in _parse_version
      version = self._parse_attr(value, self.package_dir)
    File "/tmp/pip-build-env-ilxve4yd/overlay/lib/python3.9/site-packages/setuptools/config.py", line 390, in _parse_attr
      module = importlib.import_module(module_name)
    File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
    File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 790, in exec_module
    File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
    File "/tmp/pip-req-build-4j8mp19r/friendly/__init__.py", line 38, in <module>
      from . import editors_helpers
    File "/tmp/pip-req-build-4j8mp19r/friendly/editors_helpers.py", line 18, in <module>
      from .config import session
    File "/tmp/pip-req-build-4j8mp19r/friendly/config.py", line 7, in <module>
      from . import core
    File "/tmp/pip-req-build-4j8mp19r/friendly/core.py", line 19, in <module>
      from . import info_variables
    File "/tmp/pip-req-build-4j8mp19r/friendly/info_variables.py", line 10, in <module>
      from . import utils
    File "/tmp/pip-req-build-4j8mp19r/friendly/utils.py", line 9, in <module>
      import pure_eval
  ModuleNotFoundError: No module named 'pure_eval'
  ----------------------------------------
WARNING: Discarding git+https://github.com/aroberge/friendly@master. Command errored out with exit status 1: /tmp/tst/bin/python /tmp/tst/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpqe9axa75 Check the logs for full command output.
ERROR: Command errored out with exit status 1: /tmp/tst/bin/python /tmp/tst/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpqe9axa75 Check the logs for full command output.

Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pfmoorecommented, May 11, 2021

@hoefling Apologies. I told you those “double-negative” command line options were weird. The value you need is PIP_NO_BUILD_ISOLATION=0 (note, set it to 0 not 1). The option is --no-build-isolation, so the variable is PIP_NO_BUILD_ISOLATION. But the action is store_false, so you need to set the variable to 0 to get the same effect as supplying the flag. Yes, we know this is stupid. It’s on the list of things to fix, under “use a different option parsing library” (which as you can imagine is a non-trivial job).

If you have any suggestions about how we could document this for people who hit it, a docs PR would be welcomed as a quick improvement for now.

❯ $env:PIP_NO_BUILD_ISOLATION=0
PS 09:22 (6b66ffab6edd6c) 00:00.016 C:\Work\Scratch\pypidata
❯ py -m pip install --no-build-isolation "git+https://github.com/aroberge/friendly@master"
Collecting git+https://github.com/aroberge/friendly@master
  Cloning https://github.com/aroberge/friendly (to revision master) to c:\users\uk03306\appdata\local\temp\pip-req-build-mtbrshwv
  Running command git clone -q https://github.com/aroberge/friendly 'C:\Users\UK03306\AppData\Local\Temp\pip-req-build-mtbrshwv'
    Preparing wheel metadata ... done
Collecting asttokens>=2.0.4
  Using cached asttokens-2.0.5-py2.py3-none-any.whl (20 kB)
Collecting executing>=0.5.3
  Using cached executing-0.6.0-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: pygments>=2.6 in c:\users\uk03306\.virtualenvs\6b66ffab6edd6c\lib\site-packages (from friendly==0.3.46) (2.9.0)
Requirement already satisfied: rich>=9.12 in c:\users\uk03306\.virtualenvs\6b66ffab6edd6c\lib\site-packages (from friendly==0.3.46) (10.1.0)
Requirement already satisfied: pure-eval>=0.2.1 in c:\users\uk03306\.virtualenvs\6b66ffab6edd6c\lib\site-packages (from friendly==0.3.46) (0.2.1)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in c:\users\uk03306\.virtualenvs\6b66ffab6edd6c\lib\site-packages (from rich>=9.12->friendly==0.3.46) (0.9.1)
Requirement already satisfied: typing-extensions<4.0.0,>=3.7.4 in c:\users\uk03306\.virtualenvs\6b66ffab6edd6c\lib\site-packages (from rich>=9.12->friendly==0.3.46) (3.10.0.0)
Requirement already satisfied: colorama<0.5.0,>=0.4.0 in c:\users\uk03306\.virtualenvs\6b66ffab6edd6c\lib\site-packages (from rich>=9.12->friendly==0.3.46) (0.4.4)
Building wheels for collected packages: friendly
  Building wheel for friendly (PEP 517) ... done
  Created wheel for friendly: filename=friendly-0.3.46-py3-none-any.whl size=213992 sha256=c39c27fb708a9fb7afc51da3735886e76e896ffe7c6dfa97d22bbcbd98837a1c
  Stored in directory: C:\Users\UK03306\AppData\Local\Temp\pip-ephem-wheel-cache-yy2qujxi\wheels\1b\9e\9a\37c39185ab58a858f558664960e816c71ccd2f07ba5079cc0d
Successfully built friendly
Installing collected packages: six, executing, asttokens, friendly
Successfully installed asttokens-2.0.5 executing-0.6.0 friendly-0.3.46 six-1.16.0
0reactions
hoeflingcommented, May 11, 2021

@pfmoore ah, so what I have missed is the double negation - thank you for the clarification! Indeed, PIP_NO_BUILD_ISOLATION=0 is the right env var for --no-build-isolation flag. Thank you for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

pip is completely ignoring build-system requirements when ...
in it, pip does not sort them properly such that pyramid is installed first to respect the build dependencies. Pip is completely ignoring...
Read more >
python - what does no-build-isolation do?
It means pip won't install the dependencies, so you have to install the dependencies if any by yourself first or the command will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found