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

Pipenv unable to install relative path that is a subdirectory of a Pipfile #4900

Closed
PythonCoderAS opened this issue Dec 24, 2021 · 18 comments
Closed
Assignees

Comments

@PythonCoderAS
Copy link

PythonCoderAS commented Dec 24, 2021

Issue description

Pipenv will fail to install a relative path that is a subdirectory of a directory with a Pipfile.

Expected result

Installation to succeed.

Actual result

A resolution error is returned.

$ pipenv install .
Installing ....
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 98, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py", line 1654, in parseString
    raise exc
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py", line 3739, in parseImpl
    return self.expr._parse( instring, loc, doActions, callPreParse=False )
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400, in parseImpl
    loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py", line 2711, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pkg_resources._vendor.pyparsing.ParseException: Expected W:(abcd...) (at char 0), (line:1, col:1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 966, in _parse_name_from_line
    self._requirement = init_requirement(self.line)
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/requirementslib/models/utils.py", line 200, in init_requirement
    req = Requirement.parse(name)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3139, in parse
    req, = parse_requirements(s)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3084, in parse_requirements
    yield Requirement(line)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3094, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 100, in __init__
    raise InvalidRequirement(
pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'.'": Expected W:(abcd...)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-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/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pipenv/cli/command.py", line 233, in install
    retcode = do_install(
  File "/usr/local/lib/python3.8/site-packages/pipenv/core.py", line 2100, in do_install
    pkg_requirement = Requirement.from_line(pkg_line)
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 2676, in from_line
    parsed_line = Line(line)
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 171, in __init__
    self.parse()
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1304, in parse
    self.parse_name()
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1027, in parse_name
    name = self._parse_name_from_line()
  File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 968, in _parse_name_from_line
    raise RequirementError(
pipenv.vendor.requirementslib.exceptions.RequirementError: Failed parsing requirement from '.'

Steps to replicate

  1. Make an empty directory
  2. Cd to empty directory
  3. Run pipenv install
  4. Clone a python package into the directory. Example can include git clone https://github.com/sphinx-doc/sphinx.git
  5. Cd to subdirectory
  6. Run pipenv install . or pipenv install -e .

$ pipenv --support

Pipenv version: '2021.5.29'

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

Python location: '/usr/local/opt/[email protected]/bin/python3.8'

Python installations found:

  • 3.9.9: /usr/local/bin/python3
  • 3.9.9: /usr/local/bin/python3.9
  • 3.8.2: /usr/bin/python3
  • 2.7.16: /usr/bin/python2
  • 2.7.16: /usr/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.8.12',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '20.5.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 20.5.0: Sat May  8 05:10:33 PDT '
                     '2021; root:xnu-7195.121.3~9/RELEASE_X86_64',
 'python_full_version': '3.8.12',
 'python_version': '3.8',
 'sys_platform': 'darwin'}

System environment variables:

  • TERM_SESSION_ID
  • SSH_AUTH_SOCK
  • LC_TERMINAL_VERSION
  • COLORFGBG
  • ITERM_PROFILE
  • XPC_FLAGS
  • LANG
  • PWD
  • SHELL
  • __CFBundleIdentifier
  • TERM_PROGRAM_VERSION
  • TERM_PROGRAM
  • PATH
  • DISPLAY
  • LC_TERMINAL
  • COLORTERM
  • COMMAND_MODE
  • TERM
  • HOME
  • TMPDIR
  • USER
  • XPC_SERVICE_NAME
  • LOGNAME
  • ITERM_SESSION_ID
  • __CF_USER_TEXT_ENCODING
  • SHLVL
  • OLDPWD
  • P9K_TTY
  • VIRTUAL_ENV_DISABLE_PROMPT
  • PIPENV_VERBOSITY
  • LDFLAGS
  • CPPFLAGS
  • EDITOR
  • ZSH
  • PAGER
  • LESS
  • LSCOLORS
  • P9K_SSH
  • MANPATH
  • _
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

  • PIPENV_VERBOSITY: -1

Debug–specific environment variables:

  • PATH: /usr/local/opt/ruby/bin:/usr/local/sbin:Users/aoyansarkar/.cargo/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Applications/Little Snitch.app/Contents/Components:/opt/X11/bin:/Library/Apple/usr/bin:/Users/aoyansarkar/.oh-my-zsh/custom/plugins/git-extra-commands/bin:/usr/local/opt/fzf/bin
  • SHELL: /bin/zsh
  • EDITOR: vim
  • LANG: en_US.UTF-8
  • PWD: /Volumes/RAMDisk/praw

Contents of Pipfile ('/Volumes/RAMDisk/Pipfile'):

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

[packages]

[dev-packages]

[requires]
python_version = "3.9"

Contents of Pipfile.lock ('/Volumes/RAMDisk/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "a36a5392bb1e8bbc06bfaa0761e52593cf2d83b486696bf54667ba8da616c839"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.9"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {},
    "develop": {}
}
@PythonCoderAS
Copy link
Author

This could be a possible duplicate of #4895 but with a slightly different setup

@matteius
Copy link
Member

@PythonCoderAS I noticed you are trying with an older version of pipenv, could you check again with pipenv==2021.11.23?

@PythonCoderAS
Copy link
Author

@PythonCoderAS I noticed you are trying with an older version of pipenv, could you check again with pipenv==2021.11.23?

Nope still doesn't work

@matteius
Copy link
Member

@PythonCoderAS It worked just fine for me ... what is the difference here?

mdavis@matt-VirtualBox:~/pipenv-4900$ pipenv --version

pipenv, version 2021.11.23

mdavis@matt-VirtualBox:~/pipenv-4900$ pipenv install

Creating a virtualenv for this project...

Pipfile: /home/mdavis/pipenv-4900/Pipfile

Using /usr/bin/python3 (3.9.7) to create virtualenv...

⠸ Creating virtual environment...created virtual environment CPython3.9.7.final.0-64 in 155ms

  creator CPython3Posix(dest=/home/mdavis/.virtualenvs/pipenv-4900-aJORiEDR, clear=False, no_vcs_ignore=False, global=False)

  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/mdavis/.local/share/virtualenv)

    added seed packages: pip==21.3.1, setuptools==59.2.0, wheel==0.37.0

  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator



✔ Successfully created virtual environment! 

Virtualenv location: /home/mdavis/.virtualenvs/pipenv-4900-aJORiEDR

Creating a Pipfile for this project...

Pipfile.lock not found, creating...

Locking [dev-packages] dependencies...

Locking [packages] dependencies...

Updated Pipfile.lock (16c839)!

Installing dependencies from Pipfile.lock (16c839)...

  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00

To activate this project's virtualenv, run pipenv shell.

Alternatively, run a command inside the virtualenv with pipenv run.

mdavis@matt-VirtualBox:~/pipenv-4900$ git clone pipenv install^C

mdavis@matt-VirtualBox:~/pipenv-4900$ git clone ^C

mdavis@matt-VirtualBox:~/pipenv-4900$ git clone https://github.com/sphinx-doc/sphinx.git

Cloning into 'sphinx'...

remote: Enumerating objects: 134692, done.

remote: Counting objects: 100% (373/373), done.

remote: Compressing objects: 100% (186/186), done.

remote: Total 134692 (delta 182), reused 318 (delta 154), pack-reused 134319

Receiving objects: 100% (134692/134692), 68.28 MiB | 13.04 MiB/s, done.

Resolving deltas: 100% (100376/100376), done.

mdavis@matt-VirtualBox:~/pipenv-4900$ ls

Pipfile  Pipfile.lock  sphinx

mdavis@matt-VirtualBox:~/pipenv-4900$ pipenv install -e sphinx/

Installing -e sphinx/...

Adding Sphinx to Pipfile's [packages]...

✔ Installation Succeeded 

Pipfile.lock (16c839) out of date, updating to (972ca1)...

Locking [dev-packages] dependencies...

Locking [packages] dependencies...

Building requirements...

⠇ Locking...Resolving dependencies...

✔ Success! 

Updated Pipfile.lock (972ca1)!

Installing dependencies from Pipfile.lock (972ca1)...

  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:00

To activate this project's virtualenv, run pipenv shell.

Alternatively, run a command inside the virtualenv with pipenv run.

mdavis@matt-VirtualBox:~/pipenv-4900$ pipenv --version

pipenv, version 2021.11.23

mdavis@matt-VirtualBox:~/pipenv-4900$ cat Pipfile

[[source]]

url = "https://pypi.org/simple"

verify_ssl = true

name = "pypi"



[packages]

sphinx = {editable = true, path = "./sphinx"}



[dev-packages]



[requires]

python_version = "3.9"

mdavis@matt-VirtualBox:~/pipenv-4900$ cat Pipfile.lock 

{

    "_meta": {

        "hash": {

            "sha256": "cb5a7e7e935780beda7ef0b375e578d3229328ed8e8ad43b84fac759e0972ca1"

        },

        "pipfile-spec": 6,

        "requires": {

            "python_version": "3.9"

        },

        "sources": [

            {

                "name": "pypi",

                "url": "https://pypi.org/simple",

                "verify_ssl": true

            }

        ]

    },

    "default": {

        "alabaster": {

            "hashes": [

                "sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359",

                "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02"

            ],

            "version": "==0.7.12"

        },

        "babel": {

            "hashes": [

                "sha256:ab49e12b91d937cd11f0b67cb259a57ab4ad2b59ac7a3b41d6c06c0ac5b0def9",

                "sha256:bc0c176f9f6a994582230df350aa6e05ba2ebe4b3ac317eab29d9be5d2768da0"

            ],

            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",

            "version": "==2.9.1"

        },

        "certifi": {

            "hashes": [

                "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872",

                "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"

            ],

            "version": "==2021.10.8"

        },

        "charset-normalizer": {

            "hashes": [

                "sha256:1eecaa09422db5be9e29d7fc65664e6c33bd06f9ced7838578ba40d58bdf3721",

                "sha256:b0b883e8e874edfdece9c28f314e3dd5badf067342e42fb162203335ae61aa2c"

            ],

            "markers": "python_version >= '3'",

            "version": "==2.0.9"

        },

        "docutils": {

            "hashes": [

                "sha256:686577d2e4c32380bb50cbb22f575ed742d58168cee37e99117a854bcd88f125",

                "sha256:cf316c8370a737a022b72b56874f6602acf974a37a9fba42ec2876387549fc61"

            ],

            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",

            "version": "==0.17.1"

        },

        "idna": {

            "hashes": [

                "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",

                "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"

            ],

            "markers": "python_version >= '3'",

            "version": "==3.3"

        },

        "imagesize": {

            "hashes": [

                "sha256:1db2f82529e53c3e929e8926a1fa9235aa82d0bd0c580359c67ec31b2fddaa8c",

                "sha256:cd1750d452385ca327479d45b64d9c7729ecf0b3969a58148298c77092261f9d"

            ],

            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",

            "version": "==1.3.0"

        },

        "jinja2": {

            "hashes": [

                "sha256:077ce6014f7b40d03b47d1f1ca4b0fc8328a692bd284016f806ed0eaca390ad8",

                "sha256:611bb273cd68f3b993fabdc4064fc858c5b47a973cb5aa7999ec1ba405c87cd7"

            ],

            "markers": "python_version >= '3.6'",

            "version": "==3.0.3"

        },

        "markupsafe": {

            "hashes": [

                "sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298",

                "sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64",

                "sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b",

                "sha256:04635854b943835a6ea959e948d19dcd311762c5c0c6e1f0e16ee57022669194",

                "sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567",

                "sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff",

                "sha256:0d4b31cc67ab36e3392bbf3862cfbadac3db12bdd8b02a2731f509ed5b829724",

                "sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74",

                "sha256:168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646",

                "sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35",

                "sha256:1f2ade76b9903f39aa442b4aadd2177decb66525062db244b35d71d0ee8599b6",

                "sha256:20dca64a3ef2d6e4d5d615a3fd418ad3bde77a47ec8a23d984a12b5b4c74491a",

                "sha256:2a7d351cbd8cfeb19ca00de495e224dea7e7d919659c2841bbb7f420ad03e2d6",

                "sha256:2d7d807855b419fc2ed3e631034685db6079889a1f01d5d9dac950f764da3dad",

                "sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26",

                "sha256:36bc903cbb393720fad60fc28c10de6acf10dc6cc883f3e24ee4012371399a38",

                "sha256:37205cac2a79194e3750b0af2a5720d95f786a55ce7df90c3af697bfa100eaac",

                "sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7",

                "sha256:3dd007d54ee88b46be476e293f48c85048603f5f516008bee124ddd891398ed6",

                "sha256:4296f2b1ce8c86a6aea78613c34bb1a672ea0e3de9c6ba08a960efe0b0a09047",

                "sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75",

                "sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f",

                "sha256:4dc8f9fb58f7364b63fd9f85013b780ef83c11857ae79f2feda41e270468dd9b",

                "sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135",

                "sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8",

                "sha256:5855f8438a7d1d458206a2466bf82b0f104a3724bf96a1c781ab731e4201731a",

                "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a",

                "sha256:5b6d930f030f8ed98e3e6c98ffa0652bdb82601e7a016ec2ab5d7ff23baa78d1",

                "sha256:5bb28c636d87e840583ee3adeb78172efc47c8b26127267f54a9c0ec251d41a9",

                "sha256:60bf42e36abfaf9aff1f50f52644b336d4f0a3fd6d8a60ca0d054ac9f713a864",

                "sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914",

                "sha256:6300b8454aa6930a24b9618fbb54b5a68135092bc666f7b06901f897fa5c2fee",

                "sha256:63f3268ba69ace99cab4e3e3b5840b03340efed0948ab8f78d2fd87ee5442a4f",

                "sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18",

                "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8",

                "sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2",

                "sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d",

                "sha256:6fcf051089389abe060c9cd7caa212c707e58153afa2c649f00346ce6d260f1b",

                "sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b",

                "sha256:89c687013cb1cd489a0f0ac24febe8c7a666e6e221b783e53ac50ebf68e45d86",

                "sha256:8d206346619592c6200148b01a2142798c989edcb9c896f9ac9722a99d4e77e6",

                "sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f",

                "sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb",

                "sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833",

                "sha256:99df47edb6bda1249d3e80fdabb1dab8c08ef3975f69aed437cb69d0a5de1e28",

                "sha256:9f02365d4e99430a12647f09b6cc8bab61a6564363f313126f775eb4f6ef798e",

                "sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415",

                "sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902",

                "sha256:aca6377c0cb8a8253e493c6b451565ac77e98c2951c45f913e0b52facdcff83f",

                "sha256:add36cb2dbb8b736611303cd3bfcee00afd96471b09cda130da3581cbdc56a6d",

                "sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9",

                "sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d",

                "sha256:baa1a4e8f868845af802979fcdbf0bb11f94f1cb7ced4c4b8a351bb60d108145",

                "sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066",

                "sha256:bf5d821ffabf0ef3533c39c518f3357b171a1651c1ff6827325e4489b0e46c3c",

                "sha256:c47adbc92fc1bb2b3274c4b3a43ae0e4573d9fbff4f54cd484555edbf030baf1",

                "sha256:cdfba22ea2f0029c9261a4bd07e830a8da012291fbe44dc794e488b6c9bb353a",

                "sha256:d6c7ebd4e944c85e2c3421e612a7057a2f48d478d79e61800d81468a8d842207",

                "sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f",

                "sha256:d8446c54dc28c01e5a2dbac5a25f071f6653e6e40f3a8818e8b45d790fe6ef53",

                "sha256:deb993cacb280823246a026e3b2d81c493c53de6acfd5e6bfe31ab3402bb37dd",

                "sha256:e0f138900af21926a02425cf736db95be9f4af72ba1bb21453432a07f6082134",

                "sha256:e9936f0b261d4df76ad22f8fee3ae83b60d7c3e871292cd42f40b81b70afae85",

                "sha256:f0567c4dc99f264f49fe27da5f735f414c4e7e7dd850cfd8e69f0862d7c74ea9",

                "sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5",

                "sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94",

                "sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509",

                "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51",

                "sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872"

            ],

            "markers": "python_version >= '3.6'",

            "version": "==2.0.1"

        },

        "packaging": {

            "hashes": [

                "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb",

                "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"

            ],

            "markers": "python_version >= '3.6'",

            "version": "==21.3"

        },

        "pygments": {

            "hashes": [

                "sha256:b8e67fe6af78f492b3c4b3e2970c0624cbf08beb1e493b2c99b9fa1b67a20380",

                "sha256:f398865f7eb6874156579fdf36bc840a03cab64d1cde9e93d68f46a425ec52c6"

            ],

            "markers": "python_version >= '3.5'",

            "version": "==2.10.0"

        },

        "pyparsing": {

            "hashes": [

                "sha256:04ff808a5b90911829c55c4e26f75fa5ca8a2f5f36aa3a51f68e27033341d3e4",

                "sha256:d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81"

            ],

            "markers": "python_version >= '3.6'",

            "version": "==3.0.6"

        },

        "pytz": {

            "hashes": [

                "sha256:3672058bc3453457b622aab7a1c3bfd5ab0bdae451512f6cf25f64ed37f5b87c",

                "sha256:acad2d8b20a1af07d4e4c9d2e9285c5ed9104354062f275f3fcd88dcef4f1326"

            ],

            "version": "==2021.3"

        },

        "requests": {

            "hashes": [

                "sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24",

                "sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7"

            ],

            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'",

            "version": "==2.26.0"

        },

        "setuptools": {

            "hashes": [

                "sha256:a4377723c53721515f72a3dfc1bfacdcd61edfa19a4cccf82e72e4f50d9cecbd",

                "sha256:ad0ea3d172404abb14d8f7bd7f54f2ccd4ed9dd00c9da0b1398862e69eb22c03"

            ],

            "markers": "python_version >= '3.7'",

            "version": "==60.1.0"

        },

        "snowballstemmer": {

            "hashes": [

                "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1",

                "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"

            ],

            "version": "==2.2.0"

        },

        "sphinx": {

            "editable": true,

            "path": "./sphinx"

        },

        "sphinxcontrib-applehelp": {

            "hashes": [

                "sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a",

                "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"

            ],

            "markers": "python_version >= '3.5'",

            "version": "==1.0.2"

        },

        "sphinxcontrib-devhelp": {

            "hashes": [

                "sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e",

                "sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4"

            ],

            "markers": "python_version >= '3.5'",

            "version": "==1.0.2"

        },

        "sphinxcontrib-htmlhelp": {

            "hashes": [

                "sha256:d412243dfb797ae3ec2b59eca0e52dac12e75a241bf0e4eb861e450d06c6ed07",

                "sha256:f5f8bb2d0d629f398bf47d0d69c07bc13b65f75a81ad9e2f71a63d4b7a2f6db2"

            ],

            "markers": "python_version >= '3.6'",

            "version": "==2.0.0"

        },

        "sphinxcontrib-jsmath": {

            "hashes": [

                "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178",

                "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"

            ],

            "markers": "python_version >= '3.5'",

            "version": "==1.0.1"

        },

        "sphinxcontrib-qthelp": {

            "hashes": [

                "sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72",

                "sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6"

            ],

            "markers": "python_version >= '3.5'",

            "version": "==1.0.3"

        },

        "sphinxcontrib-serializinghtml": {

            "hashes": [

                "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd",

                "sha256:aa5f6de5dfdf809ef505c4895e51ef5c9eac17d0f287933eb49ec495280b6952"

            ],

            "markers": "python_version >= '3.5'",

            "version": "==1.1.5"

        },

        "urllib3": {

            "hashes": [

                "sha256:4987c65554f7a2dbf30c18fd48778ef124af6fab771a377103da0585e2336ece",

                "sha256:c4fdf4019605b6e5423637e01bc9fe4daef873709a7973e195ceba0a62bbc844"

            ],

            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",

            "version": "==1.26.7"

        }

    },

    "develop": {}

}

@matteius matteius self-assigned this Dec 24, 2021
@PythonCoderAS
Copy link
Author

@matteius the thing is that you specified a path from the root directory. You have to change the working directory to the subdirectory and then use a relative path from said subdirectory.

@frostming
Copy link
Contributor

frostming commented Dec 24, 2021

This is because this

os.chdir(self.project_directory)

You may argue that is not reasonable to cd to the project root. But that line has been there for 4 years and there is likely someone relying on this behavior, who knows.

@PythonCoderAS
Copy link
Author

Maybe a fallback can be tried where if resolution fails on the root directory it cds to the initial working directory and tries again,

@frostming
Copy link
Contributor

The resolution goes too deep from the project initialization, and it is run in a subprocess. I think it is much easier to change your workflow to using a path relative to the project root, like what @matteius does.

@matteius
Copy link
Member

I don't really understand the use case of changing to the directory to issue the pipenv command, because the virtualenv is based off the working directory and that is also where its going to look for the Pipfile and Pipfile.lock, right? I mean it seems odd to not reference from the root project into the relative path of the editable thing you wish to install.

I also might not quite understand how the line @frostming linked to is related to this behavior, because the actual error when I try it as @PythonCoderAS does, is that it cannot parse the requirements, unless you are saying it changed directories to the root because it detected the Pipfile was a directory higher, in which case there was no setup.py there. I tried to copy the Pipfile and Pipfile.lock into the sphynx directory and ran the command the way @PythonCoderAS but it still failed though (not sure why).

@frostming
Copy link
Contributor

@matteius Yes, the root directory doesn't contain a setup.py and is thus not recognized as a valid local requirement. The requirement parsing is performed after changing root to the project root so it fails.

@PythonCoderAS
Copy link
Author

@matteius Yes, the root directory doesn't contain a setup.py and is thus not recognized as a valid local requirement. The requirement parsing is performed after changing root to the project root so it fails.

This is correct. I ran into this bug solely by mistake because I had accidentally created a Pipfile in a parent directory which contained my projects.

@matteius
Copy link
Member

matteius commented Dec 24, 2021

@frostming That makes sense, thanks. I was getting tripped up because I moved my generated Pipfile and Pipfile.lock down a directory into the sphinx and tried running pipenv install -e . and was getting this error: pipenv.vendor.requirementslib.exceptions.RequirementError: Failed parsing requirement from './sphinx' because it was looking in the ./sphinx directory from where I first generated the lock file. Even though it output like it was going to update the lock file, it failed to do so because the Pipfile reference had not changed. I don't think this is a real bug, but putting it here for reference.

mdavis@matt-VirtualBox:~/pipenv-4900/sphinx$ pipenv install -e .

Creating a virtualenv for this project...

Pipfile: /home/mdavis/pipenv-4900/sphinx/Pipfile

Using /usr/bin/python3.9 (3.9.7) to create virtualenv...

⠦ Creating virtual environment...created virtual environment CPython3.9.7.final.0-64 in 284ms

  creator CPython3Posix(dest=/home/mdavis/.virtualenvs/sphinx-GPrHrFoI, clear=False, no_vcs_ignore=False, global=False)

  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/mdavis/.local/share/virtualenv)

    added seed packages: pip==21.3.1, setuptools==59.2.0, wheel==0.37.0

  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator



