django-unicorn icon indicating copy to clipboard operation
django-unicorn copied to clipboard

unicorn not installable via "pip install -e"

Open nerdoc opened this issue 2 years ago • 1 comments

I followed the instructions in DEVELOPING.md to setup a dev environment, and tried to install this unicorn package using pip install -e in one of my projects. Did not work, and I can't figure out where the problem is.

pip install -e ../django-unicorn
Obtaining file:///home/christian/Projekte/django-unicorn
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
ERROR: Exception:
Traceback (most recent call last):
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 339, in run
    requirement_set = resolver.resolve(
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 75, in resolve
    collected = self.factory.collect_root_requirements(root_reqs)
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 506, in collect_root_requirements
    req = self._make_requirement_from_install_req(
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 468, in _make_requirement_from_install_req
    cand = self._make_candidate_from_link(
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 188, in _make_candidate_from_link
    self._editable_candidate_cache[link] = EditableCandidate(
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 313, in __init__
    super().__init__(
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 158, in __init__
    self.dist = self._prepare()
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 227, in _prepare
    dist = self._prepare_distribution()
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 323, in _prepare_distribution
    return self._factory.preparer.prepare_editable_requirement(self._ireq)
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/operations/prepare.py", line 609, in prepare_editable_requirement
    dist = _get_prepared_distribution(
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/operations/prepare.py", line 58, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/distributions/sdist.py", line 43, in prepare_distribution_metadata
    self.req.isolated_editable_sanity_check()
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/req/req_install.py", line 488, in isolated_editable_sanity_check
    and not self.supports_pyproject_editable()
  File "/.../.venv/lib/python3.10/site-packages/pip/_internal/req/req_install.py", line 229, in supports_pyproject_editable
    return "build_editable" in self.pep517_backend._supported_features()
  File "/.../.venv/lib/python3.10/site-packages/pip/_vendor/pep517/wrappers.py", line 159, in _supported_features
    return self._call_hook('_supported_features', {})
  File "/.../.venv/lib/python3.10/site-packages/pip/_vendor/pep517/wrappers.py", line 332, in _call_hook
    raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pep517.wrappers.BackendUnavailable: Traceback (most recent call last):
  File "/.../.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 89, in _build_backend
    obj = import_module(mod_path)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  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 "/tmp/pip-build-env-_pn7l5bo/overlay/lib/python3.10/site-packages/poetry/masonry/api.py", line 1, in <module>
    from poetry.core.masonry.api import build_sdist
  File "/tmp/pip-build-env-_pn7l5bo/overlay/lib/python3.10/site-packages/poetry/core/masonry/__init__.py", line 10, in <module>
    from .builder import Builder
  File "/tmp/pip-build-env-_pn7l5bo/overlay/lib/python3.10/site-packages/poetry/core/masonry/builder.py", line 7, in <module>
    from .builders.sdist import SdistBuilder
  File "/tmp/pip-build-env-_pn7l5bo/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/__init__.py", line 2, in <module>
    from .wheel import WheelBuilder
  File "/tmp/pip-build-env-_pn7l5bo/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 23, in <module>
    from packaging.tags import sys_tags
  File "/tmp/pip-build-env-_pn7l5bo/overlay/lib/python3.10/site-packages/poetry/core/_vendor/packaging/tags.py", line 7, in <module>
    import distutils.util
  File "/.../.venv/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 92, in create_module
    return importlib.import_module('setuptools._distutils')
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'setuptools'

This is weird, because:

pip freeze --all|grep setuptools
setuptools==60.5.0

Is there something else mising? The pytest suite runs well in the django-unicorn directory.

nerdoc avatar Mar 12 '22 20:03 nerdoc

Aaaah, after days of searching, I finally wrote an issue. Just to find the possible solution 5 minutes afterwords myself. I used another Python version (3.6 instead of my default 3.10), and got another error:

pip install -e ../django-unicorn
[...snip...]
ERROR: Could not find a version that satisfies the requirement setuptools<61.0.0,>=60.9.3 (from django-unicorn) (from versions: [...]

So I upgrded setuptools: pip install -U setuptools==60.9.3, and reran everything again. Different error, but still no install. Even when I install django-unicorn in itself: go to your local django-unicorn directory, and run

pip install -e .

And you get an error:

pip install -e .
Obtaining file:///home/christian/Projekte/django-unicorn
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: setuptools<61.0.0,>=60.9.3 in ./.venv/lib/python3.10/site-packages (from django-unicorn==0.42.0) (60.9.3)
[...]
Installing collected packages: django-unicorn
  Attempting uninstall: django-unicorn
    Found existing installation: django-unicorn 0.42.0
    Uninstalling django-unicorn-0.42.0:
      Successfully uninstalled django-unicorn-0.42.0
  Running setup.py develop for django-unicorn
    error: subprocess-exited-with-error
    
    × python setup.py develop did not run successfully.
    │ exit code: 1
    ╰─> [1 lines of output]
        ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
  WARNING: No metadata found in ./.venv/lib/python3.10/site-packages
  Rolling back uninstall of django-unicorn
  Moving to /home/christian/Projekte/django-unicorn/.venv/lib/python3.10/site-packages/django_unicorn-0.42.0.dist-info/
   from /home/christian/Projekte/django-unicorn/.venv/lib/python3.10/site-packages/~jango_unicorn-0.42.0.dist-info
  Moving to /home/christian/Projekte/django-unicorn/.venv/lib/python3.10/site-packages/django_unicorn.pth
   from /tmp/pip-uninstall-q8cv6zvl/django_unicorn.pth
error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
    ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
    [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
(.venv) [christian@aragorn django-unicorn]$ pip install -U setuptools==60.9.3
Requirement already satisfied: setuptools==60.9.3 in ./.venv/lib/python3.10/site-packages (60.9.3)

So no success yet. Any hints?

nerdoc avatar Mar 12 '22 21:03 nerdoc

I don't have much to go on with this error message, but it seems to work for me in Python 3.9:

image

You could try installing with --verbose and maybe get some additional info? I'm going to close this issue for now because I can't replicate. Feel free to re-open if you have more details.

adamghill avatar Dec 26 '23 22:12 adamghill