Skip to content

Package with pyproject.toml cannot be installed with pip install -e  #564

@erzoe

Description

@erzoe

OS version

Debian 11

Python version

Python 3.9.2

Pip version

pip 21.3.1

Guide link

https://packaging.python.org/en/latest/tutorials/packaging-projects/

Problem description

I have created an example project as explained in Packaging Python Projects with the following pyproject.toml file:

[build-system]
requires = [
    "setuptools>=42",
    "wheel"
]
build-backend = "setuptools.build_meta"

and setup.cfg:

[metadata]
name = example-pkg-erzo
version = file: src/example_package/version.txt
author = Example Author
author_email = [email protected]
description = A small example package
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/pypa/sampleproject
project_urls =
    Bug Tracker = https://github.com/pypa/sampleproject/issues
classifiers =
    Programming Language :: Python :: 3
    License :: OSI Approved :: MIT License
    Operating System :: OS Independent

[options]
package_dir =
    = src
packages = find:
python_requires = >=3.6

[options.packages.find]
where = src

[options.entry_points]
console_scripts =
    example-program = example_package.main:main
    hello-world = example_package.greet:main

Also I have added a setup.py because I need to include data files:

#!/usr/bin/env python3

import setuptools

setuptools.setup(package_data={"":["*.txt", "doc/*"]})

When I am trying to install the package with pip install -e . I am getting the error message listed in the next section.

Removing pyproject.toml resolves the problem. But does it cause other problems that I am missing right now?

Error message

Defaulting to user installation because normal site-packages is not writeable
Obtaining file://.../example_package_git
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Installing collected packages: example-pkg-erzo
  Running setup.py develop for example-pkg-erzo
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'.../example_package_git/setup.py'"'"'; __file__='"'"'.../example_package_git/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=
         cwd: .../example_package_git/
    Complete output (22 lines):
    running develop
    /tmp/pip-build-env-807d9_g2/overlay/lib/python3.9/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    WARNING: The user site-packages directory is disabled.
    /tmp/pip-build-env-807d9_g2/overlay/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    error: can't create or remove files in install directory
    
    The following error occurred while trying to add or remove files in the
    installation directory:
    
        [Errno 13] Permission denied: '/usr/lib/python3.9/site-packages'
    
    The installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:
    
        /usr/lib/python3.9/site-packages/
    
    This directory does not currently exist.  Please create it and try again, or
    choose a different installation directory (using the -d or --install-dir
    option).
    
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'.../example_package_git/setup.py'"'"'; __file__='"'"'.../example_package_git/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix= Check the logs for full command output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions