pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

Local dependencies are always installed in editable mode

Open tamboles98 opened this issue 1 year ago • 0 comments

Issue description

When installing a package to the environment from a local path using pipenv install ., the package is always installed in editable mode

Pipenv: 2024.0.1 Python: 3.12.4

Expected result

Running: pipenv install . should:

  • Add the package in the current working directory (my_package going forward) to the pipfile, without the editable flag
  • Add my_package in the pipfile lock, without the editable flag
  • Install my_package in the virtual environment in non editable mode

Actual result

Running pipenv install .:

  • Adds the package in the current working directory (my_package going forward) to the pipfile, without the editable flag ✅
  • Adds my_package in the pipfile lock, without the editable flag ✅
  • Installs my_package in the virtual environment in editable mode ❌

Steps to replicate

  1. Have an installable python project in the current working directory
  2. Run pipenv install .
  3. Run pipenv shell
  4. Run pip show my_package (with the name of the package installed)
Name: my_package
Version: 0.1.0
Summary: Sample project
Home-page: 
Author: 
Author-email:
License: 
Location: .../.venv/lib/python3.12/site-packages
Editable project location: .../project_directory (This does not appear if the package is in non-editable mode)
Requires: 
Required-by:
  1. Open a python shell and:
import my_package
print(my_package.__file__) # Output: '/home/sacebell/notebooks/trobleshoot_pipenv/my_package/__init__.py'
# Code is not being loaded from the site_packages folder

Notes

  • This behavior also happens if the virtual environment is not in the project itself
  • This behavior also happens if the installation path is absolute and does not point to the current working directory
  • Manually editing the Pipfile to have my-package = {file = ".", editable=false}, then running pipenv lock and pipenv sync does not fix the issue
  • Running pipenv install -e . --verbose gives:
Installing dependencies from Pipfile.lock (6a1f4b)...
Writing supplied requirement line to temporary file: '-e .'
Install Phase: Editable Requirements
Preparing Installation of '-e .'

$ pipenv --support

Pipenv version: '2024.0.1'

Pipenv location: '/home/sacebell/.pyenv/versions/3.12.4/lib/python3.12/site-packages/pipenv'

Python location: '/home/sacebell/.pyenv/versions/3.12.4/bin/python3.12'

OS Name: 'posix'

User pip version: '24.0'

user Python installations found:

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.12.4',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.10.0-31-amd64',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Debian 5.10.221-1 (2024-07-14)',
 'python_full_version': '3.12.4',
 'python_version': '3.12',
 'sys_platform': 'linux'}

Pipenv–specific environment variables:

  • PIPENV_VENV_IN_PROJECT: 1
  • PIPENV_ACTIVE: 1

Contents of Pipfile ('/home/sacebell/notebooks/trobleshoot_pipenv/Pipfile'):

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

[packages]
my-package = {file = "."}

[dev-packages]

[requires]
python_version = "3.12"

Contents of Pipfile.lock ('/home/sacebell/notebooks/trobleshoot_pipenv/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "affcb2de36f727e24e7110b01058d53eb409d0de54fd2886b2a0c9cb636a1f4b"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.12"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "my-package": {
            "file": "."
        }
    },
    "develop": {}
}

tamboles98 avatar Aug 10 '24 11:08 tamboles98