Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken package name (since commit [754b9a52f7bb83d8d356050a14caebc6fbaccc85]) #2547

Closed
Gelma opened this issue Oct 20, 2022 · 11 comments · Fixed by #2560
Closed

Broken package name (since commit [754b9a52f7bb83d8d356050a14caebc6fbaccc85]) #2547

Gelma opened this issue Oct 20, 2022 · 11 comments · Fixed by #2560

Comments

@Gelma
Copy link
Contributor

Gelma commented Oct 20, 2022

Hi,
since commit in subject the package name is UNKNOWN. Tested on different laptops, bisected on fresh Ubuntu 22.04.

:) gelma /tmp/codespell $ sudo python3 setup.py install
running install
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/lib/python3/dist-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.16.0-unknown is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 2.22.1ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
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'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '*.yml'
warning: no previously-included files found matching '*.yaml'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching 'example'
warning: no previously-included files found matching 'example/*'
warning: no previously-included files found matching 'snap'
warning: no previously-included files found matching 'snap/*'
warning: no previously-included files found matching 'tools'
warning: no previously-included files found matching 'tools/*'
warning: no previously-included files found matching 'Makefile'
warning: no previously-included files found matching 'codespell.1.include'
adding license file 'COPYING'
writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/codespell_lib
copying build/lib/codespell_lib/__init__.py -> build/bdist.linux-x86_64/egg/codespell_lib
copying build/lib/codespell_lib/_codespell.py -> build/bdist.linux-x86_64/egg/codespell_lib
creating build/bdist.linux-x86_64/egg/codespell_lib/data
copying build/lib/codespell_lib/data/dictionary.txt -> build/bdist.linux-x86_64/egg/codespell_lib/data
copying build/lib/codespell_lib/data/dictionary_rare.txt -> build/bdist.linux-x86_64/egg/codespell_lib/data
copying build/lib/codespell_lib/data/linux-kernel.exclude -> build/bdist.linux-x86_64/egg/codespell_lib/data
copying build/lib/codespell_lib/data/dictionary_informal.txt -> build/bdist.linux-x86_64/egg/codespell_lib/data
copying build/lib/codespell_lib/data/dictionary_names.txt -> build/bdist.linux-x86_64/egg/codespell_lib/data
copying build/lib/codespell_lib/data/dictionary_usage.txt -> build/bdist.linux-x86_64/egg/codespell_lib/data
copying build/lib/codespell_lib/data/dictionary_en-GB_to_en-US.txt -> build/bdist.linux-x86_64/egg/codespell_lib/data
copying build/lib/codespell_lib/data/dictionary_code.txt -> build/bdist.linux-x86_64/egg/codespell_lib/data
copying build/lib/codespell_lib/data/__init__.py -> build/bdist.linux-x86_64/egg/codespell_lib/data
creating build/bdist.linux-x86_64/egg/codespell_lib/tests
copying build/lib/codespell_lib/tests/test_basic.py -> build/bdist.linux-x86_64/egg/codespell_lib/tests
copying build/lib/codespell_lib/tests/__init__.py -> build/bdist.linux-x86_64/egg/codespell_lib/tests
copying build/lib/codespell_lib/tests/test_dictionary.py -> build/bdist.linux-x86_64/egg/codespell_lib/tests
copying build/lib/codespell_lib/__main__.py -> build/bdist.linux-x86_64/egg/codespell_lib
byte-compiling build/bdist.linux-x86_64/egg/codespell_lib/__init__.py to __init__.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/codespell_lib/_codespell.py to _codespell.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/codespell_lib/data/__init__.py to __init__.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/codespell_lib/tests/test_basic.py to test_basic.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/codespell_lib/tests/__init__.py to __init__.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/codespell_lib/tests/test_dictionary.py to test_dictionary.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/codespell_lib/__main__.py to __main__.cpython-310.pyc
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...
codespell_lib.__pycache__._codespell.cpython-310: module references __file__
codespell_lib.tests.__pycache__.test_dictionary.cpython-310: module references __file__
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
removing '/usr/local/lib/python3.10/dist-packages/UNKNOWN-0.0.0-py3.10.egg' (and everything under it)
creating /usr/local/lib/python3.10/dist-packages/UNKNOWN-0.0.0-py3.10.egg
Extracting UNKNOWN-0.0.0-py3.10.egg to /usr/local/lib/python3.10/dist-packages
UNKNOWN 0.0.0 is already the active version in easy-install.pth