✔ Successfully created virtual environment! 

Virtualenv location: /home/mdavis/.virtualenvs/sphinx-GPrHrFoI

Installing -e ....

Adding Sphinx to Pipfile's [packages]...

✔ Installation Succeeded 

Pipfile.lock (972ca1) out of date, updating to (03e436)...

Locking [dev-packages] dependencies...

Locking [packages] dependencies...

Building requirements...

Resolving dependencies...

✘ Locking Failed! 

Traceback (most recent call last):

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 102, in __init__

    req = REQUIREMENT.parseString(requirement_string)

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 1654, in parseString

    raise exc

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString

    loc, tokens = self._parse( instring, 0 )

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache

    loc,tokens = self.parseImpl( instring, preloc, doActions )

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl

    loc, exprtokens = e._parse( instring, loc, doActions )

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache

    loc,tokens = self.parseImpl( instring, preloc, doActions )

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 3739, in parseImpl

    return self.expr._parse( instring, loc, doActions, callPreParse=False )

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache

    loc,tokens = self.parseImpl( instring, preloc, doActions )

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400, in parseImpl

    loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache

    loc,tokens = self.parseImpl( instring, preloc, doActions )

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 2711, in parseImpl

    raise ParseException(instring, loc, self.errmsg, self)

pkg_resources._vendor.pyparsing.ParseException: Expected W:(abcd...) (at char 0), (line:1, col:1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 966, in _parse_name_from_line

    self._requirement = init_requirement(self.line)

  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/utils.py", line 197, in init_requirement

    req = Requirement.parse(name)

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3153, in parse

    req, = parse_requirements(s)

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3098, in parse_requirements

    yield Requirement(line)

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3108, in __init__

    super(Requirement, self).__init__(requirement_string)

  File "/home/mdavis/.virtualenvs/sphinx-GPrHrFoI/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 104, in __init__

    raise InvalidRequirement(

pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'./sphinx'": Expected W:(abcd...)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/dist-packages/pipenv/resolver.py", line 766, in <module>

    main()

  File "/usr/local/lib/python3.9/dist-packages/pipenv/resolver.py", line 760, in main

    _main(parsed.pre, parsed.clear, parsed.verbose, parsed.system, parsed.write,

  File "/usr/local/lib/python3.9/dist-packages/pipenv/resolver.py", line 743, in _main

    resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)

  File "/usr/local/lib/python3.9/dist-packages/pipenv/resolver.py", line 716, in resolve_packages

    results = clean_results(results, resolver, project, dev)

  File "/usr/local/lib/python3.9/dist-packages/pipenv/resolver.py", line 599, in clean_results

    entry_dict = translate_markers(entry.get_cleaned_dict(keep_outdated=False))

  File "/usr/local/lib/python3.9/dist-packages/pipenv/resolver.py", line 244, in get_cleaned_dict

    if self.entry.extras != self.lockfile_entry.extras:

  File "/usr/local/lib/python3.9/dist-packages/pipenv/resolver.py", line 584, in __getattribute__

    return super().__getattribute__(key)

  File "/usr/local/lib/python3.9/dist-packages/pipenv/resolver.py", line 267, in lockfile_entry

    self._lockfile_entry = self.make_requirement(self.name, self.lockfile_dict)

  File "/usr/local/lib/python3.9/dist-packages/pipenv/resolver.py", line 142, in make_requirement

    return Requirement.from_pipfile(name, entry)

  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 2745, in from_pipfile

    r = FileRequirement.from_pipfile(name, pipfile)

  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1841, in from_pipfile

    arg_dict["parsed_line"] = Line(line)

  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 171, in __init__

    self.parse()

  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1304, in parse

    self.parse_name()

  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1027, in parse_name

    name = self._parse_name_from_line()

  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 968, in _parse_name_from_line

    raise RequirementError(

pipenv.vendor.requirementslib.exceptions.RequirementError: Failed parsing requirement from './sphinx'

I then removed the Pipfile and Pipfile.lock and tried again, it worked from that directory. It seems that once the editable dependency is added into the lock file, it doesn't get updated by changing the path.

mdavis@matt-VirtualBox:~/pipenv-4900/sphinx$ rm Pipfile

mdavis@matt-VirtualBox:~/pipenv-4900/sphinx$ rm Pipfile.lock 

mdavis@matt-VirtualBox:~/pipenv-4900/sphinx$ pipenv install -e .

Creating a Pipfile for this project...

Installing -e ....

Adding Sphinx to Pipfile's [packages]...

✔ Installation Succeeded 

Pipfile.lock not found, creating...

Locking [dev-packages] dependencies...

Locking [packages] dependencies...

Building requirements...

Resolving dependencies...

✔ Success! 

Updated Pipfile.lock (03e436)!

Installing dependencies from Pipfile.lock (03e436)...

  🎅   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:00

To activate this project's virtualenv, run pipenv shell.

Alternatively, run a command inside the virtualenv with pipenv run.

@matteius
Copy link
Member

@PythonCoderAS are we in agreement that its not a bug, can I close this issue without complaints?

@PythonCoderAS
Copy link
Author

I was thinking that the error was too cryptic and could be phrased better, such as "Pipenv does not support installing relative paths from subdirectories of projects."

@matteius
Copy link
Member

@PythonCoderAS I agree the actual error message is somewhat cryptic because it says RequirementError: Failed parsing requirement from '<relative_path> when it really was a failure to even find a setup.py or something to parse, but that is a subset of failing to parse a requirement. Pipenv it just using a vendor packaging of requirementslib and that is what is generating this error.

I am not quite sure I understand yet the duplication of vendor packages within pipenv, but I wonder if this wouldn't be a better issue to report to: https://github.com/sarugaku/requirementslib/issues Maybe @frostming can provide guidance since he already commented on this issue and has context.

One of my goals is to help this project manage its backlog of issues better, and I don't want to just turn away issues in doing so but if we can put them where it makes sense and close ones that are duplicates or won't be fixed, that seems ideal to me.

@frostming
Copy link
Contributor

@matteius I agree with you but unfortunately, I don't have the bandwidth in fixing bugs in either Pipenv or vendored packages. requirementslib does too many things, which makes it hard to make improvements.

@matteius
Copy link
Member

@PythonCoderAS please see frostming's last comment. If this is an important improvement to you, please open the issue with the requirementslib backlog and consider what the change would look like by proposing a PR. I am closing this issue for now since a workaround exists and the error is technically sufficient (though vague).

I would think any improvements to requirementslib should first be made and proven out there first, and that having duplicated code vendor code checked into pipenv should be re-evaluated over time. Going to do a diff of latest requirements lib with latest pipenv vendor requirements lib to see if I can learn more about what's going on there, why we would not just reference the external package, as education for myself.

@matteius
Copy link
Member

matteius commented Dec 3, 2022

Let's track this issue in: #5490

@matteius matteius closed this as completed Dec 3, 2022
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

No branches or pull requests

3 participants