iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.37k stars 3.86k forks source link

`make install` not support `setuptools>58.2.0` #4586

Open Rtoax opened 1 year ago

Rtoax commented 1 year ago

I found that when I install bcc on fedora37 (make install), setuptools gives a warnings:

running install
/usr/lib/python3.11/site-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.11/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(

And found that the BCC Python related code has not been installed or updated. This is caused by a high version of setuptools, One of the workarounds [0][1]:

pip install setuptools==58.2.0

But this is clearly the wrong solution. I haven't found a workable solution at the moment

[0] https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html [1] https://pypa-build.readthedocs.io/en/stable/

time4tea commented 1 year ago

Not sure if this is the same thing..

sudo make install
Built target bcc_py_python3
Install the project...
-- Install configuration: "Release"
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(
Checking .pth file support in /lib/python3/dist-packages/
/usr/bin/python3 -E -c pass
TEST FAILED: /lib/python3/dist-packages/ does NOT support .pth files
bad install directory or PYTHONPATH
...

So.. the installer tries to install the python code under /lib/python rather than /usr/lib/python , so the python doesn't get installed in the right place.

The hack that I found to make it work (not really a source fix) is to update cmake_install.cmake and change the line near the bottom that looks like this (note change of prefix)

COMMAND python3 setup.py install -f --install-layout deb --prefix= --record /home/rxxx/dev/bcc/build/install_manifest_python_bcc.txt

to

COMMAND python3 setup.py install -f --install-layout deb --prefix=/usr --record /home/rxxx/dev/bcc/build/install_manifest_python_bcc.txt

Then run

sudo cmake -P cmake_install.cmake

its a horrible bodge, but it did work. Sorry I don't know the underlying issue.

chenhengqi commented 1 year ago

@jeromemarchand Could you please help with this issue ?

jeromemarchand commented 1 year ago

I found that when I install bcc on fedora37 (make install), setuptools gives a warnings:

running install
/usr/lib/python3.11/site-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.11/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(

And found that the BCC Python related code has not been installed or updated. This is caused by a high version of setuptools, One of the workarounds [0][1]:

pip install setuptools==58.2.0

But this is clearly the wrong solution. I haven't found a workable solution at the moment

[0] https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html [1] https://pypa-build.readthedocs.io/en/stable/

The setup.py script has been deprecated and the first link above has a substitution for the different setup.py command. I'll prepare something and hopefully I'll submit a MR soon.

jeromemarchand commented 12 months ago

This is more complicated than I envision: pip install is far from a simple drop-in replacement for the setup.py install script. Current code passes $PYTHON_FLAGS to setup.py, AFAICT, for a Debian layout option. I don't know how to pass that to pip install. With --config-settings maybe, but the I find the documentation confusing. Another unresolved issue is the uninstall target. Current code write the list of installed files in install_manifest_python_bcc.txt and uninstall instructions are found in Cmakeuninstall.cmake.in. That probably should be change for calling pip uninstall with the proper arguments.

Rtoax commented 11 months ago

FYI, There are more hint during make install, hope it's helpful.

$ cmake xxxx xxx ..
$ make -j8
$ sudo make install
...
-- Installing: /usr/include/bcc/bcc_version.h
-- Installing: /usr/lib64/libbcc_bpf.so.0.28.0
-- Up-to-date: /usr/lib64/libbcc_bpf.so.0
-- Up-to-date: /usr/lib64/libbcc_bpf.so
-- Up-to-date: /usr/include/bcc/BPF.h
-- Up-to-date: /usr/include/bcc/BPFTable.h
running install
/usr/lib/python3.12/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
/usr/lib/python3.12/site-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  self.initialize_options()
running bdist_egg
running egg_info
writing bcc.egg-info/PKG-INFO
writing dependency_links to bcc.egg-info/dependency_links.txt
writing top-level names to bcc.egg-info/top_level.txt
reading manifest file 'bcc.egg-info/SOURCES.txt'
writing manifest file 'bcc.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying bcc/version.py -> build/lib/bcc
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/bcc
copying build/lib/bcc/__init__.py -> build/bdist.linux-x86_64/egg/bcc
copying build/lib/bcc/containers.py -> build/bdist.linux-x86_64/egg/bcc
copying build/lib/bcc/disassembler.py -> build/bdist.linux-x86_64/egg/bcc
copying build/lib/bcc/libbcc.py -> build/bdist.linux-x86_64/egg/bcc