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

Error installing the project in editable mode #4335

Closed
zaufi opened this issue Jun 11, 2020 · 1 comment · Fixed by #4385
Closed

Error installing the project in editable mode #4335

zaufi opened this issue Jun 11, 2020 · 1 comment · Fixed by #4385
Labels
Type: Bug 🐛 This issue is a bug. Type: Vendored Dependencies This issue affects vendored dependencies within pipenv.

Comments

@zaufi
Copy link

zaufi commented Jun 11, 2020

Issue description

I've got a project w/ setup.cfg and version meta-data taken from the package's attribute:

[metadata]
name = pipenv-bug-test
version = attr: bug.__version__

[options]
packages = bug
python_requires = >=3.6
zip_safe = True

[bdist_wheel]
universal = 1

My dev-packages section of the Pipfile has the entry:

pipenv-bug-test = {editable = true, path = "."}

Trying to install dev-dependencies fails for this setup.

Expected result

Successful install.

Actual result

Please note the "filename" reported in the last line:

Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Building requirements...
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/cli/command.py", line 232, in install
    retcode = do_install(
  File "/usr/local/lib/python3.8/dist-packages/pipenv/core.py", line 2051, in do_install
    do_init(
  File "/usr/local/lib/python3.8/dist-packages/pipenv/core.py", line 1299, in do_init
    do_lock(
  File "/usr/local/lib/python3.8/dist-packages/pipenv/core.py", line 1103, in do_lock
    venv_resolve_deps(
  File "/usr/local/lib/python3.8/dist-packages/pipenv/utils.py", line 1317, in venv_resolve_deps
    deps = convert_deps_to_pip(
  File "/usr/local/lib/python3.8/dist-packages/pipenv/utils.py", line 1434, in convert_deps_to_pip
    new_dep = Requirement.from_pipfile(dep_name, dep)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 2743, in from_pipfile
    r = FileRequirement.from_pipfile(name, pipfile)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1842, in from_pipfile
    arg_dict["parsed_line"] = Line(line)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 178, in __init__
    self.parse()
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1313, in parse
    self.parse_name()
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1039, in parse_name
    name = self._parse_name_from_path()
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1007, in _parse_name_from_path
    parsed_setup_cfg = self.parsed_setup_cfg
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/cached_property.py", line 35, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 892, in parsed_setup_cfg
    return parse_setup_cfg(setup_content, base_dir)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 322, in parse_setup_cfg
    name, version = get_name_and_version_from_setupcfg(parser, package_dir)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 277, in get_name_and_version_from_setupcfg
    version = parse_special_directives(parser.get("metadata", "version"), package_dir)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 191, in parse_special_directives
    rv = ast_parse_attribute_from_file(path, attribute)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 1172, in ast_parse_attribute_from_file
    analyzer = ast_parse_file(path)
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 1193, in ast_parse_file
    tree = ast.parse(read_source(path))
  File "/usr/local/lib/python3.8/dist-packages/pipenv/vendor/requirementslib/models/utils.py", line 1024, in read_source
    with open(path, "r", encoding=encoding) as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/work/pipenv-bug-test/bug/bug'

My original case was a bit more complicated. I had a packages = find_namespace: in the options section of the setup.cfg and the reported not found "file" was:

/work/pipenv-bug-test/find_namespace:/bug

And yes, setting the version key to exact value (same as in bug/__init__.py) works fine.

Steps to replicate

  1. unpack the attached sample project pipenv-bug-test.zip
  2. try pipenv install --dev

$ pipenv --support

Pipenv version: '2020.6.2'

Pipenv location: '/usr/local/lib/python3.8/dist-packages/pipenv'

Python location: '/usr/bin/python3'

Python installations found:

  • 3.8.2: /usr/bin/python3
  • 3.8.2: /usr/bin/python3.8
  • 3.8.2: /bin/python3
  • 3.8.2: /bin/python3.8

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.8.2',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.16.18-gentoo-z3',
 'platform_system': 'Linux',
 'platform_version': '#5 SMP PREEMPT Sat Apr 6 19:26:28 +08 2019',
 'python_full_version': '3.8.2',
 'python_version': '3.8',
 'sys_platform': 'linux'}

System environment variables:

  • PIPENV_VENV_IN_PROJECT
  • COLORTERM
  • HOSTNAME
  • LANGUAGE
  • PWD
  • w
  • HOME
  • LANG
  • LS_COLORS
  • TERM
  • PIP_DISABLE_PIP_VERSION_CHECK
  • SHLVL
  • LC_ALL
  • PATH
  • DEBIAN_FRONTEND
  • OLDPWD
  • _
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

  • PIPENV_VENV_IN_PROJECT: 1

Debug–specific environment variables:

  • PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  • LANG: en_US.UTF-8
  • PWD: /work/pipenv-bug-test

Contents of Pipfile ('/work/pipenv-bug-test/Pipfile'):

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[dev-packages]
pipenv-bug-test = {editable = true, path = "."}

[packages]
@frostming frostming added Type: Bug 🐛 This issue is a bug. Type: Vendored Dependencies This issue affects vendored dependencies within pipenv. labels Jun 12, 2020
@Darrenmeehan
Copy link

Darrenmeehan commented Jun 12, 2020

This seems similar to this issue where I've commented some findings. #4326 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 This issue is a bug. Type: Vendored Dependencies This issue affects vendored dependencies within pipenv.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants