Pipenv: InstallationError with { path = ".", editable = true }

Created on 14 Mar 2018  Â·  19Comments  Â·  Source: pypa/pipenv

I used to be able to include my own package in the Pipfile using { path = ".", editable = true }, but now I'm getting this error:

pip9.exceptions.InstallationError: No files/directories in /private/tmp/demo (from )

I installed pipenv with Homebrew (pipenv, version 11.7.2), so I can't paste the results of python -m pipenv.help.

This was working with the version available last week on Homebrew.


Expected result

Pipfile.lock is generated.

Actual result
$ pipenv install
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
ellar/pipenv/11.7.2/libexec/lib/python3.6/site-packages/pipenv/../pipenv/patched/piptools/resolver.py", line 200, in _resolve_one_round
    for dep in self._iter_dependencies(best_match):
  File "/usr/local/Cellar/pipenv/11.7.2/libexec/lib/python3.6/site-packages/pipenv/../pipenv/patched/piptools/resolver.py", line 275, in _iter_dependencies
    for dependency in self.repository.get_dependencies(ireq):
  File "/usr/local/Cellar/pipenv/11.7.2/libexec/lib/python3.6/site-packages/pipenv/../pipenv/patched/piptools/repositories/pypi.py", line 173, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "/usr/local/Cellar/pipenv/11.7.2/libexec/lib/python3.6/site-packages/pipenv/../pipenv/patched/piptools/repositories/pypi.py", line 192, in get_legacy_dependencies
    dist = ireq.get_dist()
  File "/usr/local/Cellar/pipenv/11.7.2/libexec/lib/python3.6/site-packages/pipenv/../pipenv/vendor/pip9/req/req_install.py", line 1069, in get_dist
    egg_info = self.egg_info_path('').rstrip('/')
  File "/usr/local/Cellar/pipenv/11.7.2/libexec/lib/python3.6/site-packages/pipenv/../pipenv/vendor/pip9/req/req_install.py", line 515, in egg_info_path
    'No files/directories in %s (from %s)' % (base, filename)
pip9.exceptions.InstallationError: No files/directories in /private/tmp/demo (from )
Steps to replicate
$ tree
.
├── Pipfile
├── foo
│   └── __init__.py
└── setup.py

1 directory, 3 files

where Pipfile:

[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[requires]

python_version = "3.6"

[packages]

foo = { path = ".", editable = true }

and setup.py:

import setuptools

setuptools.setup(
    packages=setuptools.find_packages(),
)

Most helpful comment

Thanks for that info. It seems that in order to use the name I want in the Pipfile I now need to run pipenv run python setup.py develop before running any pipenv commands.

All 19 comments

$ pipenv install -e .

i don't think that's a valid setup.py

$ pipenv install -e .

I don't know what is meant by this comment. https://github.com/pypa/pipfile spec says that this is allowed in a Pipfile and it used to work with prior versions.

i don't think that's a valid setup.py

What makes this setup.py invalid? I'm attempting to produce the minimum example that replicates the bug.

You need to specify the name of your package, or the package manager won’t know how to call your package, and Pipenv won’t be able to know what you mean by the foo package.

The minimal fix is to modify your setup.py:

import setuptools

setuptools.setup(
    name='foo',
    packages=setuptools.find_packages(),
)

Your setup.py (without name) is technically valid (technically setup.py can contain anything as long as it can be executed by the interpreter), but practically you need a few more fields to make the package actually work in the Python ecosystem.

I recommend referencing both the Python Packaging Tutorial and PyPA’s official sample code for required metadata for a practically valid Python package.

Updating my setup.py to:

import setuptools

setuptools.setup(
    name='foo',
    packages=setuptools.find_packages(),
)

and pipenv to 11.8.0 via Homebrew I still get:

Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
f._iter_dependencies(best_match):
  File "/usr/local/Cellar/pipenv/11.8.0/libexec/lib/python3.6/site-packages/pipenv/../pipenv/patched/piptools/resolver.py", line 275, in _iter_dependencies
    for dependency in self.repository.get_dependencies(ireq):
  File "/usr/local/Cellar/pipenv/11.8.0/libexec/lib/python3.6/site-packages/pipenv/../pipenv/patched/piptools/repositories/pypi.py", line 174, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "/usr/local/Cellar/pipenv/11.8.0/libexec/lib/python3.6/site-packages/pipenv/../pipenv/patched/piptools/repositories/pypi.py", line 193, in get_legacy_dependencies
    dist = ireq.get_dist()
  File "/usr/local/Cellar/pipenv/11.8.0/libexec/lib/python3.6/site-packages/pipenv/../pipenv/vendor/pip9/req/req_install.py", line 1069, in get_dist
    egg_info = self.egg_info_path('').rstrip('/')
  File "/usr/local/Cellar/pipenv/11.8.0/libexec/lib/python3.6/site-packages/pipenv/../pipenv/vendor/pip9/req/req_install.py", line 515, in egg_info_path
    'No files/directories in %s (from %s)' % (base, filename)
pip9.exceptions.InstallationError: No files/directories in /private/tmp/demo (from )

You can have a look at PBR as well :)

This is affecting most of my projects that expect pipenv to install a local package as editable. For example, this build was passing last week: https://travis-ci.org/jacebrowning/template-python/jobs/353826520

you need the package to be installed first, most likely.

which is why the intended usage is:

$ pipenv install -e .

That inserts "e1839a8" = {path = ".", editable = true} into my Pipfile.

What is meant by "e1839a8"?

Why does this repository's Pipfile contain the actual name of the package (pipenv = {path = ".", editable = true})?

It’s just a hash.

Sent from my iPhone

On Mar 15, 2018, at 11:41 AM, Jace Browning notifications@github.com wrote:

That inserts "e1839a8" = {path = ".", editable = true} into my Pipfile.

What is meant by "e1839a8"?

Why does this repository's Pipfile contain the actual name of the package (pipenv = {path = ".", editable = true})?

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

@jacebrowning Pipenv is not smart enough to provide a better key (it really is not possible), so it just uses a hash to act as placeholder. It can be anything, so you are free to change the key to anything you want (as long as it does not duplicate other keys, of course).

Thanks for that info. It seems that in order to use the name I want in the Pipfile I now need to run pipenv run python setup.py develop before running any pipenv commands.

I wonder if #1751 is related.

I ran into this as well on 11.9.0. Moving the editable requirement to the first in the list of [packages] seems to have resolved it.

@ipmb Good trick.

However I am out of luck as the editable requirement is the only one I have in [packages].

I am also using 11.9.0.

Strange thing is, that on my local machine (Debian 9 Stretch) it works well, but when I run it on Travis, it fails: https://travis-ci.org/kennethreitz/maya/jobs/362174274

@vlcinsky Do you have an egg-info directory locally? See #1873 for related discussion.

@uranusjr Yes, I have (ignored) egg-info directory and removing it causes my local $ pipenv lock to fail exactly as on Travis.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

konstin picture konstin  Â·  3Comments

AkiraSama picture AkiraSama  Â·  3Comments

Californian picture Californian  Â·  3Comments

ipmb picture ipmb  Â·  3Comments

leileigong picture leileigong  Â·  3Comments