Setuptools is creating is creating egg for UNKNOWN instead of setuptools-rust

Question:

I’m trying to build setuptools rust (v1.3) using python 3.10.4, openssl 3.0 and setuptools v58.2 These are the commands and outputs:

(venv3.10) [/dbc/blr-dbc2112/abandaru/projects]$ python cayman_pyo3_setuptools-rust/pyo3_setuptools-rust/src/setup.py build
running build

(venv3.10) [/dbc/blr-dbc2112/abandaru/projects]$ python cayman_pyo3_setuptools-rust/pyo3_setuptools-rust/src/setup.py install
running install
running bdist_egg
running egg_info
writing UNKNOWN.egg-info/PKG-INFO
writing dependency_links to UNKNOWN.egg-info/dependency_links.txt
writing top-level names to UNKNOWN.egg-info/top_level.txt
reading manifest file 'UNKNOWN.egg-info/SOURCES.txt'
writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
warning: install_lib: 'build/lib' does not exist -- no Python modules to install

creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying UNKNOWN.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying UNKNOWN.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying UNKNOWN.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying UNKNOWN.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/UNKNOWN-0.0.0-py3.10.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing UNKNOWN-0.0.0-py3.10.egg
Copying UNKNOWN-0.0.0-py3.10.egg to /dbc/blr-dbc2112/abandaru/projects/venv3.10/lib/python3.10/site-packages
Adding UNKNOWN 0.0.0 to easy-install.pth file

Installed /dbc/blr-dbc2112/abandaru/projects/venv3.10/lib/python3.10/site-packages/UNKNOWN-0.0.0-py3.10.egg
Processing dependencies for UNKNOWN==0.0.0
Finished processing dependencies for UNKNOWN==0.0.0


(venv3.10) [/dbc/blr-dbc2112/abandaru/projects]$ unzip venv3.10/lib64/python3.10/site-packages/UNKNOWN-0.0.0-py3.10.egg
Archive:  venv3.10/lib64/python3.10/site-packages/UNKNOWN-0.0.0-py3.10.egg
  inflating: EGG-INFO/PKG-INFO       
  inflating: EGG-INFO/SOURCES.txt    
  inflating: EGG-INFO/dependency_links.txt  
  inflating: EGG-INFO/top_level.txt  
  inflating: EGG-INFO/zip-safe 

Edit: Please find the relevant files here:

setup.py:

#!/usr/bin/env python

from setuptools import setup

if __name__ == "__main__":
    setup()

pyproject.toml:

[build-system]
requires = ["setuptools>=58.0", "setuptools_scm[toml]>=3.4.3"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "setuptools_rust/version.py"

[tool.isort]
profile = "black"

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--doctest-modules"

setup.cfg:

[metadata]
name = setuptools-rust
version = attr: setuptools_rust.__version__
author = Nikolay Kim
author_email = [email protected]
license = MIT
description = Setuptools Rust extension plugin
keywords = distutils, setuptools, rust
url = https://github.com/PyO3/setuptools-rust
long_description = file: README.md
long_description_content_type = text/markdown
classifiers =
    Topic :: Software Development :: Version Control
    License :: OSI Approved :: MIT License
    Intended Audience :: Developers
    Programming Language :: Python :: 3
    Programming Language :: Python :: 3.6
    Programming Language :: Python :: 3.7
    Programming Language :: Python :: 3.8
    Programming Language :: Python :: 3.9
    Development Status :: 5 - Production/Stable
    Operating System :: POSIX
    Operating System :: MacOS :: MacOS X
    Operating System :: Microsoft :: Windows

[options]
packages = setuptools_rust
zip_safe = True
install_requires = setuptools>=58.0; semantic_version>=2.8.2,<3; typing_extensions>=3.7.4.3
setup_requires = setuptools>=58.0; setuptools_scm>=6.3.2
python_requires = >=3.7

[options.entry_points]
distutils.commands =
    clean_rust=setuptools_rust:clean_rust
    build_rust=setuptools_rust:build_rust
distutils.setup_keywords =
    rust_extensions=setuptools_rust.setuptools_ext:rust_extensions

I’m not sure why setuptools is building it for unknown and not setuptools-rust. Could someone please point to my mistake?

Asked By: Abhinav Bandaru

||

Answers:

The issue seems to be that your current working directory has to be the directory containing the setup.py script. As far as I can tell anything like python path/to/setup.py will fail, and only python setup.py will succeed. So first cd into the project directory containing the setup.py script, then call setup.py commands.

Answered By: sinoroc