Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it installable as Requirement with pip #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AdaptiveThinking
Copy link

Problem: Pip has 2 steps:
(1) Iterate over all Requirements and run setup.py
(2) install all Requirements
Problem: If you import your own package, which in turn has other Requirements, then install fails, because the Requirements are not yet met.

Problem: Pip has 2 steps:
(1) Iterate over all Requirements and *run setup.py*
(2) install all Requirements
Problem: If you import your own package, which in turn has other Requirements, then install fails, because the Requirements are not yet met.
@flavono123
Copy link
Owner

Would you attach the example codes to see expectation for this PR?
Actually, I'm not using Python now. I cannot make reproduce steps.

@rapidcow
Copy link

I will add my take on this given how I too had issues installing
with pip from source...

Version:

  • Python 3.12.3
  • pip 24.0
  • setuptools 70.0.0

pip install git+https results in an ImportError:

$ python -m venv .venv
$ source .venv/bin/activate
(.venv) $ pip install --verbose --no-cache-dir git+https://github.com/flavono123/identicon.git
Using pip 24.0 from /Users/rapidcow/pip_from_git_clone/.venv/lib/python3.12/site-packages/pip (python 3.12)
Collecting git+https://github.com/flavono123/identicon.git
  Cloning https://github.com/flavono123/identicon.git to /private/var/folders/qv/n054d4h95qd6f3zpplvm3gmw0000gn/T/pip-req-build-wtkbuyyy
  Running command git version
  git version 2.44.0
  Running command git clone --filter=blob:none https://github.com/flavono123/identicon.git /private/var/folders/qv/n054d4h95qd6f3zpplvm3gmw0000gn/T/pip-req-build-wtkbuyyy
  Cloning into '/private/var/folders/qv/n054d4h95qd6f3zpplvm3gmw0000gn/T/pip-req-build-wtkbuyyy'...
  Updating files:  20% (2/10)
  Updating files:  30% (3/10)
  Updating files:  40% (4/10)
  Updating files:  50% (5/10)
  Updating files:  60% (6/10)
  Updating files:  70% (7/10)
  Updating files:  80% (8/10)
  Updating files:  90% (9/10)
  Updating files: 100% (10/10)
  Updating files: 100% (10/10), done.
  Running command git rev-parse HEAD
  728da82deb29d107252172b285e75943668a115b
  Resolved https://github.com/flavono123/identicon.git to commit 728da82deb29d107252172b285e75943668a115b
  Running command git rev-parse HEAD
  728da82deb29d107252172b285e75943668a115b
  Running command pip subprocess to install build dependencies
  Collecting setuptools>=40.8.0
    Using cached setuptools-70.0.0-py3-none-any.whl.metadata (5.9 kB)
  Using cached setuptools-70.0.0-py3-none-any.whl (863 kB)
  Installing collected packages: setuptools
  Successfully installed setuptools-70.0.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "/Users/rapidcow/pip_from_git_clone/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/Users/rapidcow/pip_from_git_clone/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/rapidcow/pip_from_git_clone/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
             ^^^^^^^^^^^^^^^^^^^^^
    File "/private/var/folders/qv/n054d4h95qd6f3zpplvm3gmw0000gn/T/pip-build-env-h_noeysr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/private/var/folders/qv/n054d4h95qd6f3zpplvm3gmw0000gn/T/pip-build-env-h_noeysr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "/private/var/folders/qv/n054d4h95qd6f3zpplvm3gmw0000gn/T/pip-build-env-h_noeysr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 487, in run_setup
      super().run_setup(setup_script=setup_script)
    File "/private/var/folders/qv/n054d4h95qd6f3zpplvm3gmw0000gn/T/pip-build-env-h_noeysr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 4, in <module>
    File "/private/var/folders/qv/n054d4h95qd6f3zpplvm3gmw0000gn/T/pip-req-build-wtkbuyyy/Identicon/__init__.py", line 6, in <module>
      from PIL import Image, ImageDraw
  ModuleNotFoundError: No module named 'PIL'
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /Users/rapidcow/pip_from_git_clone/.venv/bin/python3.12 /Users/rapidcow/pip_from_git_clone/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py get_requires_for_build_wheel /var/folders/qv/n054d4h95qd6f3zpplvm3gmw0000gn/T/tmpbz_7ts3o
  cwd: /private/var/folders/qv/n054d4h95qd6f3zpplvm3gmw0000gn/T/pip-req-build-wtkbuyyy
  Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

The same happens with git clone then pip install ./identicon.
Pre-installing setuptools, wheel, and Pillow don't seem to
fix this error either.

I don't really have a good explanation for this other than that
pip install perhaps runs setup.py in an isolated environment?
Interestingly, installing from PyPI (i.e. pip install Identicon)
works fine because it seems to fetch the Pillow dependency first
and then run setup.py.

FWIW importing from the package to be installed that depends on
other packages is known to cause issues:

I don't like the idea of hard-coding the version as the PR
seems to do, though I guess it would be nice to read from
something that doesn't require importing the package and Pillow. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants