pytorch / pytorch/vision

No longer able to build from source with `pip install -v .`

Open
#4,542 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

🐛 Describe the bug

After PR https://github.com/pytorch/vision/pull/4384, I'm no longer able to build torchvision with

pip install -v .

, though

python setup.py develop

still works.

Is this the intended behavior now?

The pip install -v . now reports error message

xxx@yyy:/opt/pytorch/vision# pip install -v .
Using pip 21.2.2 from /opt/conda/lib/python3.8/site-packages/pip (python 3.8)
Processing /opt/pytorch/vision
  DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
   pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.
  Running command /opt/conda/bin/python /tmp/pip-standalone-pip-qzzditq9/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-klifg95l/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
  Collecting setuptools>=40.8.0
    Using cached setuptools-58.2.0-py3-none-any.whl (946 kB)
  Collecting wheel
    Using cached wheel-0.37.0-py2.py3-none-any.whl (35 kB)
  Installing collected packages: wheel, setuptools
  Successfully installed setuptools-58.2.0 wheel-0.37.0
  WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
  Installing build dependencies ... done
  Running command /opt/conda/bin/python /opt/conda/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmptw3tr8z6
  Traceback (most recent call last):
    File "/opt/conda/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 349, in <module>
      main()
    File "/opt/conda/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 331, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/opt/conda/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 117, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-klifg95l/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 154, in get_requires_for_build_wheel
      return self._get_build_requires(
    File "/tmp/pip-build-env-klifg95l/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 135, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-klifg95l/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 258, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/tmp/pip-build-env-klifg95l/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 150, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 12, in <module>
      import torch
  ModuleNotFoundError: No module named 'torch'
  Getting requirements to build wheel ... error
WARNING: Discarding file:///opt/pytorch/vision. Command errored out with exit status 1: /opt/conda/bin/python /opt/conda/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmptw3tr8z6 Check the logs for full command output.
ERROR: Command errored out with exit status 1: /opt/conda/bin/python /opt/conda/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmptw3tr8z6 Check the logs for full command output.
Versions

I'm using the latest pytorch version 1.11.0a0+git458a00b https://github.com/pytorch/pytorch/commit/458a00bacb68998a75a87af153e6ae3690698bc2,

OS: Ubuntu 20.04.3 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: Could not collect
CMake version: version 3.19.6
Libc version: glibc-2.31

Python version: 3.8.11 (default, Aug  3 2021, 15:09:35)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-4.15.0-123-generic-x86_64-with-glibc2.17
Is CUDA available: True

cc @ptrblck @pmeier @NicolasHug

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with pip install -v . and compare it with python setup.py develop. Start in setup.py, especially the top-level import torch, and review the build changes from PR 4384. Done means the source installation path no longer fails with ModuleNotFoundError: No module named 'torch', while the existing development install remains functional.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.