pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

Specify local folder to use for dependency.

Open marsfan opened this issue 4 years ago • 7 comments
trafficstars

Be sure to check the existing issues (both open and closed!), and make sure you are running the latest version of Pipenv.

Check the diagnose documentation for common issues and the PEEP list before posting! We may close your issue if it is very similar to one of them. Please be considerate and follow the PEEP process, or be on your way.

Make sure to mention your debugging experience if the documented solution failed.

Is your feature request related to a problem? Please describe.

I have a project that is structured like this:

project
| 
|-package
|     |-src
|     |-setup.py
|-package_extras
|     |-src
|     |-setup.py
|-package_common
|     |-src
|     |-setup.py

In package/setup.py and package-extras/setup.py I have specified that that package-common as a dependency. When developing the program, I prefer to use editable installs so that I can quickly change and test all three packages. I have added the following to my Pipfile:

[packages]
package_common = {editable=true, path="./package_common}
package= {editable=true, path="./package}
package_extras = {editable=true, path="./package_extras}

When running pipenv update, pipenv checks the dependencies of package and package-extras and determines that it needs to install package-common, however it only searches https://pypi.org/simple, does not find the package, and then errors out.

Describe the solution you'd like

An additional argument or option available for pipenv that will allow me to specify that a dependency of a package is found in a local folder.

Describe alternatives you've considered

  • Manually Installing local packages one-by-one
    • While useable, it somewhat defeats the purpose of using pipenv
  • Installing packages from a repository, or from a VCS:
    • None of these packages are currently available on a repo or VCS Server
    • Doing this prevents the packages from being editable.

Additional context

Add any other context or screenshots about the feature request here. It may be a good idea to mention that platform and Python version you are on.

Python 3.8 Ubuntu x64


$ pipenv --support

Pipenv version: '2021.5.29'

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

Python location: '/usr/bin/python3'

Python installations found:

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

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.8.10',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.4.0-89-generic',
 'platform_system': 'Linux',
 'platform_version': '#100-Ubuntu SMP Fri Sep 24 14:50:10 UTC 2021',
 'python_full_version': '3.8.10',
 'python_version': '3.8',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • PWD
  • LOGNAME
  • XDG_SESSION_TYPE
  • MOTD_SHOWN
  • HOME
  • LANG
  • LS_COLORS
  • SSH_CONNECTION
  • LESSCLOSE
  • XDG_SESSION_CLASS
  • TERM
  • LESSOPEN
  • USER
  • SHLVL
  • XDG_SESSION_ID
  • XDG_RUNTIME_DIR
  • SSH_CLIENT
  • XDG_DATA_DIRS
  • PATH
  • DBUS_SESSION_BUS_ADDRESS
  • SSH_TTY
  • OLDPWD
  • _
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/gabe/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /home/gabe/testproj

Contents of Pipfile ('/home/gabe/testproj/Pipfile'):

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

[packages]
package-common = {editable = true, path = "./package_common"}
package-extras = {editable = true, path = "./package_extras"}
package = {editable = true, path = "./package"}


[dev-packages]

[requires]
python_version = "3.8"

Contents of Pipfile.lock ('/home/gabe/testproj/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "3de06bf6bb1fcffa06b1bbf79a729ef99d0b3be88b2f5b05478af33f74ffb8a7"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.8"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "package-common": {
            "editable": true,
            "path": "./package_common"
        }
    },
    "develop": {}
}

marsfan avatar Oct 25 '21 20:10 marsfan

I have the same issue. Did you find any workaround except manual package install?

akharlamov avatar Oct 25 '21 22:10 akharlamov

@akharlamov Nope

marsfan avatar Oct 26 '21 17:10 marsfan

@marsfan I think we have this issue reported multiple times in this backlog, can you check if this issue and the connected issues on that ticket are the same as this issue you are reporting? See: https://github.com/pypa/pipenv/issues/4551 That ticket tries to capture the exact release that editable local installs broke, which last release I found where they worked as intended was 2018.11.26. I would like to close this issue if you agree.

matteius avatar Dec 24 '21 01:12 matteius

I was able to install an editable dependency locally with pipenv==2021.11.23 version tonight, I installed a local checkout of kombu. I think this issue can be resolved, https://github.com/pypa/pipenv/issues/4542#issuecomment-961785926

(k2) mdavis@matt-VirtualBox:~/shared-projects/pipenv-kombu$ pipenv install -e ../kombu/

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.

Creating a Pipfile for this project...

Installing -e ../kombu/...

Adding kombu 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 (4df6f7)!

Installing dependencies from Pipfile.lock (4df6f7)...

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

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

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

(k2) mdavis@matt-VirtualBox:~/shared-projects/pipenv-kombu$ pip freeze

amqp==5.0.9

asgiref==3.4.1

Django==4.0

-e git+https://github.com/celery/kombu.git@b71b4215c98ec743c754c7d8dbe0dc2810deb91e#egg=kombu

sqlparse==0.4.2

vine==5.0.0

(k2) mdavis@matt-VirtualBox:~/shared-projects/pipenv-kombu$ ls

Pipfile  Pipfile.lock

(k2) mdavis@matt-VirtualBox:~/shared-projects/pipenv-kombu$ cat Pipfile.lock 

{

    "_meta": {

        "hash": {

            "sha256": "4bd03160288c017c81b0d9c5f609e1699968da14dce1362bb1016f10d64df6f7"

        },

        "pipfile-spec": 6,

        "requires": {

            "python_version": "3.9"

        },

        "sources": [

            {

                "name": "pypi",

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

                "verify_ssl": true

            }

        ]

    },

    "default": {

        "amqp": {

            "hashes": [

                "sha256:1e5f707424e544078ca196e72ae6a14887ce74e02bd126be54b7c03c971bef18",

                "sha256:9cd81f7b023fc04bbb108718fbac674f06901b77bfcdce85b10e2a5d0ee91be5"

            ],

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

            "version": "==5.0.9"

        },

        "kombu": {

            "editable": true,

            "path": "./../kombu"

        },

        "vine": {

            "hashes": [

                "sha256:4c9dceab6f76ed92105027c49c823800dd33cacce13bdedc5b914e3514b7fb30",

                "sha256:7d3b1624a953da82ef63462013bbd271d3eb75751489f9807598e8f340bd637e"
            ],
            "markers": "python_version >= '3.6'",
            "version": "==5.0.0"
        }
    },
    "develop": {}
}

(k2) mdavis@matt-VirtualBox:~/shared-projects/pipenv-kombu$ ls
Pipfile  Pipfile.lock

(k2) mdavis@matt-VirtualBox:~/shared-projects/pipenv-kombu$ cat Pipfile

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

[packages]
kombu = {editable = true, path = "./../kombu"}

[dev-packages]

[requires]
python_version = "3.9"

(k2) mdavis@matt-VirtualBox:~/shared-projects/pipenv-kombu$ pipenv --version
pipenv, version 2021.11.23

matteius avatar Dec 24 '21 04:12 matteius

@marsfan if you think this is still an issue on 2021.11.23 we can re-open it, as long as you provide a sample setup.py to use that time. I suspect however that this has been fixed.

matteius avatar Dec 24 '21 04:12 matteius

@matteius Sorry for taking so long to reply. Was away from my relevant code.

I'm still having the same issue as I initially reported. pipenv install -e package_common works, but then pipenv install -e package fails afterwards.

I am using setup.cfg instead of setup.py. Not sure why I wrote setup.py in my initial example.

In the [options] section of package/setup.cfg I have the following:

[options]
packages = find:
install_requires =
    package_common
    requests

The exception that I am getting is could not find a version that satisfies the requirement package_common (from versions: none)

The issue appears to be that pipenv does not know to look in local directories for installing dependencies.

marsfan avatar Jan 04 '22 21:01 marsfan

@marsfan This should work now for editable dependencies that depend on each other for the latest pipenv version, but for this case, you likely need to add both packages as editable to the Pipfile to work.

matteius avatar Aug 28 '22 22:08 matteius