Installed /usr/local/lib/python3.10/dist-packages/UNKNOWN-0.0.0-py3.10.egg
Processing dependencies for UNKNOWN==0.0.0
Finished processing dependencies for UNKNOWN==0.0.0
@DimitriPapadopoulos
Copy link
Collaborator

Commit 754b9a5 is part of #2523.

See #2532, I think this is a duplicate.

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Oct 21, 2022

In short, it looks like the system package python3-setuptools is broken on Debian/Ubuntu. You need to install a vanilla setuptools, typically using pip:

  • sudo apt purge python3-setuptools
  • pip3 install -U setuptools (or pip3 install -U setuptools==59.6.0 to install the same version provided by the system package python3-setuptools)

@DimitriPapadopoulos
Copy link
Collaborator

@Gelma Does the above fix the problem?

Yet we need a different solution, because installing codespell fails both on Ubuntu 18.04 and Ubuntu 22.04.

/Log of installation failure on Ubuntu 18.04
$ pip3 install --user -e ".[dev]"
Obtaining file:///my/path/codespell
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
WARNING: unknown 2.2.3.dev31+gd8476abd does not provide the extra 'dev'
Installing collected packages: UNKNOWN
  Running setup.py develop for UNKNOWN
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/my/path/codespell/setup.py'"'"'; __file__='"'"'/my/path/codespell/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: /my/path/codespell/
    Complete output (32 lines):
    running develop
    /tmp/pip-build-env-8p7es89o/overlay/lib/python3.6/site-packages/setuptools/command/easy_install.py:159: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
      EasyInstallDeprecationWarning,
    WARNING: The user site-packages directory is disabled.
    /tmp/pip-build-env-8p7es89o/overlay/lib/python3.6/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      setuptools.SetuptoolsDeprecationWarning,
    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/local/lib/python3.6/dist-packages/test-easy-install-16844.write-test'
    
    The installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:
    
        /usr/local/lib/python3.6/dist-packages/
    
    Perhaps your account does not have write access to this directory?  If the
    installation directory is a system-owned directory, you may need to sign in
    as the administrator or "root" account.  If you do not have administrative
    access to this machine, you may wish to choose a different installation
    directory, preferably one that is listed in your PYTHONPATH environment
    variable.
    
    For information on other options, you may wish to consult the
    documentation at:
    
      https://setuptools.pypa.io/en/latest/deprecated/easy_install.html
    
    Please make the appropriate changes for your system and try again.
    
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/my/path/codespell/setup.py'"'"'; __file__='"'"'/my/path/codespell/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.
$ 

@Gelma
Copy link
Contributor Author

Gelma commented Oct 21, 2022

Does the above fix the problem?

Of course, not.

My python-setuptools is not broken. Anyway, even installing the latest version via pip, the issue change, but is still broken.

I don't want to waste your precious time trying to replicate it, so I made a video starting from install of Ubuntu 22.04, trying to compile with packaged setuptools, and also after upgrading it.
There is a lot of dead time between stages, but you can skip it super quick.
Here's the video.

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Oct 21, 2022

Indeed I cannot reproduce the problem any more today, whatever the version of setuptools:

  • only python3-setuptools DEB package 59.6.0-1.2 for Ubuntu 22.04
  • only setuptools 65.5.0 installed with pip3
  • both versions

Yet, I managed to fix this UNKNOWN issue somehow:

From my #2532 (comment), 5 days ago on my Ubuntu 22.04 machine:

$ pip3 install --user git+https://github.com/codespell-project/codespell.git
Collecting git+https://github.com/codespell-project/codespell.git
  Cloning https://github.com/codespell-project/codespell.git to /tmp/pip-req-build-2cm03rxk
  Running command git clone --filter=blob:none --quiet https://github.com/codespell-project/codespell.git /tmp/pip-req-build-2cm03rxk
  Resolved https://github.com/codespell-project/codespell.git to commit 055cb2a9bc1e98a9800a352c53c38a50faf62dc3
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: UNKNOWN
  Building wheel for UNKNOWN (pyproject.toml) ... done
  Created wheel for UNKNOWN: filename=UNKNOWN-2.2.2-py3-none-any.whl size=7972 sha256=3d705eaff3dc72bb7b05bc50134eff6f0d8da205f441334d2761b4472621f13c
  Stored in directory: /tmp/pip-ephem-wheel-cache-ju_qo01r/wheels/80/e9/c1/0a51b174dbeeca916646da713d485fb2536d6ebdfce7300a1a
Successfully built UNKNOWN
Installing collected packages: UNKNOWN
Successfully installed UNKNOWN-2.2.2
$ 

Today, on the same Ubuntu 22.04 machine:

$ pip3 install --user git+https://github.com/codespell-project/codespell.git
Collecting git+https://github.com/codespell-project/codespell.git
  Cloning https://github.com/codespell-project/codespell.git to /tmp/pip-req-build-ayv6mupo
  Running command git clone --filter=blob:none --quiet https://github.com/codespell-project/codespell.git /tmp/pip-req-build-ayv6mupo
  Resolved https://github.com/codespell-project/codespell.git to commit 7ec60ca98dc04cdbedc38c16d9d58299ab6a98e1
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: codespell
  Building wheel for codespell (pyproject.toml) ... done
  Created wheel for codespell: filename=codespell-2.2.3.dev32+g7ec60ca-py3-none-any.whl size=215418 sha256=76ea431e9bbc0b2ed715a3036f11e8c051b99c4dcfde5a7cb387ee1d6c3622c1
  Stored in directory: /tmp/pip-ephem-wheel-cache-mgr2fssw/wheels/80/e9/c1/0a51b174dbeeca916646da713d485fb2536d6ebdfce7300a1a
Successfully built codespell
Installing collected packages: codespell
Successfully installed codespell-2.2.3.dev32+g7ec60ca
$ 

I was convinced the version of setuptools is the root of the problem, because I was told so and I was able to fix the problem by uninstalling/installing different versions of setuptools. But obviously, there's more to it. Will keep looking.

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Oct 21, 2022

Starting again, after uninstalling all modules installed by pip, including pip itself, and installing python-* DEB packages of required modules, including pip :

$ pip3 list --user

[notice] A new release of pip available: 22.2 -> 22.3
[notice] To update, run: python3 -m pip install --upgrade pip
$ 
$ dpkg -l | grep python3-pip
ii  python3-pip                                22.0.2+dfsg-1                           all          Python package installer
ii  python3-pip-whl                            22.0.2+dfsg-1                           all          Python package installer (pip wheel)
$ 
$ dpkg -l | grep setuptools
ii  python3-setuptools                         59.6.0-1.2                              all          Python3 Distutils Enhancements
ii  python3-setuptools-whl                     59.6.0-1.2                              all          Python Distutils Enhancements (wheel package)
$ 

Now I can again reproduce the UNKNOWN problem:

$ pip3 install .
Defaulting to user installation because normal site-packages is not writeable
Processing /my/path/codespell
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: UNKNOWN
  Building wheel for UNKNOWN (pyproject.toml) ... done
  Created wheel for UNKNOWN: filename=UNKNOWN-2.2.3.dev32+g7ec60ca9-py3-none-any.whl size=8166 sha256=c14b83df7a50ca261a6e54c1c0cb8a7bf89002693902e6c05aa93b12bace6181
  Stored in directory: /tmp/pip-ephem-wheel-cache-inc6h4fi/wheels/e9/c8/df/25c3c4bfff9990df43d5bef57491ee5bbb2c8e5ee19f6074df
Successfully built UNKNOWN
Installing collected packages: UNKNOWN
Successfully installed UNKNOWN-2.2.3.dev32+g7ec60ca9

[notice] A new release of pip available: 22.2 -> 22.3
[notice] To update, run: python3 -m pip install --upgrade pip
$ 

Installing the new version of pip using pip does help:

$ python3 -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in /usr/local/lib/python3.10/dist-packages (22.2)
Collecting pip
  Downloading pip-22.3-py3-none-any.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 17.0 MB/s eta 0:00:00
Installing collected packages: pip
Successfully installed pip-22.3

[notice] A new release of pip available: 22.2 -> 22.3
$ 
$ pip3 install .
Defaulting to user installation because normal site-packages is not writeable
Processing /volatile/src/codespell
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: codespell
  Building wheel for codespell (pyproject.toml) ... done
  Created wheel for codespell: filename=codespell-2.2.3.dev32+g7ec60ca9-py3-none-any.whl size=245928 sha256=642dd0f492987a6e570586bd96d441f330d1e0c74345735854b1cbf42746c22a
  Stored in directory: /tmp/pip-ephem-wheel-cache-b3k1__li/wheels/e9/c8/df/25c3c4bfff9990df43d5bef57491ee5bbb2c8e5ee19f6074df
Successfully built codespell
Installing collected packages: codespell
Successfully installed codespell-2.2.3.dev32+g7ec60ca9
$ 

In your case, which version of pipis available?

which pip
pip --version

Then back to your specific command:

$ python3 setup.py install --user
Traceback (most recent call last):
  File "/my/path/codespell/setup.py", line 3, in <module>
    from setuptools import setup
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 16, in <module>
    import setuptools.version
  File "/usr/lib/python3/dist-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
$ 

According to No module named pkg_resources:

This error message is caused by a missing/broken Python setuptools package.

So let's update setuptools using pip, since the system setuptools package might be broken on Ubuntu:

$ pip3 install --user -U setuptools
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (59.6.0)
Collecting setuptools
  Using cached setuptools-65.5.0-py3-none-any.whl (1.2 MB)
Installing collected packages: setuptools
Successfully installed setuptools-65.5.0
$ 

Now it works, more or less. The setup process does find the name (no more UNKNOWN), but still fails to determine the version, so installs codespell-0.0.0:

$  python3 setup.py install --user
/home/user/.local/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py:108: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
  warnings.warn(msg, _BetaConfiguration)
running install
/home/user/.local/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/home/user/.local/lib/python3.10/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/home/user/.local/lib/python3.10/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 1.16.0-unknown is an invalid version and will not be supported in a future release
  warnings.warn(
/home/user/.local/lib/python3.10/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(
/home/user/.local/lib/python3.10/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
running bdist_egg
running egg_info
writing codespell.egg-info/PKG-INFO
writing dependency_links to codespell.egg-info/dependency_links.txt
writing entry points to codespell.egg-info/entry_points.txt
writing requirements to codespell.egg-info/requires.txt
writing top-level names to codespell.egg-info/top_level.txt
reading manifest file 'codespell.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
[...]
Installing codespell script to /home/user/.local/bin

Installed /home/user/.local/lib/python3.10/site-packages/codespell-0.0.0-py3.10.egg
Processing dependencies for codespell==0.0.0
Finished processing dependencies for codespell==0.0.0
$ 

Not sure how to fix the version for now. Perhaps stick to pip install until a better solution is found.

@Gelma
Copy link
Contributor Author

Gelma commented Oct 22, 2022

Not sure how to fix the version for now. Perhaps stick to pip install until a better solution is found.

It's enough to revert these file before the commit in subject and it works like a charm:

setup.py
codespell_lib/_codespell.py
codespell_lib/__init__.py

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Oct 22, 2022

The whole point of #2523 was to migrate from the traditional setup.py to pyproject.toml, as described in PEP 621, following Configuring setuptools using pyproject.toml files. Perhaps it was too early to migrate, but I suspect the maintainers won't revert to the legacy build system.

In this context, the real solution is to understand why the name and version of the project are not properly picked by the versions of pip and setuptools bundled with Ubuntu 22.04, and ideally work around the problem in codespell, or open bug reports against Ubuntu.

And again, the proper way to install is not python setup.py install.

@Gelma
Copy link
Contributor Author

Gelma commented Oct 23, 2022

Just for the record, a few notes.

In this context, the real solution is to understand why the name and version of the project are not properly picked by the versions of pip and setuptools bundled with Ubuntu 22.04, and ideally work around the problem in codespell, or open bug reports against Ubuntu.

a) did you watch my video? In that you can see that even installing the latest setuptools (not packaged, by pip), the problem change, is not fixed (the version number is picked as 0.0.0);
b) let's pretend that anyway is a Ubuntu issue, ok, here's a video with the same thing on Arch.

And again, the proper way to install is not python setup.py install.

Ok, so this is not the right way (btw, first time you tell me this). Bring us the light: which one to use?

The funny thing is every time you try to blame something else, and each time is not the solution. Let's recap:
a) my installation is broken;
b) setuptool packaged by Ubuntu is too old;
c) setuptools via pip (but you can't blame it, so is anyway related to Ubuntu);
d) now the command I use;

and now, guess what next?

You can keep it broken and blame the rest of the world. No drama. Mine is working because I reverted.
By the way, from the PEP I quote:

Backwards Compatibility
As this provides a new way to specify a project’s core metadata and is using a new table name which falls under the reserved namespace as outlined in PEP 518, there are no backwards-compatibility concerns.

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Oct 23, 2022

I am sorry I haven't been clear enough. The proper way to install is pip install, see for example Installing Packages. The command you used, python setup.py install is a legacy command bound to disappear. Unfortunately, file setup.py, which has been kept to help with the transition, doesn't work, at least not out of the box on Debian/Ubuntu. Providing a setup.py file to help with transition, only to discover it doesn't work, is far from ideal. This is why I am trying to help with this legacy command – although it is deprecated.

I have been discovering all this myself in the last few days, because of similar issues I had while trying installing codespell. This is still new for me, so please bear with me if I am not making myself clear enough, I am still learning.

Again, the right thing to do is to use pip install, as documented in the README:

Development Setup

You can install required dependencies for development by running the following within a checkout of the codespell source:

pip install -e ".[dev]"

Nowhere does it instruct running setup.py, it's pip all over the place.

Now, this is where it gets complex, even pip install . does not work with the pip and setuptools packages shipping with Debian/Ubuntu. This is consistent with the Python Packaging User Guide and specifically the Requirements for Installing Packages:

Ensure pip, setuptools, and wheel are up to date

While pip alone is sufficient to install from pre-built binary archives, up to date copies of the setuptools and wheel projects are useful to ensure you can also install from source archives:

python3 -m pip install --upgrade pip setuptools wheel

Now back to the issues you (and I) have been experiencing:

  1. To fix the UNKNOWN package name, both with pip install and python setup.py install, you need to upgrade pip itself.
  2. Then to fix the No module named 'pkg_resources' error, only with python setup.py install, you need to upgrade setuptools too.
  3. Finally, I think I have found a way to fix the wrong 0.0.0 version picked in the python setup.py install case only: you need to upgrade setuptools_scm too.

In short, the legacy installation now works for me, provided I update first:

python3 -m pip install --user --upgrade --ignore-installed pip setuptools wheel setuptools_scm
python3 setup.py install --user

But again, the standard installation process would rather be:

python3 -m pip install --user --upgrade --ignore-installed pip setuptools wheel setuptools_scm
pip install --user .

Of course, you are free to revert as you did to run the legacy python setup.py install. Alternatively, you can embrace the new Python packaging system and document these annoying pitfalls during this transition period – that's my choice.

And by the way, I am not the maintainer and I haven't made the choices you complain about. I am just trying to help on my spare time. You have been barking up the wrong tree – if barking was ever needed here.

@DimitriPapadopoulos
Copy link
Collaborator

After many tests described at the end of #2523, it appears that the requirements for installing codespell are:

  • setuptools>=64 or perhaps even setuptools>=61: version 59.6.0 is installed by default on Ubuntu 22.04 which partly explains why installation doesn't work out of the box
  • setuptools_scm[toml]>=6.2: DEB package python3-setuptools-scm is not installed by default on Ubuntu 22.04 and installing it fixes the 0.0.0 version number issue

The question remains why pip install or python setup.py install are unable to pull these required modules. Still investigating this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants