Closed yssource closed 1 year ago
What's more. I find another two problems. (1.) (3.)
With the same virtual environment as above, The Pipfile is placed different from where my local development project is. For exmaple
export PIPENV_PIPFILE=/home/jimmy/.venvs/quant/Pipfile
But my project is /tmp/click
.
Then pipenv shell
my virtual environment.
Failing
pipenv install -e git+git@github.com:pallets/click.git#egg=click --dev
is OK to install.
But, the content of the click.egg-link is /tmp/requirementslibwss9zxat/click
, which does not exist.
import click
ModuleNotFoundError: No module named 'click'
Working
git clone https://github.com/pallets/click.git
and then pip install -e .
is OK to install.
Failing
git clone https://github.com/pallets/click.git
and pipenv install -e . --dev -v
. It fails.
And the error message for (3.) .
Installing -e .…
Traceback (most recent call last):
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 90, in __init__
req = REQUIREMENT.parseString(requirement_string)
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1654, in parseString
raise exc
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString
loc, tokens = self._parse( instring, 0 )
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3739, in parseImpl
return self.expr._parse( instring, loc, doActions, callPreParse=False )
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400, in parseImpl
loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/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 "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3092, in __init__
super(Requirement, self).__init__(requirement_string)
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 94, in __init__
requirement_string[e.loc:e.loc + 8]))
pkg_resources.extern.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'.'"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/requirementslib/models/requirements.py", line 912, in _parse_name_from_line
self._requirement = init_requirement(self.line)
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/requirementslib/models/utils.py", line 196, in init_requirement
req = Requirement.parse(name)
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3138, in parse
req, = parse_requirements(s)
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3085, in parse_requirements
yield Requirement(line)
File "/home/jimmy/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3094, in __init__
raise RequirementParseError(str(e))
pkg_resources.RequirementParseError: Invalid requirement, parse error at "'.'"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jimmy/.pyenv/versions/3.7-dev/bin/pipenv", line 11, in <module>
load_entry_point('pipenv', 'console_scripts', 'pipenv')()
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/cli/command.py", line 255, in install
editable_packages=state.installstate.editables,
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/core.py", line 2066, in do_install
pkg_requirement = Requirement.from_line(pkg_line)
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/requirementslib/models/requirements.py", line 2732, in from_line
r = named_req_from_parsed_line(parsed_line)
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/requirementslib/models/requirements.py", line 3201, in named_req_from_parsed_line
if parsed_line.name is not None:
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/requirementslib/models/requirements.py", line 594, in name
self.parse_name()
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/requirementslib/models/requirements.py", line 972, in parse_name
name = self._parse_name_from_line()
File "/mnt/fedora-home/jimmy/workspace/devel/github/pypa/pipenv/pipenv/vendor/requirementslib/models/requirements.py", line 915, in _parse_name_from_line
"Failed parsing requirement from {0!r}".format(self.line)
pipenv.vendor.requirementslib.exceptions.RequirementError: Failed parsing requirement from '.
Looks like #3647.
PIPENV_PYTHON
value will be appended to the virtualenv path, it is deliberate.I'm having a similar issue, except no change of current directory and setting PIPENV_PIPFILE
is involved. Rather, I maintain a typing stubs package in-tree and list it as foobar-stubs = { editable = true, path = "./foobar-stubs" }
; the usual pipenv install --dev
works, but pipenv install --dev --system
doesn't. I'm guessing the issue is that the relative path is passed as-is to pip
, but since it's working from site-packages
or the like, the relative path is obviously incorrect.
One workaround I've tried is using variable expansion, i.e. path = "/$PWD/foobar-stubs"
instead, but that in turn triggers something like ValueError: non-local file URIs are not supported on this platform: 'file://home/user/project-root/foobar-stubs'
.
I can try making a small example package that reproduces this if that helps.
Nevermind, looking closer at the traceback it seems that the issue stems from the parser of requirementslib for some reason - that's what I get for responding to issues at 2 AM. 🙃
Anyone care to recheck this on latest pipenv?
I believe this is fixed on overhaul branch that is out for review: https://github.com/pypa/pipenv/pull/5793
I believe this is resolved now.
2896
https://github.com/pypa/pipenv/issues/2896#issuecomment-431541728 @techalchemy This happens to me also. Yes, I am using
pyenv-virtualenv
pyenv
pipenv
Reproduce
mkdir -v /tmp/hello && cd /tmp/hello
pipenv --python=/home/jimmy/.pyenv/versions/3.7-dev/envs/quant/bin/python --site-packages
pipenv --venv
/home/jimmy/.venvs/quant-6R1YVBAt-/home/jimmy/.pyenv/shims/pythonActual Result
pipenv --venv
/home/jimmy/.venvs/quant-6R1YVBAt-/home/jimmy/.pyenv/shims/pythonExpected Result
pipenv --venv
/home/jimmy/.venvs/quant-6R1YVBAt-${python_version} Or /home/jimmy/.venvs/quant-6R1YVBAtpipenv --suport
{'implementation_name': 'cpython', 'implementation_version': '3.7.3', 'os_name': 'posix', 'platform_machine': 'x86_64', 'platform_python_implementation': 'CPython', 'platform_release': '4.19.47-1-MANJARO', 'platform_system': 'Linux', 'platform_version': '#1 SMP PREEMPT Fri May 31 16:47:49 UTC 2019', 'python_full_version': '3.7.3+', 'python_version': '3.7', 'sys_platform': 'linux'}
Contents of
Pipfile.lock
('/home/jimmy/.venvs/quant/Pipfile.lock'):